summaryrefslogtreecommitdiff
path: root/src/plugins/pythoneditor
diff options
context:
space:
mode:
authorChristian Stenger <christian.stenger@qt.io>2017-10-18 12:58:59 +0200
committerChristian Stenger <christian.stenger@qt.io>2017-10-18 12:46:24 +0000
commit0a931c56a4688677481afaa7011e006f468ab8f4 (patch)
tree0ac11c09223d34c477f01ccf8dd03784d532bf04 /src/plugins/pythoneditor
parent172f25d97d6a9b260c6f8a083c4e917027b099c0 (diff)
downloadqt-creator-0a931c56a4688677481afaa7011e006f468ab8f4.tar.gz
PythonEditor: Avoid creation of useless empty run config
Opening a python project created an empty 'Custom RunConfiguration' the first time it had been opened. Avoid this by re-ordering and simplifying the processing of the project and its respective settings. Change-Id: I0c0f71e0dab6f03df46e5ddbdc7e1dbf73e8bef8 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/pythoneditor')
-rw-r--r--src/plugins/pythoneditor/pythoneditorplugin.cpp29
1 files changed, 6 insertions, 23 deletions
diff --git a/src/plugins/pythoneditor/pythoneditorplugin.cpp b/src/plugins/pythoneditor/pythoneditorplugin.cpp
index 29f55ad94d..6564f6ffc4 100644
--- a/src/plugins/pythoneditor/pythoneditorplugin.cpp
+++ b/src/plugins/pythoneditor/pythoneditorplugin.cpp
@@ -312,7 +312,10 @@ public:
if (!canHandle(parent))
return false;
PythonProject *project = static_cast<PythonProject *>(parent->project());
- return project->files(ProjectExplorer::Project::AllFiles).contains(scriptFromId(id));
+ const QString script = scriptFromId(id);
+ if (script.endsWith(".pyqtc"))
+ return false;
+ return project->files(ProjectExplorer::Project::AllFiles).contains(script);
}
bool canRestore(Target *parent, const QVariantMap &map) const override
@@ -560,31 +563,11 @@ Project::RestoreResult PythonProject::fromMap(const QVariantMap &map, QString *e
{
Project::RestoreResult res = Project::fromMap(map, errorMessage);
if (res == RestoreResult::Ok) {
+ refresh();
+
Kit *defaultKit = KitManager::defaultKit();
if (!activeTarget() && defaultKit)
addTarget(createTarget(defaultKit));
-
- refresh();
-
- QList<Target *> targetList = targets();
- foreach (Target *t, targetList) {
- const QList<RunConfiguration *> runConfigs = t->runConfigurations();
- foreach (const QString &file, m_files) {
- // skip the 'project' file
- if (file.endsWith(".pyqtc"))
- continue;
- const Id id = idFromScript(file);
- bool alreadyPresent = false;
- foreach (RunConfiguration *runCfg, runConfigs) {
- if (runCfg->id() == id) {
- alreadyPresent = true;
- break;
- }
- }
- if (!alreadyPresent)
- t->addRunConfiguration(IRunConfigurationFactory::createHelper<PythonRunConfiguration>(t, id));
- }
- }
}
return res;