aboutsummaryrefslogtreecommitdiff
path: root/src/utils.py
diff options
context:
space:
mode:
authorJoris Guyonvarch2025-12-30 10:06:31 +0100
committerJoris Guyonvarch2025-12-30 10:06:31 +0100
commit6754cb500cc4dd8991b5887a6ffcc2cd9fcf0cf1 (patch)
tree47483dc6684f74125238b1c5e9050691cf378a20 /src/utils.py
parentb91bcbf3c52fd25688835c43e23264eae647e397 (diff)
Turn off ESC on book form and transfer modals
Diffstat (limited to 'src/utils.py')
-rw-r--r--src/utils.py5
1 files changed, 3 insertions, 2 deletions
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):