mirror of
https://github.com/aclist/dztui.git
synced 2026-11-08 11:00:48 +01:00
fix: signal emission
This commit is contained in:
1 parent
045f242e09
commit
6fc348ea34
8 files changed
+89
-56
No files matched your search
@@ -27,10 +27,24 @@ class EarlyAlertDialog(Gtk.MessageDialog):
|
||||
|
||||
self.set_default_size(250, 100)
|
||||
|
||||
self.connect("response", self._on_response)
|
||||
abort = self.get_widget_for_response(Gtk.ResponseType.OK)
|
||||
abort.set_label("Exit")
|
||||
|
||||
self.connect("response", self._on_response)
|
||||
self.run()
|
||||
self.destroy()
|
||||
|
||||
def _on_response(self, dialog: Self, response: Gtk.ResponseType) -> None:
|
||||
sys.exit(1)
|
||||
match response:
|
||||
case Gtk.ResponseType.OK:
|
||||
sys.exit(1)
|
||||
case Gtk.ResponseType.CANCEL:
|
||||
return
|
||||
|
||||
class EarlyIgnoreDialog(EarlyAlertDialog):
|
||||
def __init__(self, string: str) -> None:
|
||||
super().__init__(string=string)
|
||||
|
||||
# TODO: reverse order
|
||||
self.add_button("Ignore", Gtk.ResponseType.CANCEL)
|
||||
|
||||
@@ -62,6 +62,7 @@ class GenericDialog(Gtk.MessageDialog):
|
||||
|
||||
def _on_response(self, dialog: Self, response: Gtk.ResponseType) -> None:
|
||||
self.destroy()
|
||||
return response
|
||||
|
||||
|
||||
class ConfirmationDialog(GenericDialog):
|
||||
@@ -74,6 +75,19 @@ class ConfirmationDialog(GenericDialog):
|
||||
secondary=secondary,
|
||||
)
|
||||
|
||||
class IgnoreDialog(GenericDialog):
|
||||
def __init__(self, controller: "Controller", secondary: str):
|
||||
super().__init__(
|
||||
controller=controller,
|
||||
text=strings.confirm,
|
||||
mtype=Gtk.MessageType.QUESTION,
|
||||
buttons=Gtk.ButtonsType.OK_CANCEL,
|
||||
secondary=secondary,
|
||||
)
|
||||
cancel = self.get_widget_for_response(Gtk.ResponseType.CANCEL)
|
||||
cancel.set_label("Ignore")
|
||||
|
||||
|
||||
|
||||
class NotifyDialog(GenericDialog):
|
||||
def __init__(self, controller: "Controller", secondary: str):
|
||||
@@ -81,7 +95,7 @@ class NotifyDialog(GenericDialog):
|
||||
controller=controller,
|
||||
text=strings.notice,
|
||||
mtype=Gtk.MessageType.INFO,
|
||||
buttons=Gtk.ButtonsType.OK,
|
||||
buttons=Gtk.ButtonsType.OK_CANCEL,
|
||||
secondary=secondary,
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user