except InstallAbortedError:
return 1
+ # The user requested to cancel the installation process
+ except UserCanceledError:
+ if self.tui.confirm(
+ _("Cancel Installation?"),
+ _("Are you sure that you want to cancel the installation process?"),
+ ):
+ return 0
+
# Catch any failed commands
except subprocess.CalledProcessError as e:
args = {
import logging
import snack
+from .errors import *
from .i18n import _
# Setup logging
self.screen.pushHelpLine(helpline)
- def message(self, title, text, buttons=None, help=None, width=40):
+ def message(self, title, text, buttons=None, height=None, width=40, help=None):
"""
Shows a message to the user
"""
buttons = (_("OK"), _("Cancel"))
window = ButtonsWindow(self, title=title, text=text,
- buttons=buttons, width=width, help=help)
+ buttons=buttons, height=height, width=width, help=help)
return window.run()
return self.message(title, text, buttons=buttons, width=width)
+ def confirm(self, title, text, height=None, width=40, help=None):
+ """
+ Asks the user a yes/no question
+ """
+ buttons = (
+ (_("No"), False),
+ (_("Yes"), True),
+ )
+
+ return self.message(title, text, buttons=buttons,
+ height=height, width=width, help=help)
+
def progress(self, title, text, max_value=None, height=None, width=60, help=None):
return ProgressWindow(self, title, text, max_value=max_value,
height=height, width=width, help=help)