A couple of approaches: first, if you want the user to enter a value thats
always transformed in some way before you use it (but you want the user to enter pre transformation) then just add a key to the valuesDict that you populate with the calculated value in the validation call.
- Code: Select all
valuesDict["calculatedValue"] = valuesDict["rawValue"] - 2 # or whatever
That way the user sees what they're expecting but you always get the value you want in the calculated field (self.pluginProps["calculatedValue"]).
If you
really must modify it before the dialog opens, you can implement the following method which is called to get the values before the ConfigUI is drawn to get the values::
- Code: Select all
def getPrefsConfigUiValues(self):
valuesDict, errorMsgDict = super(Plugin, self).getPrefsConfigUiValues()
# modify valuesDict["yourkey"] as necessary
return (valuesDict, errorMsgDict)
You call the base class's implementation to get the values (it also returns an error message dictionary), then modify the value as necessary before returning both dicts as a tuple.