From 7e7dd68b58f9018b8605ba49c19d643bba376cb3 Mon Sep 17 00:00:00 2001 From: Paul Culley Date: Thu, 1 Aug 2019 08:27:38 -0500 Subject: [PATCH] Fix Navigator sidebar so can change view type with proper resize (#853) Fixes #6422, #11164 --- gramps/gui/navigator.py | 13 +++++++++++-- gramps/gui/viewmanager.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gramps/gui/navigator.py b/gramps/gui/navigator.py index 36a86e997..4952a6ec9 100644 --- a/gramps/gui/navigator.py +++ b/gramps/gui/navigator.py @@ -199,7 +199,10 @@ class Navigator: Add a page to the sidebar for a plugin. """ self.pages.append((title, sidebar)) - index = self.notebook.append_page(sidebar.get_top(), Gtk.Label(label=title)) + page = sidebar.get_top() + # hide for now so notebook is only size of active page + page.get_child().hide() + index = self.notebook.append_page(page, Gtk.Label(label=title)) menu_item = Gtk.MenuItem(label=title) if order == START: @@ -276,9 +279,15 @@ class Navigator: old_page = notebook.get_current_page() if old_page != -1: self.pages[old_page][1].inactive() + # hide so notebook is only size of active page + notebook.get_nth_page(old_page).get_child().hide() + self.pages[index][1].active(self.active_cat, self.active_view) + notebook.get_nth_page(index).get_child().show() + notebook.queue_resize() if self.active_view is not None: - self.pages[index][1].view_changed(self.active_cat, self.active_view) + 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/gui/viewmanager.py b/gramps/gui/viewmanager.py index c9624c4c8..36ed5b41f 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -407,7 +407,7 @@ class ViewManager(CLIManager): self.navigator = Navigator(self) self.ebox.add(self.navigator.get_top()) - hpane.add1(self.ebox) + hpane.pack1(self.ebox, False, False) hpane.show() self.notebook = Gtk.Notebook()