Improve the way the project tree is managed and elements deleted.

This commit is contained in:
Veronica K. B. Olsen
2020-09-17 14:03:51 +02:00
parent 9bca006a45
commit 27ee82aad0
4 changed files with 47 additions and 27 deletions
+12
View File
@@ -82,6 +82,18 @@ def checkBool(checkValue, defaultValue, allowNone=False):
return defaultValue
return defaultValue
def checkHandle(checkValue, defaultValue, allowNone=False):
"""Check if a value is a handle.
"""
if allowNone:
if checkValue is None:
return None
if checkValue == "None":
return None
if isHandle(checkValue):
return str(checkValue)
return defaultValue
def isHandle(theString):
"""Check if a string is a valid novelWriter handle.
Note: This is case sensitive. Must be lower case!