Welcome Screen: Improve filesystem repair dialogs
[tails.git] / config / chroot_local-includes / usr / lib / python3 / dist-packages / tailsgreeter / ui / message_dialog.py
blob3feb0f8b907aeda4fa0ad9b6cd942b953dff05b8
1 from gettext import gettext
2 import gi
4 from tailsgreeter.translatable_window import TranslatableWindow
6 gi.require_version("Gtk", "3.0")
7 from gi.repository import Gtk # noqa: E402
9 _ = gettext
12 class MessageDialog(Gtk.MessageDialog, TranslatableWindow):
13 def __init__(
14 self,
15 message_type: Gtk.MessageType,
16 title: str,
17 text: str,
18 cancel_label: str | None = None,
19 ok_label: str | None = None,
20 third_button_label: str | None = None,
21 destructive: bool = False,
23 Gtk.MessageDialog.__init__(self, message_type=message_type, text=title)
24 TranslatableWindow.__init__(self, self)
25 self.format_secondary_text(text)
26 if cancel_label:
27 self.cancel_button = self.add_button(cancel_label, Gtk.ResponseType.CANCEL)
28 if third_button_label:
29 self.third_button = self.add_button(
30 third_button_label, Gtk.ResponseType.REJECT
32 if ok_label:
33 self.ok_button = self.add_button(ok_label, Gtk.ResponseType.OK)
34 if destructive:
35 self.ok_button.get_style_context().add_class("destructive-action")
36 self.store_translations(self)