diff options
| author | David Schulz <david.schulz@qt.io> | 2023-11-01 15:05:03 +0100 |
|---|---|---|
| committer | David Schulz <david.schulz@qt.io> | 2023-11-28 12:17:14 +0000 |
| commit | 09e94ae4ac040ad313b7b86e62489dee7cd3804a (patch) | |
| tree | 1e907c076ba18b326b413ed5ac551db4a3e5e380 /src/plugins/python/pythonlanguageclient.cpp | |
| parent | 12428bf1d67bd282c5276383c91d968451b44036 (diff) | |
Python: use kits page in python wizards
Change-Id: I1f7aaf145443481546abb868c8c167186600b848
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonlanguageclient.cpp')
| -rw-r--r-- | src/plugins/python/pythonlanguageclient.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index b13aef42077..b059401dd35 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -4,6 +4,7 @@ #include "pythonlanguageclient.h" #include "pipsupport.h" +#include "pythonbuildconfiguration.h" #include "pysideuicextracompiler.h" #include "pythonconstants.h" #include "pythonplugin.h" @@ -22,6 +23,8 @@ #include <languageserverprotocol/textsynchronization.h> #include <languageserverprotocol/workspace.h> +#include <projectexplorer/buildconfiguration.h> +#include <projectexplorer/buildsteplist.h> #include <projectexplorer/extracompiler.h> #include <projectexplorer/projectmanager.h> #include <projectexplorer/target.h> @@ -207,12 +210,13 @@ void PyLSClient::openDocument(TextEditor::TextDocument *document) const FilePath documentPath = document->filePath(); if (PythonProject *project = pythonProjectForFile(documentPath)) { if (Target *target = project->activeTarget()) { - if (RunConfiguration *rc = target->activeRunConfiguration()) - if (auto aspect = rc->aspect<InterpreterAspect>()) { - updateExtraCompilers(project, - static_cast<PythonInterpreterAspect *>(aspect) - ->extraCompilers()); + if (BuildConfiguration *buildConfig = target->activeBuildConfiguration()) { + if (BuildStepList *buildSteps = buildConfig->buildSteps()) { + BuildStep *buildStep = buildSteps->firstStepWithId(PySideBuildStep::id()); + if (auto *pythonBuildStep = qobject_cast<PySideBuildStep *>(buildStep)) + updateExtraCompilers(project, pythonBuildStep->extraCompilers()); } + } } } else if (isSupportedDocument(document)) { const FilePath workspacePath = documentPath.parentDir(); @@ -321,7 +325,7 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, TextEditor::TextDocument *document) { instance()->resetEditorInfoBar(document); - if (!PythonSettings::pylsEnabled()) + if (!PythonSettings::pylsEnabled() || !python.exists()) return; if (auto client = pythonClients().value(python)) { @@ -347,9 +351,13 @@ void PyLSConfigureAssistant::openDocumentWithPython(const FilePath &python, if (!document || !watcher) return; instance()->handlePyLSState(python, watcher->result(), document); - watcher->deleteLater(); }); + connect(watcher, &CheckPylsWatcher::finished, watcher, &CheckPylsWatcher::deleteLater); + connect(watcher, &CheckPylsWatcher::finished, instance(), [document](){ + instance()->m_runningChecks.remove(document); + }); watcher->setFuture(Utils::asyncRun(&checkPythonLanguageServer, python)); + instance()->m_runningChecks[document] = watcher; } void PyLSConfigureAssistant::handlePyLSState(const FilePath &python, @@ -383,6 +391,8 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume for (QList<TextEditor::TextDocument *> &documents : m_infoBarEntries) documents.removeAll(document); document->infoBar()->removeInfo(installPylsInfoBarId); + if (auto watcher = m_runningChecks.value(document)) + watcher->cancel(); } PyLSConfigureAssistant::PyLSConfigureAssistant(QObject *parent) |
