ui: add example for python environment to source group settings ui and changed name in project settings file (issue #696)

This commit is contained in:
mlangkabel
2019-05-28 17:47:27 +02:00
parent d2b41f7598
commit b90444b943
5 changed files with 34 additions and 22 deletions
+7 -1
View File
@@ -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<SettingsMigrationMoveKey>(key + "/standard", key + "/" + languageName + "_standard"));
}
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
{
const std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId();
migrator.addMigration(8, std::make_shared<SettingsMigrationMoveKey>(key + "/python_environment_directory_path", key + "/python_environment_path"));
}
return migrator;
}
@@ -23,7 +23,7 @@ void SourceGroupSettingsPythonEmpty::load(std::shared_ptr<const ConfigManager> 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<ConfigManager> config)
@@ -36,7 +36,7 @@ void SourceGroupSettingsPythonEmpty::save(std::shared_ptr<ConfigManager> 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<SourceGroupSettings> other) const
@@ -49,23 +49,23 @@ bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr<SourceGroupSettings>
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<std::wstring> SourceGroupSettingsPythonEmpty::getDefaultSourceExtensions() const
@@ -23,14 +23,14 @@ public:
bool equals(std::shared_ptr<SourceGroupSettings> 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<std::wstring> getDefaultSourceExtensions() const override;
FilePath m_environmentDirectoryPath;
FilePath m_environmentPath;
};
#endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
@@ -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.<br />"
"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. <br />"
"<br />"
"You can make use of environment variables with ${ENV_VAR}."
"If you would run:<br />"
"<br />"
"$ cd C:\\dev\\python\\envs<br />"
"$ virtualenv py37<br />"
"<br />"
"you would set it to \"C:\\dev\\python\\envs\\py37\" or \"C:\\dev\\python\\envs\\py37\\Scripts\\python.exe\". <br />"
"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)
@@ -47,9 +47,9 @@ std::vector<std::shared_ptr<IndexerCommand>> 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())