Skip to content

Commit

Permalink
Revert "Switch to provided _parentWidget()" to restore compatibility …
Browse files Browse the repository at this point in the history
…with older MO2 versions

This reverts commit 6a98fce.
  • Loading branch information
AnyOldName3 committed Mar 11, 2021
1 parent fc1aa0d commit f2d57c8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 17 deletions.
15 changes: 9 additions & 6 deletions OpenMWExport.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def init(self, organizer):
self.__organizer = organizer
if sys.version_info < (3, 6):
qCritical(self.__tr("OpenMWExport plugin requires a Python {0} interpreter or newer, but is running on a Python {1} interpreter.").format("3.6", ".".join(map(str, sys.version_info[:3]))))
QMessageBox.critical(self._parentWidget(), self.__tr("Incompatible Python version."), self.__tr("This version of the OpenMW Export plugin requires a Python {0} interpreter or newer, but Mod Organizer has provided a Python {1} interpreter. Mod Organizer {2} is the earliest compatible version. You should check for an update.").format("3.6", ".".join(map(str, sys.version_info[:3])), "2.1.6"))
QMessageBox.critical(self.__parentWidget, self.__tr("Incompatible Python version."), self.__tr("This version of the OpenMW Export plugin requires a Python {0} interpreter or newer, but Mod Organizer has provided a Python {1} interpreter. Mod Organizer {2} is the earliest compatible version. You should check for an update.").format("3.6", ".".join(map(str, sys.version_info[:3])), "2.1.6"))
return False
if self.__organizer.appVersion() >= mobase.VersionInfo(2, 3, 1):
self.__nexusBridge = self.__organizer.createNexusBridge()
Expand Down Expand Up @@ -67,6 +67,9 @@ def tooltip(self):
def icon(self):
return QIcon("plugins/openmw.ico")

def setParentWidget(self, widget):
self.__parentWidget = widget

def display(self):
if self.__organizer.appVersion() >= mobase.VersionInfo(2, 4, 0):
allModsByProfilePriority = self.__organizer.modList().allModsByProfilePriority
Expand All @@ -77,16 +80,16 @@ def display(self):
# We can't do that directly, so instead we just test if the current game is Morrowind
game = self.__organizer.managedGame()
if game.gameName() != "Morrowind":
QMessageBox.critical(self._parentWidget(), self.__tr("Incompatible game"), self.__tr("(At least when this plugin is being written) OpenMW only supports game data designed for the Morrowind engine. The game being managed is not Morrowind, so the export will abort. If you think you know better than this message, update this plugin."))
QMessageBox.critical(self.__parentWidget, self.__tr("Incompatible game"), self.__tr("(At least when this plugin is being written) OpenMW only supports game data designed for the Morrowind engine. The game being managed is not Morrowind, so the export will abort. If you think you know better than this message, update this plugin."))
return
# Give the user the opportunity to abort
confirmationButton = QMessageBox.question(self._parentWidget(), self.__tr("Before starting export..."), self.__tr("Before starting the export to OpenMW, please ensure you've backed up anything in OpenMW.cfg which you do not want to risk losing forever."), QMessageBox.StandardButtons(QMessageBox.Ok | QMessageBox.Cancel))
confirmationButton = QMessageBox.question(self.__parentWidget, self.__tr("Before starting export..."), self.__tr("Before starting the export to OpenMW, please ensure you've backed up anything in OpenMW.cfg which you do not want to risk losing forever."), QMessageBox.StandardButtons(QMessageBox.Ok | QMessageBox.Cancel))
if confirmationButton != QMessageBox.Ok:
return
# Get the path to the OpenMW.cfg file
configPath = self.__getOpenMWConfigPath()
if not configPath.is_file():
QMessageBox.critical(self._parentWidget(), self.__tr("Config file not specified"), self.__tr("No config file was specified"))
QMessageBox.critical(self.__parentWidget, self.__tr("Config file not specified"), self.__tr("No config file was specified"))
return
# Clear out the existing data= and content= lines from openmw.cfg
self.__clearOpenMWConfig(configPath)
Expand All @@ -107,7 +110,7 @@ def display(self):
# actually write out the list
for pluginIndex in range(len(loadOrder)):
openmwcfg.write("content=" + loadOrder[pluginIndex] + "\n")
QMessageBox.information(self._parentWidget(), self.__tr("OpenMW Export Complete"), self.__tr("The export to OpenMW completed successfully. The current setup was saved to {0}").format(configPath))
QMessageBox.information(self.__parentWidget, self.__tr("OpenMW Export Complete"), self.__tr("The export to OpenMW completed successfully. The current setup was saved to {0}").format(configPath))

def __tr(self, str):
return QCoreApplication.translate("OpenMWExportPlugin", str)
Expand Down Expand Up @@ -160,7 +163,7 @@ def __getOpenMWConfigPath(self):
if defaultLocation.is_file():
return defaultLocation
# If we've got this far, then the user is doing something very weird, so they can find it themselves.
return Path(QFileDialog.getOpenFileName(self._parentWidget(), self.__tr("Locate OpenMW Config File"), ".", "OpenMW Config File (openmw.cfg)")[0])
return Path(QFileDialog.getOpenFileName(self.__parentWidget, self.__tr("Locate OpenMW Config File"), ".", "OpenMW Config File (openmw.cfg)")[0])

def __checkForUpdate(self, mainWindow):
self.__nexusBridge.requestDescription("Morrowind", 45642, None)
Expand Down
22 changes: 11 additions & 11 deletions OpenMWExport_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,47 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="80"/>
<location filename="OpenMWExport.py" line="83"/>
<source>Incompatible game</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="80"/>
<location filename="OpenMWExport.py" line="83"/>
<source>(At least when this plugin is being written) OpenMW only supports game data designed for the Morrowind engine. The game being managed is not Morrowind, so the export will abort. If you think you know better than this message, update this plugin.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="83"/>
<location filename="OpenMWExport.py" line="86"/>
<source>Before starting export...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="83"/>
<location filename="OpenMWExport.py" line="86"/>
<source>Before starting the export to OpenMW, please ensure you&apos;ve backed up anything in OpenMW.cfg which you do not want to risk losing forever.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="89"/>
<location filename="OpenMWExport.py" line="92"/>
<source>Config file not specified</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="89"/>
<location filename="OpenMWExport.py" line="92"/>
<source>No config file was specified</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="110"/>
<location filename="OpenMWExport.py" line="113"/>
<source>OpenMW Export Complete</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="110"/>
<location filename="OpenMWExport.py" line="113"/>
<source>The export to OpenMW completed successfully. The current setup was saved to {0}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="163"/>
<location filename="OpenMWExport.py" line="166"/>
<source>Locate OpenMW Config File</source>
<translation type="unfinished"></translation>
</message>
Expand All @@ -78,12 +78,12 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="171"/>
<location filename="OpenMWExport.py" line="174"/>
<source>Plugin update available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="OpenMWExport.py" line="171"/>
<location filename="OpenMWExport.py" line="174"/>
<source>{0} can be updated from version {1} to {2}. Do you want to open the download page in your browser?</source>
<translation type="unfinished"></translation>
</message>
Expand Down

0 comments on commit f2d57c8

Please sign in to comment.