Skip to content

Commit

Permalink
Add function to get pane by name
Browse files Browse the repository at this point in the history
  • Loading branch information
diegogangl committed Jul 17, 2024
1 parent 243288c commit d6e52b2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion GTG/gtk/browser/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def _init_signal_connections(self):
self.connect('notify::default-height', self.on_window_resize)

for p in PANE_STACK_NAMES_MAP.keys():
pane = self.stack_switcher.get_stack().get_child_by_name(p).get_first_child()
pane = self.get_pane_by_name(p)
pane.task_selection.connect('selection-changed', self.on_selection_changed)

self.sidebar.connect('selection_changed', self.on_sidebar_select_changed)
Expand Down Expand Up @@ -1459,9 +1459,16 @@ def get_selected_pane(self, old_names: bool = True) -> str:
return current


def get_pane_by_name(self, name: str) -> TaskPane:
"""Get a task pane by name."""

return self.stack_switcher.get_stack().get_child_by_name(name).get_first_child()


def get_pane(self):
"""Get the selected pane."""


return self.stack_switcher.get_stack().get_visible_child().get_first_child()


Expand Down

0 comments on commit d6e52b2

Please sign in to comment.