From deebab7a01193c478e4e7cd3c18a4ea9e24927a1 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Tue, 7 Jun 2011 22:49:18 +0000 Subject: [PATCH] 4969: Prevent a view being changed whilst a view change is already in progress svn: r17710 --- src/gui/viewmanager.py | 6 ++++++ src/plugins/sidebar/categorysidebar.py | 8 +++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py index 267c8b2bb..918461036 100644 --- a/src/gui/viewmanager.py +++ b/src/gui/viewmanager.py @@ -307,6 +307,7 @@ class ViewManager(CLIManager): self.page_lookup = {} self.views = None self.current_views = [] # The current view in each category + self.view_changing = False self.show_navigator = config.get('interface.view') self.show_toolbar = config.get('interface.toolbar-on') @@ -1194,6 +1195,10 @@ class ViewManager(CLIManager): """ Called when the notebook page is changed. """ + if self.view_changing: + return + self.view_changing = True + cat_num = view_num = None for key in self.page_lookup: if self.page_lookup[key] == page_num: @@ -1213,6 +1218,7 @@ class ViewManager(CLIManager): self.navigator.view_changed(cat_num, view_num) self.__change_page(page_num) + self.view_changing = False def __change_page(self, page_num): """ diff --git a/src/plugins/sidebar/categorysidebar.py b/src/plugins/sidebar/categorysidebar.py index 0fa94f5e5..f6c76c968 100644 --- a/src/plugins/sidebar/categorysidebar.py +++ b/src/plugins/sidebar/categorysidebar.py @@ -206,12 +206,10 @@ class CategorySidebar(BaseSidebar): """ Called when a button causes a category change. """ + # Make the button inactive. It will be set to active in the + # view_changed method if the change was successful. + button.set_active(False) self.viewmanager.goto_page(cat_num, None) - - # If the click is on the same view we're in, - # restore the button state to active - if button and not button.get_active(): - button.set_active(True) def __make_sidebar_button(self, use_text, index, page_title, page_stock): """