diff options
author | David Schulz <david.schulz@qt.io> | 2019-10-25 09:15:59 +0200 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2019-10-30 08:46:12 +0000 |
commit | 6664d78ded334264c3486c0b9472b23f8f3fc2e0 (patch) | |
tree | 88954987cd04285e4c94d3e74e75573387ff1a51 /src/plugins/python/pythonsettings.h | |
parent | 519fc4ec72b1c59b2485bde0e02191b21506d4af (diff) | |
download | qt-creator-6664d78ded334264c3486c0b9472b23f8f3fc2e0.tar.gz |
Python: detect virtual environments for documents and projects
After opening a document or project the directory hierarchy is looked up
for a Scripts/(activate && python.exe) on windows or bin/(activate &&
python) on unix. This is the usual structure of python virtual
environments. If such a folder is found add the python from that folder
to the list of configured interpreters in the settings, set it as the
current interpreter for the project and try to open the corresponding
language server.
Change-Id: I038c309ea2988f9370194330d250d1515beac0a0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/python/pythonsettings.h')
-rw-r--r-- | src/plugins/python/pythonsettings.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/python/pythonsettings.h b/src/plugins/python/pythonsettings.h index 7ca5218ae3..02c62ab65f 100644 --- a/src/plugins/python/pythonsettings.h +++ b/src/plugins/python/pythonsettings.h @@ -26,6 +26,7 @@ #pragma once #include <utils/fileutils.h> +#include <utils/optional.h> #include <QUuid> @@ -57,13 +58,18 @@ public: static QList<Interpreter> interpreters(); static Interpreter defaultInterpreter(); static void setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId); + static void addInterpreter(const Interpreter &interpreter, bool isDefault = false); static PythonSettings *instance(); + static QList<Interpreter> detectPythonVenvs(const Utils::FilePath &path); + signals: void interpretersChanged(const QList<Interpreter> &interpreters, const QString &defaultId); private: PythonSettings(); + + static void saveSettings(); }; } // namespace Internal |