@@ -804,6 +804,8 @@ class SelectFromList(TemplateUserInputWindow):
804
804
object attribute that should be read as item name.
805
805
multiselect (bool, optional):
806
806
allow multi-selection (uses check boxes). defaults to False
807
+ exitscript (bool, optional):
808
+ exit if close or nothing is returned. defaults to False
807
809
info_panel (bool, optional):
808
810
show information panel and fill with .description property of item
809
811
return_all (bool, optional):
@@ -902,6 +904,9 @@ def _setup(self, **kwargs):
902
904
self .list_lb .SelectionMode = Controls .SelectionMode .Single
903
905
self .hide_element (self .checkboxbuttons_g )
904
906
907
+ # exitscript
908
+ self .exitscript = kwargs .get ('exitscript' , False )
909
+
905
910
# info panel?
906
911
self .info_panel = kwargs .get ("info_panel" , False )
907
912
@@ -1181,6 +1186,24 @@ def clear_search(self, sender, args): # pylint: disable=W0613
1181
1186
self .search_tb .Clear ()
1182
1187
self .search_tb .Focus ()
1183
1188
1189
+ @classmethod
1190
+ def show (cls , context , #pylint: disable=W0221
1191
+ title = 'User Input' ,
1192
+ width = DEFAULT_INPUTWINDOW_WIDTH ,
1193
+ height = DEFAULT_INPUTWINDOW_HEIGHT , ** kwargs ):
1194
+ """Show user input window.
1195
+
1196
+ Args:
1197
+ context (any): window context element(s)
1198
+ """
1199
+ dlg = cls (context , title , width , height , ** kwargs )
1200
+ dlg .ShowDialog ()
1201
+
1202
+ if dlg .exitscript and not dlg .response :
1203
+ sys .exit ()
1204
+
1205
+ return dlg .response
1206
+
1184
1207
1185
1208
class CommandSwitchWindow (TemplateUserInputWindow ):
1186
1209
"""Standard form to select from a list of command options.
0 commit comments