Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create keyboard shortcuts to switch between Open, Actionable and Closed issue#975 #1160

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions GTG/gtk/browser/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ def __init__(self, app):
# YOU CAN DEFINE YOUR INTERNAL MECHANICS VARIABLES BELOW
# Setup GTG icon theme
self._init_icon_theme()

#switch tab
self.switch_tab_open()
self.switch_tab_actionable()
self.switch_tab_closed()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are they called here at init? I don't see the need for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon reviewing the code as recommended, I have implemented the necessary modifications


# Init Actions
self._set_actions()
Expand Down Expand Up @@ -198,6 +203,22 @@ def _init_context_menus(self):
self.panes['active'].sort_btn.set_popover(self.sort_menu)


def switch_tab_open(self, t=None , a = None):
"""switch tab 'open_view'."""
stack = self.stack_switcher.get_stack()
stack.set_visible_child_name('open_view')

def switch_tab_actionable(self, t=None , a = None):
"""switch tab 'actionable_view'."""
stack = self.stack_switcher.get_stack()
stack.set_visible_child_name('actionable_view')

def switch_tab_closed(self, t=None , a = None):
"""switch tab 'closed_view'."""
stack = self.stack_switcher.get_stack()
stack.set_visible_child_name('closed_view')


def _set_actions(self):
"""Setup actions."""

Expand All @@ -213,6 +234,9 @@ def _set_actions(self):
('focus_quickentry', self.focus_quickentry, ('win.focus_quickentry', ['<ctrl>L'])),
('delete_task', self.on_delete_tasks, ('win.delete_task', ['<ctrl>Delete'])),
('help_overlay', None, ('win.show-help-overlay', ['<ctrl>question'])),
('switch_tab_open' , self.switch_tab_open, ('win.switch_tab_open' , ['<alt>1'])),
('switch_tab_actionable' , self.switch_tab_actionable, ('win.switch_tab_actionable' , ['<alt>2'])),
('switch_tab_closed' , self.switch_tab_closed, ('win.switch_tab_closed' , ['<alt>3'])),
('mark_as_started', self.on_mark_as_started, None),
('start_today', self.on_start_for_today, None),
('start_tomorrow', self.on_start_for_tomorrow, None),
Expand Down