mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 22:52:42 +01:00
fix: process escape key
This commit is contained in:
1 parent
687b1a915e
commit
0137bf4610
1 file changed
+6
-3
@@ -1,9 +1,8 @@
|
|||||||
import sys
|
import sys
|
||||||
from typing import Literal, TYPE_CHECKING
|
from typing import Any, Literal, Self, TYPE_CHECKING
|
||||||
|
|
||||||
# import time
|
# import time
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Any, Self
|
|
||||||
|
|
||||||
# TODO: import dialog titles
|
# TODO: import dialog titles
|
||||||
from dzgui.api.mods import remove_stale_signatures as remove_stale
|
from dzgui.api.mods import remove_stale_signatures as remove_stale
|
||||||
@@ -60,7 +59,7 @@ class BootDialog(Gtk.Dialog):
|
|||||||
self.view.set_model(self.store)
|
self.view.set_model(self.store)
|
||||||
|
|
||||||
# TODO: capture sigint in early dialogs
|
# TODO: capture sigint in early dialogs
|
||||||
self.connect("key-press-event", lambda _, __: self.exit_button.emit("clicked"))
|
self.connect("key-press-event", self._on_keypress)
|
||||||
|
|
||||||
for i, column_title in enumerate(["Task", "State"]):
|
for i, column_title in enumerate(["Task", "State"]):
|
||||||
renderer = Gtk.CellRendererText()
|
renderer = Gtk.CellRendererText()
|
||||||
@@ -141,6 +140,10 @@ class BootDialog(Gtk.Dialog):
|
|||||||
|
|
||||||
GLib.timeout_add(100, self.pulse_spinner)
|
GLib.timeout_add(100, self.pulse_spinner)
|
||||||
|
|
||||||
|
def _on_keypress(self, Self, event: Gdk.EventKey) -> None:
|
||||||
|
if event.keyval == Gdk.KEY_Escape:
|
||||||
|
self.exit_button.emit("clicked")
|
||||||
|
|
||||||
def pulse_spinner(self) -> Literal[True]:
|
def pulse_spinner(self) -> Literal[True]:
|
||||||
for row in self.store:
|
for row in self.store:
|
||||||
if row[2]:
|
if row[2]:
|
||||||
|
|||||||
Reference in new issue
Block a user