addTextPropertyExt
addTextPropertyExt(t, id, location, name, desc, defaultVal,
validator)
Same as addTextProperty
but with a validator function
validator
. The validator function is supposed to return
True
for accepted inputs, and False
for invalid
inputs. Invalid inputs will be flagged as red in the UI but are still accepted (dialog
box can be closed). The reason for flagging an input as invalid must be set in the
global variable validationError
, and will be shown in the help area for
the property pane.
Example
def ek_validator(s):
global validationError
if s != "0xC0FFEE,0xBABE,0xADDED,0xCACA0":
validationError ="That's no fun !"
return False
return True
def onload(ide):
ide.addTextPropertyExt(t,"x.eraseKey" , "*|programoptions|programoptions.eraseb4program","Erase key with validation","Enter 4x32 bit numbers separated by comma", "0xC0FFEE,0xBABE,0xADDED,0xCACA0", "ek_validator")