From 28cfdf388ae3e3ed7e073e98a83c737d889d887f Mon Sep 17 00:00:00 2001 From: hjk Date: Wed, 13 Apr 2022 12:26:54 +0200 Subject: Promote previously python-specific InterpreterAspect ... and drop PythonRunConfiguration, which is a plain RunConfiguration now. Change-Id: I540cb738180fc1424f730d6d1998886915ce527b Reviewed-by: Reviewed-by: David Schulz --- src/plugins/python/pythonutils.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/plugins/python/pythonutils.cpp') diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp index 713c48821e..6c8ff9bcba 100644 --- a/src/plugins/python/pythonutils.cpp +++ b/src/plugins/python/pythonutils.cpp @@ -39,6 +39,7 @@ #include #include +using namespace ProjectExplorer; using namespace Utils; namespace Python { @@ -51,15 +52,15 @@ FilePath detectPython(const FilePath &documentPath) PythonProject *project = documentPath.isEmpty() ? nullptr : qobject_cast( - ProjectExplorer::SessionManager::projectForFile(documentPath)); + SessionManager::projectForFile(documentPath)); if (!project) - project = qobject_cast(ProjectExplorer::SessionManager::startupProject()); + project = qobject_cast(SessionManager::startupProject()); if (project) { if (auto target = project->activeTarget()) { - if (auto runConfig = qobject_cast( - target->activeRunConfiguration())) { - python = runConfig->interpreter().command; + if (auto runConfig = target->activeRunConfiguration()) { + if (auto interpreter = runConfig->aspect()) + python = interpreter->currentInterpreter().command; } } } @@ -99,7 +100,7 @@ void openPythonRepl(QObject *parent, const FilePath &file, ReplType type) { static const auto workingDir = [](const FilePath &file) { if (file.isEmpty()) { - if (ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject()) + if (Project *project = SessionManager::startupProject()) return project->projectDirectory(); return FilePath::fromString(QDir::currentPath()); } @@ -147,7 +148,7 @@ QString pythonName(const FilePath &pythonPath) PythonProject *pythonProjectForFile(const FilePath &pythonFile) { - for (ProjectExplorer::Project *project : ProjectExplorer::SessionManager::projects()) { + for (Project *project : SessionManager::projects()) { if (auto pythonProject = qobject_cast(project)) { if (pythonProject->isKnownFile(pythonFile)) return pythonProject; -- cgit v1.2.1