Python: optimize loading projects

Loading .pyprojects file now doesnt add a target for the default kit but
results in showing the target setup page which is filtered for usable
kits.

Change-Id: I4c407960a90a27457314281b79dc8878510eca80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
David Schulz
2023-12-01 12:25:22 +01:00
parent 7a6d99a9f6
commit d5ddf391c1
2 changed files with 8 additions and 12 deletions

View File

@@ -5,6 +5,8 @@
#include "pythonbuildsystem.h" #include "pythonbuildsystem.h"
#include "pythonconstants.h" #include "pythonconstants.h"
#include "pythonkitaspect.h"
#include "pythontr.h"
#include <coreplugin/icontext.h> #include <coreplugin/icontext.h>
@@ -27,15 +29,12 @@ PythonProject::PythonProject(const FilePath &fileName)
setBuildSystemCreator([](Target *t) { return new PythonBuildSystem(t); }); setBuildSystemCreator([](Target *t) { return new PythonBuildSystem(t); });
} }
Project::RestoreResult PythonProject::fromMap(const Store &map, QString *errorMessage) Tasks PythonProject::projectIssues(const Kit *k) const
{ {
Project::RestoreResult res = Project::fromMap(map, errorMessage); if (PythonKitAspect::python(k))
if (res == RestoreResult::Ok) { return {};
if (!activeTarget()) return {BuildSystemTask{Task::Error,
addTargetForDefaultKit(); Tr::tr("No python interpreter set for kit %1").arg(k->displayName())}};
}
return res;
} }
PythonProjectNode::PythonProjectNode(const FilePath &path) PythonProjectNode::PythonProjectNode(const FilePath &path)

View File

@@ -37,10 +37,7 @@ class PythonProject : public ProjectExplorer::Project
public: public:
explicit PythonProject(const Utils::FilePath &filename); explicit PythonProject(const Utils::FilePath &filename);
bool needsConfiguration() const final { return false; } ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const override;
private:
RestoreResult fromMap(const Utils::Store &map, QString *errorMessage) override;
}; };
} // Python::Internal } // Python::Internal