Fix Python version check and translations

This commit is contained in:
Jeremy Rimpo
2021-12-10 09:35:32 -06:00
parent 7e8748abf0
commit cc129e4895
6 changed files with 118 additions and 25 deletions
+4 -1
View File
@@ -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)
+108
View File
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>ProxyPython</name>
<message>
<location filename="proxy/proxypython.cpp" line="159"/>
<source>Python Initialization failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="160"/>
<source>On a previous start the Python Plugin failed to initialize.
Either the value in Settings-&gt;Plugins-&gt;ProxyPython-&gt;plugin_dir is set incorrectly or it is empty and auto-detection doesn&apos;t work for whatever reason.
Do you want to try initializing python again (at the risk of another crash)?
Suggestion: Select &quot;no&quot;, and click the warning sign for further help. Afterwards you have to re-enable the python plugin.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="204"/>
<source>Python Proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="214"/>
<source>Proxy Plugin to allow plugins written in python to be loaded</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="300"/>
<source>Python not installed or not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="303"/>
<source>Python version is incompatible</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="306"/>
<source>Invalid python path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="309"/>
<source>Initializing Python failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="312"/>
<source>Python auto-detection failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="315"/>
<source>ModOrganizer path contains a semicolon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="318"/>
<source>invalid problem key %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="327"/>
<source>Some MO plugins require the python interpreter to be installed. These plugins will not even show up in settings-&amp;gt;plugins.&lt;br&gt;If you want to use those plugins, please install the 32-bit version of Python 2.7.x from &lt;a href=&quot;%1&quot;&gt;%1&lt;/a&gt;.&lt;br&gt;This is only required to use some extended functionality in MO, you do not need Python to play the game.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="333"/>
<source>The loaded version of python does not match the expected 3.10.&lt;br&gt;This may cause some or all python plugins to stop working.&lt;br&gt;The expected python libraries should come bundled with MO2,&lt;br&gt;you may want to perform a clean install of the application.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="339"/>
<source>Please set python_dir in Settings-&gt;Plugins-&gt;ProxyPython to the path of your python 2.7 (32 bit) installation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="342"/>
<source>The auto-detection of the python path failed. I don&apos;t know why this would happen but you can try to fix it by setting python_dir in Settings-&gt;Plugins-&gt;ProxyPython to the path of your python 2.7 (32 bit) installation.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="346"/>
<source>Sorry, I don&apos;t know any details. Most likely your python installation is not supported.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="proxy/proxypython.cpp" line="349"/>
<source>The path to Mod Organizer (%1) contains a semicolon. &lt;br&gt;While this is legal on NTFS drives there is a lot of software that doesn&apos;t handle it correctly.&lt;br&gt;Unfortunately MO depends on libraries that seem to fall into that group.&lt;br&gt;As a result the python plugin can&apos;t be loaded.&lt;br&gt;The only solution I can offer is to remove the semicolon / move MO to a path without a semicolon.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="runner/error.h" line="68"/>
<source>An unexpected C++ exception was thrown in python code.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="runner/error.h" line="117"/>
<source>An unknown exception was thrown in python code.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
+4 -5
View File
@@ -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.<br>"
"If you have multiple versions of python installed you may have to configure the path to 2.7 (32 bit) "
"in the settings dialog.<br>"
"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.<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.");
} 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.");
-17
View File
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="en_US">
<context>
<name>QObject</name>
<message>
<location filename="runner/error.h" line="68"/>
<source>An unexpected C++ exception was thrown in python code.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="runner/error.h" line="117"/>
<source>An unknown exception was thrown in python code.</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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;
}