~sircmpwn/hiprompt-gtk-py

c6cf168920db43fb5542358fcfff68aceb29db36 — Martijn Braam 2 years ago f8659e5
Implement accepting with enter and denying with escape
1 files changed, 5 insertions(+), 0 deletions(-)

M hiprompt_gtk/window.py
M hiprompt_gtk/window.py => hiprompt_gtk/window.py +5 -0
@@ 26,6 26,10 @@ class Window:
        self.entry = None
        self.buttons = []

        self.accel = Gtk.AccelGroup()
        self.accel.connect(Gdk.keyval_from_name('Escape'), 0, 0, self.on_deny)
        self.window.add_accel_group(self.accel)

        self.make_ui()
        GLib.timeout_add(700, self.enable_actions)



@@ 48,6 52,7 @@ class Window:
    def enable_actions(self, *args):
        for button in self.buttons:
            button.set_sensitive(True)
            button.grab_focus()

    def on_close(self, *args):
        Gtk.main_quit()