From 7e5d603eb9aac5b3be80a6e5e530ef8f5acaf0c5 Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Sat, 26 Feb 2022 02:30:14 -0600 Subject: [PATCH] Slightly better key mapping --- .../context/signals/keyboard_signals_mixin.py | 101 +++++++++--------- 1 file changed, 51 insertions(+), 50 deletions(-) diff --git a/src/versions/solarfm-0.0.1/SolarFM/solarfm/context/signals/keyboard_signals_mixin.py b/src/versions/solarfm-0.0.1/SolarFM/solarfm/context/signals/keyboard_signals_mixin.py index 8d30d77..16ed902 100644 --- a/src/versions/solarfm-0.0.1/SolarFM/solarfm/context/signals/keyboard_signals_mixin.py +++ b/src/versions/solarfm-0.0.1/SolarFM/solarfm/context/signals/keyboard_signals_mixin.py @@ -51,6 +51,57 @@ class KeyboardSignalsMixin: self.unset_keys_and_data() self.trash_files() + if self.ctrl_down: + if keyname in ["1", "kp_1", "2", "kp_2", "3", "kp_3", "4", "kp_4"]: + self.builder.get_object(f"tggl_notebook_{keyname.strip('kp_')}").released() + if keyname == "q": + self.tear_down() + if keyname == "slash" or keyname == "home": + self.builder.get_object("go_home").released() + if keyname == "r" or keyname == "f5": + self.builder.get_object("refresh_tab").released() + if keyname == "up" or keyname == "u": + self.builder.get_object("go_up").released() + if keyname == "l": + self.unset_keys_and_data() + self.builder.get_object("path_entry").grab_focus() + if keyname == "t": + self.builder.get_object("create_tab").released() + if keyname == "o": + self.unset_keys_and_data() + self.open_files() + if keyname == "w": + self.keyboard_close_tab() + if keyname == "h": + self.show_hide_hidden_files() + if keyname == "e": + self.unset_keys_and_data() + self.rename_files() + if keyname == "c": + self.copy_files() + self.to_cut_files.clear() + if keyname == "x": + self.to_copy_files.clear() + self.cut_files() + if keyname == "v": + self.paste_files() + if keyname == "n": + self.unset_keys_and_data() + self.show_new_file_menu() + + if keyname == "delete": + self.unset_keys_and_data() + self.delete_files() + if keyname == "f2": + self.unset_keys_and_data() + self.rename_files() + if keyname == "f4": + self.unset_keys_and_data() + self.open_terminal() + if keyname in ["alt_l", "alt_r"]: + top_main_menubar = self.builder.get_object("top_main_menubar") + top_main_menubar.hide() if top_main_menubar.is_visible() else top_main_menubar.show() + if re.fullmatch(valid_keyvalue_pat, keyname): if not self.is_searching and not self.ctrl_down \ and not self.shift_down and not self.alt_down: @@ -61,53 +112,3 @@ class KeyboardSignalsMixin: self.unset_keys_and_data() self.popup_search_files(wid, keyname) return - - if (self.ctrl_down and keyname in ["1", "kp_1", "2", "kp_2", "3", "kp_3", "4", "kp_4"]): - self.builder.get_object(f"tggl_notebook_{keyname.strip('kp_')}").released() - if keyname in ["alt_l", "alt_r"]: - top_main_menubar = self.builder.get_object("top_main_menubar") - top_main_menubar.hide() if top_main_menubar.is_visible() else top_main_menubar.show() - - if self.ctrl_down and keyname == "q": - self.tear_down() - if (self.ctrl_down and keyname == "slash") or keyname == "home": - self.builder.get_object("go_home").released() - if (self.ctrl_down and keyname == "r") or keyname == "f5": - self.builder.get_object("refresh_tab").released() - if (self.ctrl_down and keyname == "up") or (self.ctrl_down and keyname == "u"): - self.builder.get_object("go_up").released() - if self.ctrl_down and keyname == "l": - self.unset_keys_and_data() - self.builder.get_object("path_entry").grab_focus() - if self.ctrl_down and keyname == "t": - self.builder.get_object("create_tab").released() - if self.ctrl_down and keyname == "o": - self.unset_keys_and_data() - self.open_files() - if self.ctrl_down and keyname == "w": - self.keyboard_close_tab() - if self.ctrl_down and keyname == "h": - self.show_hide_hidden_files() - if (self.ctrl_down and keyname == "e"): - self.unset_keys_and_data() - self.rename_files() - if self.ctrl_down and keyname == "c": - self.copy_files() - self.to_cut_files.clear() - if self.ctrl_down and keyname == "x": - self.to_copy_files.clear() - self.cut_files() - if self.ctrl_down and keyname == "v": - self.paste_files() - if self.ctrl_down and keyname == "n": - self.unset_keys_and_data() - self.show_new_file_menu() - if keyname == "delete": - self.unset_keys_and_data() - self.delete_files() - if keyname == "f2": - self.unset_keys_and_data() - self.rename_files() - if keyname == "f4": - self.unset_keys_and_data() - self.open_terminal()