Python APIs for Dialogs
For displaying simple textual information, warning or error dialogs you can use the DialogDisplayer utility class.
displayer = DialogDisplayer()
displayer.showMessageDialog("Please specify a positive number for the scale", "Editor Warning", "Warning")
For displaying dialogs that require a user interaction such as OK, YES or NO, use showConfirmDialog:
displayer = DialogDisplayer()
resp = displayer.showConfirmDialog("Do you want to continue ?", "Editor Warning", "OkCancel")
if resp == 'Ok':
....
If you require the user to input an integer, use the IntegerPrompt class.
# Constructor arguments are the prompt and a default value in case the user does not enter a value
integerPrompt = IntegerPrompt("Enter the number of traces to extract:", 0)
response = integerPrompt.showDialog()
if response != 0:
...
See full API at http://intviewer.int.com/intviewer/docs/pythonapi/latest/IntegerPrompt.html
If you require the user to input an double, use the DoublePrompt class.
# Constructor arguments are the prompt and a default value in case the user does not enter a value
doublePrompt = DoublePrompt ("Enter the multiplication factor:", 1.0)
response = doublePrompt .showDialog()
if response != 1.0:
...
See full API at http://intviewer.int.com/intviewer/docs/pythonapi/latest/DoublePrompt.html
If you require the user to input an string, use the StringPrompt class.
# Constructor argument is the prompt
stringPrompt = StringPrompt("Enter the name for this project:")
response = stringPrompt.showDialog()
if response != "":
...
See full API at http://intviewer.int.com/intviewer/docs/pythonapi/latest/StringPrompt.html