diff --git a/src/lib/settings/ProjectSettings.cpp b/src/lib/settings/ProjectSettings.cpp index 7c1f3ad0..da50169d 100644 --- a/src/lib/settings/ProjectSettings.cpp +++ b/src/lib/settings/ProjectSettings.cpp @@ -23,7 +23,7 @@ const std::wstring ProjectSettings::BOOKMARK_DB_FILE_EXTENSION = L".srctrlbm"; const std::wstring ProjectSettings::INDEX_DB_FILE_EXTENSION = L".srctrldb"; const std::wstring ProjectSettings::TEMP_INDEX_DB_FILE_EXTENSION = L".srctrldb_tmp"; -const size_t ProjectSettings::VERSION = 7; +const size_t ProjectSettings::VERSION = 8; LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath) { @@ -395,6 +395,12 @@ SettingsMigrator ProjectSettings::getMigrations() const migrator.addMigration(7, std::make_shared(key + "/standard", key + "/" + languageName + "_standard")); } + for (std::shared_ptr sourceGroupSettings : getAllSourceGroupSettings()) + { + const std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId(); + migrator.addMigration(8, std::make_shared(key + "/python_environment_directory_path", key + "/python_environment_path")); + } + return migrator; } diff --git a/src/lib/settings/SourceGroupSettingsPythonEmpty.cpp b/src/lib/settings/SourceGroupSettingsPythonEmpty.cpp index 45c807f9..4a618495 100644 --- a/src/lib/settings/SourceGroupSettingsPythonEmpty.cpp +++ b/src/lib/settings/SourceGroupSettingsPythonEmpty.cpp @@ -23,7 +23,7 @@ void SourceGroupSettingsPythonEmpty::load(std::shared_ptr c SourceGroupSettingsWithSourcePaths::load(config, key); SourceGroupSettingsWithSourceExtensions::load(config, key); - setEnvironmentDirectoryPath(config->getValueOrDefault(key + "/python_environment_directory_path", FilePath(L""))); + setEnvironmentPath(config->getValueOrDefault(key + "/python_environment_path", FilePath(L""))); } void SourceGroupSettingsPythonEmpty::save(std::shared_ptr config) @@ -36,7 +36,7 @@ void SourceGroupSettingsPythonEmpty::save(std::shared_ptr config) SourceGroupSettingsWithSourcePaths::save(config, key); SourceGroupSettingsWithSourceExtensions::save(config, key); - config->setValue(key + "/python_environment_directory_path", getEnvironmentDirectoryPath().wstr()); + config->setValue(key + "/python_environment_path", getEnvironmentPath().wstr()); } bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr other) const @@ -49,23 +49,23 @@ bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr SourceGroupSettingsWithExcludeFilters::equals(otherPython) && SourceGroupSettingsWithSourcePaths::equals(otherPython) && SourceGroupSettingsWithSourceExtensions::equals(otherPython) && - m_environmentDirectoryPath == otherPython->m_environmentDirectoryPath + m_environmentPath == otherPython->m_environmentPath ); } -FilePath SourceGroupSettingsPythonEmpty::getEnvironmentDirectoryPath() const +FilePath SourceGroupSettingsPythonEmpty::getEnvironmentPath() const { - return m_environmentDirectoryPath; + return m_environmentPath; } -FilePath SourceGroupSettingsPythonEmpty::getEnvironmentDirectoryPathExpandedAndAbsolute() const +FilePath SourceGroupSettingsPythonEmpty::getEnvironmentPathExpandedAndAbsolute() const { - return m_projectSettings->makePathExpandedAndAbsolute(getEnvironmentDirectoryPath()); + return m_projectSettings->makePathExpandedAndAbsolute(getEnvironmentPath()); } -void SourceGroupSettingsPythonEmpty::setEnvironmentDirectoryPath(const FilePath& environmentDirectoryPath) +void SourceGroupSettingsPythonEmpty::setEnvironmentPath(const FilePath& environmentPath) { - m_environmentDirectoryPath = environmentDirectoryPath; + m_environmentPath = environmentPath; } std::vector SourceGroupSettingsPythonEmpty::getDefaultSourceExtensions() const diff --git a/src/lib/settings/SourceGroupSettingsPythonEmpty.h b/src/lib/settings/SourceGroupSettingsPythonEmpty.h index 4e6e76cb..fac240eb 100644 --- a/src/lib/settings/SourceGroupSettingsPythonEmpty.h +++ b/src/lib/settings/SourceGroupSettingsPythonEmpty.h @@ -23,14 +23,14 @@ public: bool equals(std::shared_ptr other) const override; - FilePath getEnvironmentDirectoryPath() const; - FilePath getEnvironmentDirectoryPathExpandedAndAbsolute() const; - void setEnvironmentDirectoryPath(const FilePath& environmentDirectoryPath); + FilePath getEnvironmentPath() const; + FilePath getEnvironmentPathExpandedAndAbsolute() const; + void setEnvironmentPath(const FilePath& environmentPath); private: std::vector getDefaultSourceExtensions() const override; - FilePath m_environmentDirectoryPath; + FilePath m_environmentPath; }; #endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp index 92e5dd8f..52c11d39 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPath.cpp @@ -735,12 +735,18 @@ QtProjectWizzardContentPathPythonEnvironment::QtProjectWizzardContentPathPythonE : QtProjectWizzardContentPath(window) , m_settings(settings) { - setTitleString("Python Environment Directory"); + setTitleString("Python Environment"); setHelpString( - "Here you can specify the path to the directory that contains the Python environment that should be used to resolve " - "dependencies within the indexed source code. Leave blank to use the default Python environment.
" + "Here you can specify the path to the directory or to the executable of the (virtual) Python environment that should be used to resolve " + "dependencies within the indexed source code.
" "
" - "You can make use of environment variables with ${ENV_VAR}." + "If you would run:
" + "
" + "$ cd C:\\dev\\python\\envs
" + "$ virtualenv py37
" + "
" + "you would set it to \"C:\\dev\\python\\envs\\py37\" or \"C:\\dev\\python\\envs\\py37\\Scripts\\python.exe\".
" + "Leave blank to use the default Python environment. You can make use of environment variables with ${ENV_VAR}." ); setPlaceholderString("Use Default"); setAllowEmpty(true); @@ -762,12 +768,12 @@ void QtProjectWizzardContentPathPythonEnvironment::populate(QGridLayout* layout, void QtProjectWizzardContentPathPythonEnvironment::load() { - m_picker->setText(QString::fromStdWString(m_settings->getEnvironmentDirectoryPath().wstr())); + m_picker->setText(QString::fromStdWString(m_settings->getEnvironmentPath().wstr())); } void QtProjectWizzardContentPathPythonEnvironment::save() { - m_settings->setEnvironmentDirectoryPath(FilePath(m_picker->getText().toStdWString())); + m_settings->setEnvironmentPath(FilePath(m_picker->getText().toStdWString())); } void QtProjectWizzardContentPathPythonEnvironment::onTextChanged(const QString& text) diff --git a/src/lib_python/project/SourceGroupPythonEmpty.cpp b/src/lib_python/project/SourceGroupPythonEmpty.cpp index c1eecd1e..6403c420 100644 --- a/src/lib_python/project/SourceGroupPythonEmpty.cpp +++ b/src/lib_python/project/SourceGroupPythonEmpty.cpp @@ -47,9 +47,9 @@ std::vector> SourceGroupPythonEmpty::getIndexerC args += L" --source-file-path=%{SOURCE_FILE_PATH}"; args += L" --database-file-path=%{DATABASE_FILE_PATH}"; - if (!m_settings->getEnvironmentDirectoryPath().empty()) + if (!m_settings->getEnvironmentPath().empty()) { - args += L" --environment-path=" + m_settings->getEnvironmentDirectoryPathExpandedAndAbsolute().wstr(); + args += L" --environment-path=" + m_settings->getEnvironmentPathExpandedAndAbsolute().wstr(); } if (ApplicationSettings::getInstance()->getVerboseIndexerLoggingEnabled())