Code and GUI text cleanup (#926)
* Move int range checkers from options class to common file * Improve error handling and reporting * Make some minor improvements to init and test suite * Fix 'trypewriter' to 'typewriter' typo * Remove menu path description in dialog help text * Improve the help text for entries in the Format menu * Reword a couple of dialog messages
This commit is contained in:
committed by
GitHub
parent
e71121f738
commit
e8bb130245
@@ -174,6 +174,26 @@ def hexToInt(value, default=0):
|
||||
return default
|
||||
|
||||
|
||||
def checkIntRange(value, first, last, default):
|
||||
"""Check that an int is in a given range. If it isn't, return the
|
||||
default value.
|
||||
"""
|
||||
if isinstance(value, int):
|
||||
if value >= first and value <= last:
|
||||
return value
|
||||
return default
|
||||
|
||||
|
||||
def checkIntTuple(value, valid, default):
|
||||
"""Check that an int is an element of a tuple. If it isn't, return
|
||||
the default value.
|
||||
"""
|
||||
if isinstance(value, int):
|
||||
if value in valid:
|
||||
return value
|
||||
return default
|
||||
|
||||
|
||||
# =============================================================================================== #
|
||||
# Formatting Functions
|
||||
# =============================================================================================== #
|
||||
|
||||
Reference in New Issue
Block a user