forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -205,14 +205,20 @@ void PythonBuildSystem::refresh()
|
|||||||
auto newRoot = std::make_unique<PythonProjectNode>(projectDirectory());
|
auto newRoot = std::make_unique<PythonProjectNode>(projectDirectory());
|
||||||
for (const QString &f : qAsConst(m_files)) {
|
for (const QString &f : qAsConst(m_files)) {
|
||||||
const QString displayName = baseDir.relativeFilePath(f);
|
const QString displayName = baseDir.relativeFilePath(f);
|
||||||
const FileType fileType = f.endsWith(".pyproject") || f.endsWith(".pyqtc") ? FileType::Project
|
const FilePath filePath = FilePath::fromString(f);
|
||||||
: FileType::Source;
|
FileType fileType;
|
||||||
newRoot->addNestedNode(std::make_unique<PythonFileNode>(FilePath::fromString(f),
|
if (f.endsWith(".py"))
|
||||||
displayName, fileType));
|
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) {
|
if (fileType == FileType::Source) {
|
||||||
BuildTargetInfo bti;
|
BuildTargetInfo bti;
|
||||||
bti.buildKey = f;
|
bti.buildKey = f;
|
||||||
bti.targetFilePath = FilePath::fromString(f);
|
bti.targetFilePath = filePath;
|
||||||
bti.projectFilePath = projectFilePath();
|
bti.projectFilePath = projectFilePath();
|
||||||
appTargets.append(bti);
|
appTargets.append(bti);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user