Skip to content

Commit f81f483

Browse files
authored
Adding exitscript option to SelectFromList
Adding exitscript option to SelectFromList from pyrevit.forms
2 parents cf7ad19 + dbf1e0f commit f81f483

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

pyrevitlib/pyrevit/forms/__init__.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,32 @@ def clear_search(self, sender, args): # pylint: disable=W0613
11811181
self.search_tb.Clear()
11821182
self.search_tb.Focus()
11831183

1184+
@classmethod
1185+
def show(
1186+
cls,
1187+
context,
1188+
title='User Input',
1189+
width=DEFAULT_INPUTWINDOW_WIDTH,
1190+
height=DEFAULT_INPUTWINDOW_HEIGHT,
1191+
exitscript=False
1192+
**kwargs
1193+
):
1194+
"""Show user input window.
1195+
1196+
Args:
1197+
context (any): window context element(s)
1198+
width: ...
1199+
height: ...
1200+
exitscript: exit the script if the user cancels the dialog. Defaults to False
1201+
"""
1202+
dlg = cls(context, title, width, height, **kwargs)
1203+
dlg.ShowDialog()
1204+
1205+
if exitscript and not dlg.response:
1206+
sys.exit()
1207+
1208+
return dlg.response
1209+
11841210

11851211
class CommandSwitchWindow(TemplateUserInputWindow):
11861212
"""Standard form to select from a list of command options.

0 commit comments

Comments
 (0)