From ee14f249f3a8534ba88ee259342527a6bbac322a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Wed, 15 Jun 2011 08:35:42 +0000 Subject: [PATCH] 5002: control n and p to move between categories not working svn: r17791 --- src/gui/viewmanager.py | 35 ++++++++++++++++++++++++++ src/plugins/sidebar/categorysidebar.py | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py index 3d17079b3..c077d03ff 100644 --- a/src/gui/viewmanager.py +++ b/src/gui/viewmanager.py @@ -206,6 +206,16 @@ UIDEFAULT = ''' + + + + + + + + + + @@ -777,6 +787,17 @@ class ViewManager(CLIManager): ('F8', None, 'F9', "F8", None, self.__keypress), ('F9', None, 'F9', "F9", None, self.__keypress), ('F11', None, 'F11', "F11", None, self.__keypress), + ('1', None, '1', "1", None, self.__gocat), + ('2', None, '2', "2", None, self.__gocat), + ('3', None, '3', "3", None, self.__gocat), + ('4', None, '4', "4", None, self.__gocat), + ('5', None, '5', "5", None, self.__gocat), + ('6', None, '6', "6", None, self.__gocat), + ('7', None, '7', "7", None, self.__gocat), + ('8', None, '8', "8", None, self.__gocat), + ('9', None, '9', "9", None, self.__gocat), + ('0', None, '0', "0", None, self.__gocat), + # NOTE: CTRL+ALT+NUMBER is set in src/plugins/sidebar/cat...py ('BackSpace', None, 'BackSpace', "BackSpace", None, self.__keypress), ('Delete', None, 'Delete', @@ -843,6 +864,20 @@ class ViewManager(CLIManager): self.uistate.push_message(self.dbstate, _("Key %s is not bound") % name) + def __gocat(self, action): + """ + Callback that is called on ctrl+number press. It moves to the + requested category like __next_view/__prev_view. 0 is 10 + """ + cat = int(action.get_name()[-1]) + if cat == 0: + cat = 10 + cat -= 1 + if cat >= len(self.current_views): + #this view is not present + return False + self.goto_page(cat, None) + def __next_view(self, action): """ Callback that is called when the next category action is selected. diff --git a/src/plugins/sidebar/categorysidebar.py b/src/plugins/sidebar/categorysidebar.py index f6c76c968..977f4d92a 100644 --- a/src/plugins/sidebar/categorysidebar.py +++ b/src/plugins/sidebar/categorysidebar.py @@ -128,7 +128,7 @@ class CategorySidebar(BaseSidebar): uitoolitems += '\n' % pageid # id, stock, button text, UI, tooltip, page if view_num < 9: - modifier = "%d" % ((view_num % 9) + 1) + modifier = "%d" % ((view_num % 9) + 1) else: modifier = ""