From cc129e4895d77461838431b3dd6902a72f8eb812 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Fri, 10 Dec 2021 09:35:32 -0600 Subject: [PATCH] Fix Python version check and translations --- CMakeLists.txt | 5 +- src/plugin_python_en.ts | 108 ++++++++++++++++++++++++++++++++++++ src/proxy/proxypython.cpp | 9 ++- src/pythonrunner_en.ts | 17 ------ src/runner/CMakeLists.txt | 2 +- src/runner/pythonrunner.cpp | 2 +- 6 files changed, 118 insertions(+), 25 deletions(-) create mode 100644 src/plugin_python_en.ts delete mode 100644 src/pythonrunner_en.ts diff --git a/CMakeLists.txt b/CMakeLists.txt index 9de6dde..a9024d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,13 +3,16 @@ cmake_minimum_required(VERSION 3.16) project(plugin_python) set(project_type plugin) set(enable_warnings OFF) -set(create_translations OFF) +set(create_translations ON) + +set(additional_translations "${CMAKE_SOURCE_DIR}/src/runner") if(DEFINED DEPENDENCIES_DIR) include(${DEPENDENCIES_DIR}/modorganizer_super/cmake_common/project.cmake) else() include(../cmake_common/project.cmake) endif() + add_subdirectory(src/proxy) add_subdirectory(src/runner) diff --git a/src/plugin_python_en.ts b/src/plugin_python_en.ts new file mode 100644 index 0000000..e1b379a --- /dev/null +++ b/src/plugin_python_en.ts @@ -0,0 +1,108 @@ + + + + + ProxyPython + + + Python Initialization failed + + + + + On a previous start the Python Plugin failed to initialize. +Either the value in Settings->Plugins->ProxyPython->plugin_dir is set incorrectly or it is empty and auto-detection doesn't work for whatever reason. +Do you want to try initializing python again (at the risk of another crash)? +Suggestion: Select "no", and click the warning sign for further help. Afterwards you have to re-enable the python plugin. + + + + + Python Proxy + + + + + Proxy Plugin to allow plugins written in python to be loaded + + + + + Python not installed or not found + + + + + Python version is incompatible + + + + + Invalid python path + + + + + Initializing Python failed + + + + + Python auto-detection failed + + + + + ModOrganizer path contains a semicolon + + + + + invalid problem key %1 + + + + + Some MO plugins require the python interpreter to be installed. These plugins will not even show up in settings-&gt;plugins.<br>If you want to use those plugins, please install the 32-bit version of Python 2.7.x from <a href="%1">%1</a>.<br>This is only required to use some extended functionality in MO, you do not need Python to play the game. + + + + + The loaded version of python does not match the expected 3.10.<br>This may cause some or all python plugins to stop working.<br>The expected python libraries should come bundled with MO2,<br>you may want to perform a clean install of the application. + + + + + Please set python_dir in Settings->Plugins->ProxyPython to the path of your python 2.7 (32 bit) installation. + + + + + The auto-detection of the python path failed. I don't know why this would happen but you can try to fix it by setting python_dir in Settings->Plugins->ProxyPython to the path of your python 2.7 (32 bit) installation. + + + + + Sorry, I don't know any details. Most likely your python installation is not supported. + + + + + The path to Mod Organizer (%1) contains a semicolon. <br>While this is legal on NTFS drives there is a lot of software that doesn't handle it correctly.<br>Unfortunately MO depends on libraries that seem to fall into that group.<br>As a result the python plugin can't be loaded.<br>The only solution I can offer is to remove the semicolon / move MO to a path without a semicolon. + + + + + QObject + + + An unexpected C++ exception was thrown in python code. + + + + + An unknown exception was thrown in python code. + + + + diff --git a/src/proxy/proxypython.cpp b/src/proxy/proxypython.cpp index 73dec01..0633524 100644 --- a/src/proxy/proxypython.cpp +++ b/src/proxy/proxypython.cpp @@ -330,11 +330,10 @@ QString ProxyPython::fullDescription(unsigned int key) const "This is only required to use some extended functionality in MO, you do not need Python to play the game.").arg(s_DownloadPythonURL); } break; case PROBLEM_PYTHONWRONGVERSION: { - return tr("Your installed python version has a different version than 2.7. " - "Some MO plugins may not work.
" - "If you have multiple versions of python installed you may have to configure the path to 2.7 (32 bit) " - "in the settings dialog.
" - "This is only required to use some extended functionality in MO, you do not need Python to play the game."); + return tr("The loaded version of python does not match the expected 3.10.
" + "This may cause some or all python plugins to stop working.
" + "The expected python libraries should come bundled with MO2,
" + "you may want to perform a clean install of the application."); } break; case PROBLEM_WRONGPYTHONPATH: { return tr("Please set python_dir in Settings->Plugins->ProxyPython to the path of your python 2.7 (32 bit) installation."); diff --git a/src/pythonrunner_en.ts b/src/pythonrunner_en.ts deleted file mode 100644 index 28e31af..0000000 --- a/src/pythonrunner_en.ts +++ /dev/null @@ -1,17 +0,0 @@ - - - - - QObject - - - An unexpected C++ exception was thrown in python code. - - - - - An unknown exception was thrown in python code. - - - - diff --git a/src/runner/CMakeLists.txt b/src/runner/CMakeLists.txt index b64502e..eca0b98 100644 --- a/src/runner/CMakeLists.txt +++ b/src/runner/CMakeLists.txt @@ -5,7 +5,7 @@ set(project_type plugin) set(enable_warnings OFF) set(enable_bigobj ON) set(install_dir bin/plugins/data) -set(create_translations ON) +set(create_translations OFF) add_compile_definitions( QT_NO_KEYWORDS diff --git a/src/runner/pythonrunner.cpp b/src/runner/pythonrunner.cpp index 5547072..20a7edb 100644 --- a/src/runner/pythonrunner.cpp +++ b/src/runner/pythonrunner.cpp @@ -1570,6 +1570,6 @@ bool PythonRunner::isPythonInstalled() const bool PythonRunner::isPythonVersionSupported() const { const char *version = Py_GetVersion(); - return strstr(version, "3.8") == version; + return strstr(version, "3.10") == version; }