From e158245ff7b76e87743ff839a3c4408eecc02e8b Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Thu, 12 Nov 2020 21:36:40 +0100 Subject: [PATCH] automatically switches to the keycode input --- data/key-mapper.glade | 124 +++++++++++++++++++++++++++++++++++++++- keymapper/gtk/row.py | 4 ++ keymapper/gtk/window.py | 6 ++ 3 files changed, 132 insertions(+), 2 deletions(-) diff --git a/data/key-mapper.glade b/data/key-mapper.glade index 0abe0113..2375531f 100644 --- a/data/key-mapper.glade +++ b/data/key-mapper.glade @@ -123,6 +123,127 @@ + + True + False + gtk-delete + + + True + False + gtk-redo + + + False + Key Mapper + True + center + mouse + dialog + True + + + True + False + vertical + + + True + False + center + end + + + Continue + False + True + True + True + False + gtk-delete-icon + + + False + False + 0 + + + + + Go Back + True + True + True + gtk-redo-icon + + + True + True + 1 + + + + + False + True + end + 0 + + + + + True + False + + + True + False + 0 + 12 + 12 + mouse + 6 + + + False + False + 0 + + + + + True + False + 10 + 10 + 6 + You have got unsaved changes! + True + 0 + 0.5 + + + True + True + 1 + + + + + True + True + 2 + + + + + + go_back + + + + + 450 False @@ -418,8 +539,7 @@ True False - Click on a cell below and hit a key on your device. Use the tab -key if mouseclicks overwrite your input. + Click on a cell below and hit a key on your device. 5 5 Key diff --git a/keymapper/gtk/row.py b/keymapper/gtk/row.py index 81d7a5c2..e97c2672 100644 --- a/keymapper/gtk/row.py +++ b/keymapper/gtk/row.py @@ -96,6 +96,10 @@ class Row: # it's legal to display the keycode self.window.get('status_bar').remove_all(CTX_KEYCODE) self.keycode.set_label(str(new_keycode)) + # switch to the character, don't require mouse input because + # that would overwrite the key with the mouse-button key if + # the current device is a mouse + self.window.window.set_focus(self.character_input) # the character is empty and therefore the mapping is not complete if character is None: diff --git a/keymapper/gtk/window.py b/keymapper/gtk/window.py index c7f46cbf..5b515990 100755 --- a/keymapper/gtk/window.py +++ b/keymapper/gtk/window.py @@ -189,6 +189,8 @@ class Window: def on_select_device(self, dropdown): """List all presets, create one if none exist yet.""" + # TODO unsaved changes dialog + device = dropdown.get_active_text() logger.debug('Selecting device "%s"', device) @@ -203,6 +205,8 @@ class Window: def on_create_preset_clicked(self, button): """Create a new preset and select it.""" + # TODO unsaved changes dialog + new_preset = create_preset(self.selected_device) self.get('preset_selection').append(new_preset, new_preset) self.get('preset_selection').set_active_id(new_preset) @@ -210,6 +214,8 @@ class Window: def on_select_preset(self, dropdown): """Show the mappings of the preset.""" + # TODO unsaved changes dialog + self.clear_mapping_table() preset = dropdown.get_active_text()