0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

frontend-tools: Display dialog when changing Python version

Runtime switching of Python version is not supported.
This commit is contained in:
Matt Gajownik 2022-08-06 15:32:31 +10:00 committed by jp9000
parent 89d9493468
commit 05b6346250
2 changed files with 19 additions and 1 deletions

View File

@ -41,6 +41,8 @@ PythonSettings.PythonInstallPath64bit="Python Install Path (64bit)"
PythonSettings.BrowsePythonPath="Browse Python Path"
PythonSettings.PythonVersion="Loaded Python Version: %1"
PythonSettings.PythonNotLoaded="Python not currently loaded"
PythonSettings.AlreadyLoaded.Title="Python Already Loaded"
PythonSettings.AlreadyLoaded.Message="A copy of Python %1 is already loaded. To load the newly selected Python version, please restart OBS."
ScriptLogWindow="Script Log"
Description="Description"
ScriptDescriptionLink.Text="Open this link in your default web browser?"

View File

@ -470,8 +470,24 @@ void ScriptsTool::on_pythonPathBrowse_clicked()
ui->pythonPath->setText(newPath);
if (obs_scripting_python_loaded())
bool loaded = obs_scripting_python_loaded();
if (loaded && !newPath.isEmpty() && curPath.compare(newPath) != 0) {
char version[8];
obs_scripting_python_version(version, sizeof(version));
QString message =
QString(obs_module_text(
"PythonSettings.AlreadyLoaded.Message"))
.arg(version);
OBSMessageBox::information(
this,
obs_module_text("PythonSettings.AlreadyLoaded.Title"),
message);
return;
} else if (loaded) {
return;
}
if (!obs_scripting_load_python(path))
return;