From d5ddf391c14dd3a750856d0d2079a66a2fb7aad8 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 1 Dec 2023 12:25:22 +0100 Subject: [PATCH] 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 --- src/plugins/python/pythonproject.cpp | 15 +++++++-------- src/plugins/python/pythonproject.h | 5 +---- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/plugins/python/pythonproject.cpp b/src/plugins/python/pythonproject.cpp index 02eafcbcff3..49216b2d6a3 100644 --- a/src/plugins/python/pythonproject.cpp +++ b/src/plugins/python/pythonproject.cpp @@ -5,6 +5,8 @@ #include "pythonbuildsystem.h" #include "pythonconstants.h" +#include "pythonkitaspect.h" +#include "pythontr.h" #include @@ -27,15 +29,12 @@ PythonProject::PythonProject(const FilePath &fileName) 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 (res == RestoreResult::Ok) { - if (!activeTarget()) - addTargetForDefaultKit(); - } - - return res; + if (PythonKitAspect::python(k)) + return {}; + return {BuildSystemTask{Task::Error, + Tr::tr("No python interpreter set for kit %1").arg(k->displayName())}}; } PythonProjectNode::PythonProjectNode(const FilePath &path) diff --git a/src/plugins/python/pythonproject.h b/src/plugins/python/pythonproject.h index f59b2b831bc..038ee64a15e 100644 --- a/src/plugins/python/pythonproject.h +++ b/src/plugins/python/pythonproject.h @@ -37,10 +37,7 @@ class PythonProject : public ProjectExplorer::Project public: explicit PythonProject(const Utils::FilePath &filename); - bool needsConfiguration() const final { return false; } - -private: - RestoreResult fromMap(const Utils::Store &map, QString *errorMessage) override; + ProjectExplorer::Tasks projectIssues(const ProjectExplorer::Kit *k) const override; }; } // Python::Internal