4969: Prevent a view being changed whilst a view change is already in progress

svn: r17710
This commit is contained in:
Nick Hall 2011-06-07 22:49:18 +00:00
parent 2044a2ef72
commit deebab7a01
2 changed files with 9 additions and 5 deletions

View File

@ -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):
"""

View File

@ -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):
"""