aboutsummaryrefslogtreecommitdiff
path: root/src
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
parentb91bcbf3c52fd25688835c43e23264eae647e397 (diff)
Turn off ESC on book form and transfer modals
Diffstat (limited to 'src')
-rw-r--r--src/book_form.py2
-rw-r--r--src/book_transfer.py2
-rw-r--r--src/utils.py5
3 files changed, 5 insertions, 4 deletions
diff --git a/src/book_form.py b/src/book_form.py
index baabe58..ed1c938 100644
--- a/src/book_form.py
+++ b/src/book_form.py
@@ -22,7 +22,7 @@ class BookForm(Gtk.Window):
self._msg = msg
title = 'Modifier un livre' if book else 'Ajouter un livre'
- utils.configure_dialog(self, parent_window, title, height=800)
+ utils.configure_dialog(self, parent_window, title, height=800, allow_escape=False)
scrolled_window = Gtk.ScrolledWindow()
self.set_child(scrolled_window)
diff --git a/src/book_transfer.py b/src/book_transfer.py
index 341c247..3bda52f 100644
--- a/src/book_transfer.py
+++ b/src/book_transfer.py
@@ -20,7 +20,7 @@ class BookTransfer(Gtk.Window):
self._data = data
self._paths = paths
- utils.configure_dialog(self, parent_window, data['title'], width=None, height=None)
+ utils.configure_dialog(self, parent_window, data['title'], width=None, height=None, allow_escape=False)
self._box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20)
self.set_child(self._box)
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):