Fix and optimise code (#904)

* Fix bug in early error reporting in main init
* Update docstrings and optimise code in GuiMain
* Update docstrings and optimise code in Config
* Update docstrings and optimise code in common module
* Update docstrings and optimise code in main project classes
* Update the OptionState class
* Update the spell checker class
* Update the file converter classes and extend tests
* Update the about, merge, split and item editor classes and extend tests
* Update item editor test
* Update about dialog tests
* Some minor test cleanup
* Fix typo and add clarification in contributing guide
This commit is contained in:
Veronica Berglyd Olsen
2021-10-14 20:35:42 +01:00
committed by GitHub
parent 2a06db0a2b
commit 1c45331b0a
31 changed files with 1042 additions and 666 deletions
+6 -15
View File
@@ -103,11 +103,8 @@ class NWItem():
logger.error("XML item entry does not have a handle")
return False
if "parent" in xItem.attrib:
self.setParent(xItem.attrib["parent"])
if "order" in xItem.attrib:
self.setOrder(xItem.attrib["order"])
self.setParent(xItem.attrib.get("parent", None))
self.setOrder(xItem.attrib.get("order", 0))
tmpStatus = ""
for xValue in xItem:
@@ -200,11 +197,8 @@ class NWItem():
def setHandle(self, theHandle):
"""Set the item handle, and ensure it is valid.
"""
if isinstance(theHandle, str):
if isHandle(theHandle):
self.itemHandle = theHandle
else:
self.itemHandle = None
if isHandle(theHandle):
self.itemHandle = theHandle
else:
self.itemHandle = None
return
@@ -214,11 +208,8 @@ class NWItem():
"""
if theParent is None:
self.itemParent = None
elif isinstance(theParent, str):
if isHandle(theParent):
self.itemParent = theParent
else:
self.itemParent = None
elif isHandle(theParent):
self.itemParent = theParent
else:
self.itemParent = None
return