diff options
author | Christian Stenger <christian.stenger@qt.io> | 2019-11-14 15:43:05 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2019-11-15 12:01:12 +0000 |
commit | dd93820fdd550e21c6e1f0c6eaaae11afdb8fc51 (patch) | |
tree | 7dec06c198a95dc0024a041d0262e73953d2ddd4 /src/plugins/python/pythonproject.cpp | |
parent | 905714274c1cfbddf0980e69f93daf5b4d633353 (diff) | |
download | qt-creator-dd93820fdd550e21c6e1f0c6eaaae11afdb8fc51.tar.gz |
Python: Restrict creating run configurations
Some upcoming wizards will have other files beside
python scripts. (e.g. qml, ui)
Ensure that these files do not get a run configuration.
Change-Id: I0fe55edc6ccfe2db64537401e6a46fd4bdd7e153
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/python/pythonproject.cpp')
-rw-r--r-- | src/plugins/python/pythonproject.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/plugins/python/pythonproject.cpp b/src/plugins/python/pythonproject.cpp index 921f66b043..892b9f144f 100644 --- a/src/plugins/python/pythonproject.cpp +++ b/src/plugins/python/pythonproject.cpp @@ -205,14 +205,20 @@ void PythonBuildSystem::refresh() auto newRoot = std::make_unique<PythonProjectNode>(projectDirectory()); for (const QString &f : qAsConst(m_files)) { const QString displayName = baseDir.relativeFilePath(f); - const FileType fileType = f.endsWith(".pyproject") || f.endsWith(".pyqtc") ? FileType::Project - : FileType::Source; - newRoot->addNestedNode(std::make_unique<PythonFileNode>(FilePath::fromString(f), - displayName, fileType)); + const FilePath filePath = FilePath::fromString(f); + FileType fileType; + if (f.endsWith(".py")) + fileType = FileType::Source; + else if (f.endsWith(".pyproject") || f.endsWith(".pyqtc")) + fileType = FileType::Project; + else + fileType = Node::fileTypeForFileName(filePath); + + newRoot->addNestedNode(std::make_unique<PythonFileNode>(filePath, displayName, fileType)); if (fileType == FileType::Source) { BuildTargetInfo bti; bti.buildKey = f; - bti.targetFilePath = FilePath::fromString(f); + bti.targetFilePath = filePath; bti.projectFilePath = projectFilePath(); appTargets.append(bti); } |