Added focus pane keybindings

This commit is contained in:
itdominator 2023-11-11 19:49:29 -06:00
parent 30ab5305ca
commit e0774a5d2e
2 changed files with 26 additions and 3 deletions

View File

@ -64,6 +64,30 @@ class EditorEventsMixin:
page_num = 0 if self.get_n_pages() - 1 == page_num else page_num + 1
self.set_current_page(page_num)
def keyboard_focus_1st_pane(self):
if self.NAME == "notebook_1":
return
notebook = self.builder.get_object("notebook_1")
i = notebook.get_current_page()
page = notebook.get_nth_page(i)
self.set_page_focus_after_move(page, notebook)
def keyboard_focus_2nd_pane(self):
if self.NAME == "notebook_2":
return
notebook = self.builder.get_object("notebook_2")
if not notebook.is_visible():
notebook.show()
notebook.create_view()
i = notebook.get_current_page()
page = notebook.get_nth_page(i)
self.set_page_focus_after_move(page, notebook)
def keyboard_move_tab_to_1(self, page_num):
if self.NAME == "notebook_1": return

View File

@ -66,9 +66,8 @@ class EditorNotebook(EditorControllerMixin, Gtk.Notebook):
event_system.subscribe("keyboard_open_file", self._keyboard_open_file)
event_system.subscribe("keyboard_scale_up_text", self._keyboard_scale_up_text)
event_system.subscribe("keyboard_scale_down_text", self._keyboard_scale_down_text)
# event_system.subscribe("keyboard_save_file_as", self._keyboard_save_file_as)
event_system.subscribe("keyboard_focus_1st_pane", self.keyboard_focus_1st_pane)
event_system.subscribe("keyboard_focus_2nd_pane", self.keyboard_focus_2nd_pane)
def _load_widgets(self):
self._add_action_widgets()