From b7fcc9dc6f0c67ec560f88bf106d5e59cfa9f5fa Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Mon, 21 Apr 2014 22:19:22 +0100 Subject: [PATCH] Prevent warning message in expander navigation plugin --- gramps/gui/navigator.py | 3 ++- gramps/plugins/sidebar/expandersidebar.py | 6 +----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/gramps/gui/navigator.py b/gramps/gui/navigator.py index 2512f66b5..c011a54c4 100644 --- a/gramps/gui/navigator.py +++ b/gramps/gui/navigator.py @@ -276,7 +276,8 @@ class Navigator(object): if old_page != -1: self.pages[old_page][1].inactive() self.pages[index][1].active(self.active_cat, self.active_view) - self.pages[index][1].view_changed(self.active_cat, self.active_view) + if self.active_view is not None: + self.pages[index][1].view_changed(self.active_cat, self.active_view) self.title_label.set_text(self.pages[index][0]) def cb_close_clicked(self, button): diff --git a/gramps/plugins/sidebar/expandersidebar.py b/gramps/plugins/sidebar/expandersidebar.py index d9683b2f5..f739e7c0c 100644 --- a/gramps/plugins/sidebar/expandersidebar.py +++ b/gramps/plugins/sidebar/expandersidebar.py @@ -111,11 +111,7 @@ class ExpanderSidebar(BaseSidebar): if cat_num is not None: self.expanders[cat_num].set_expanded(True) # Set new button as selected - try: - button_num = self.lookup[(cat_num, view_num)] - except KeyError as err: - logging.warning("Key Error retrieving button number: %s" % str(err)) - button_num = 0 + button_num = self.lookup.get((cat_num, view_num)) self.__handlers_block() for index, button in enumerate(self.buttons): if index == button_num: