Updated for KeyboardInterrupt

This commit is contained in:
Dimitris Zlatanidis 2023-04-27 17:02:36 +03:00
parent 10865d029a
commit 2f2c7e3dbf

View file

@ -29,8 +29,12 @@ class DialogBox(Configs):
if self.dialog:
more_kwargs.update({"item_help": True})
code, tags = self.d.checklist(text=text, choices=choices, title=title, height=height, width=width,
list_height=list_height, help_status=True, **more_kwargs)
try:
code, tags = self.d.checklist(text=text, choices=choices, title=title, height=height, width=width,
list_height=list_height, help_status=True, **more_kwargs)
except KeyboardInterrupt:
raise SystemExit()
else:
code: bool = False
tags: list = packages
@ -44,10 +48,12 @@ class DialogBox(Configs):
if self.dialog:
more_kwargs.update({"item_help": True,
"help_tags": True})
code, tags = self.d.mixedform(text=text, title=title, elements=elements, # type: ignore
height=height, width=width, help_button=True,
help_status=True, **more_kwargs)
try:
code, tags = self.d.mixedform(text=text, title=title, elements=elements, # type: ignore
height=height, width=width, help_button=True,
help_status=True, **more_kwargs)
except KeyboardInterrupt:
raise SystemExit()
else:
code: bool = False
tags: list = elements
@ -57,9 +63,15 @@ class DialogBox(Configs):
def msgbox(self, text: str, height: int, width: int) -> None:
""" Display a message box. """
if self.dialog:
self.d.msgbox(text, height, width)
try:
self.d.msgbox(text, height, width)
except KeyboardInterrupt:
raise SystemExit()
def textbox(self, text: Union[str, Path], height: int, width: int) -> None:
""" Display a text box. """
if self.dialog:
self.d.textbox(text, height, width)
try:
self.d.textbox(text, height, width)
except KeyboardInterrupt:
raise SystemExit()