From 6754cb500cc4dd8991b5887a6ffcc2cd9fcf0cf1 Mon Sep 17 00:00:00 2001 From: Joris Guyonvarch Date: Tue, 30 Dec 2025 10:06:31 +0100 Subject: Turn off ESC on book form and transfer modals --- src/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/utils.py') diff --git a/src/utils.py b/src/utils.py index 5ef3f37..2e6e90f 100644 --- a/src/utils.py +++ b/src/utils.py @@ -24,7 +24,7 @@ def set_margin(widget, a, b = None, c = None, d = None): widget.set_margin_bottom(c) widget.set_margin_start(d) -def configure_dialog(window, parent_window, title, width=600, height=400): +def configure_dialog(window, parent_window, title, width=600, height=400, allow_escape=True): window.use_header_bar = True window.set_modal(True) window.set_transient_for(parent_window) @@ -32,7 +32,8 @@ def configure_dialog(window, parent_window, title, width=600, height=400): set_header_bar(window, title) control_key = Gtk.EventControllerKey.new() - control_key.connect('key-pressed', on_dialog_key_pressed, window) + if allow_escape: + control_key.connect('key-pressed', on_dialog_key_pressed, window) window.add_controller(control_key) def on_dialog_key_pressed(a, b, key, c, window): -- cgit v1.2.3