Commit 0a931c56 authored by Christian Stenger's avatar Christian Stenger

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: default avatarhjk <>
parent 172f25d9
......@@ -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) {
Kit *defaultKit = KitManager::defaultKit();
if (!activeTarget() && defaultKit)
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"))
const Id id = idFromScript(file);
bool alreadyPresent = false;
foreach (RunConfiguration *runCfg, runConfigs) {
if (runCfg->id() == id) {
alreadyPresent = true;
if (!alreadyPresent)
t->addRunConfiguration(IRunConfigurationFactory::createHelper<PythonRunConfiguration>(t, id));
return res;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment