diff --git a/slpkg/dialog_box.py b/slpkg/dialog_box.py index 8fb16c22..086bab77 100644 --- a/slpkg/dialog_box.py +++ b/slpkg/dialog_box.py @@ -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()