Skip to content

Commit dbf1e0f

Browse files
committed
Update __init__.py - exitscritp handeled in show method
following SanzoGhensi suggestions
1 parent a51515e commit dbf1e0f

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

pyrevitlib/pyrevit/forms/__init__.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -804,8 +804,6 @@ class SelectFromList(TemplateUserInputWindow):
804804
object attribute that should be read as item name.
805805
multiselect (bool, optional):
806806
allow multi-selection (uses check boxes). defaults to False
807-
exitscript (bool, optional):
808-
exit if close or nothing is returned. defaults to False
809807
info_panel (bool, optional):
810808
show information panel and fill with .description property of item
811809
return_all (bool, optional):
@@ -904,9 +902,6 @@ def _setup(self, **kwargs):
904902
self.list_lb.SelectionMode = Controls.SelectionMode.Single
905903
self.hide_element(self.checkboxbuttons_g)
906904

907-
# exitscript
908-
self.exitscript = kwargs.get('exitscript', False)
909-
910905
# info panel?
911906
self.info_panel = kwargs.get("info_panel", False)
912907

@@ -1187,20 +1182,28 @@ def clear_search(self, sender, args): # pylint: disable=W0613
11871182
self.search_tb.Focus()
11881183

11891184
@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()
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()
12041207

12051208
return dlg.response
12061209

0 commit comments

Comments
 (0)