Merge pull request #2 from isanae/remove-qdebug2

Remove qdebug2
This commit is contained in:
isanae
2019-12-08 05:45:49 -05:00
committed by GitHub
2 changed files with 40 additions and 26 deletions
+19 -26
View File
@@ -1,24 +1,19 @@
from pathlib import Path
import sys
from PyQt5.QtCore import QCoreApplication, qDebug
from PyQt5.QtCore import QCoreApplication
if "mobase" not in sys.modules:
import mock_mobase as mobase
class Form43Checker(mobase.IPluginDiagnose):
def __init__(self):
super(Form43Checker, self).__init__()
self.__organizer = None
def init(self, organizer):
self.__organizer = organizer
# Already gets queried whenever a new plugin is added, so that's nice.
#organizer.pluginList().onRefreshed(lambda : self._invalidate())
#organizer.pluginList().onRefreshed(lambda : qDebug("onRefreshed callback triggered"))
return True
def name(self):
@@ -38,33 +33,32 @@ class Form43Checker(mobase.IPluginDiagnose):
def settings(self):
return []
def activeProblems(self):
qDebug("Active problems called.")
if self.__scanPlugins():
return [0]
else:
return []
def shortDescription(self, key):
return self.__tr("Form 43 plugin detected")
def fullDescription(self, key):
pluginList = self.__listPlugins()
pluginList = [Path(absolutePath).name for absolutePath in pluginList]
pluginListString = "\n" + ("\n".join(pluginList))
return self.__tr("You have one or more Form 43 plugins. They are:{0}").format(pluginListString)
def hasGuidedFix(self, key):
return False
def startGuidedFix(self, key):
# Maybe we could use xEdit or something to resave the file?
pass
def __tr(self, str):
return QCoreApplication.translate("Form43Checker", str)
def __testFile(self, path):
path = Path(path)
if path.is_file():
@@ -73,36 +67,35 @@ class Form43Checker(mobase.IPluginDiagnose):
version = file.read(2)
return version == b"\x2b\x00"
else:
qDebug("I've been told to scan a plugin that doesn't exist.")
return None
def __scanPlugins(self):
if self.__organizer.managedGame().gameName() != "Skyrim Special Edition":
return False
def isPluginFile(name):
extension = Path(name).suffix
extension = extension.lower()
return extension == ".esp" or extension == ".esm"
fileList = self.__organizer.findFiles("", isPluginFile)
for file in fileList:
if self.__testFile(file):
return True
return False
def __listPlugins(self):
def isPluginFile(name):
extension = Path(name).suffix
extension = extension.lower()
return extension == ".esp" or extension == ".esm"
fileList = self.__organizer.findFiles("", isPluginFile)
return [file for file in fileList if self.__testFile(file)]
def createPlugin():
return Form43Checker()
+21
View File
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="2.0">
<context>
<name>Form43Checker</name>
<message>
<location filename="Form43Checker.py" line="26"/>
<source>Checks plugins (.ESM/.ESP files) to see if any are Form 43 (Skyrim LE).</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Form43Checker.py" line="44"/>
<source>Form 43 plugin detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="Form43Checker.py" line="50"/>
<source>You have one or more Form 43 plugins. They are:{0}</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>