Skip to content

Commit

Permalink
fix Sidebar to resize better
Browse files Browse the repository at this point in the history
Fixes #10334
Issue #10161
  • Loading branch information
prculley committed Dec 27, 2017
1 parent ac86c41 commit 6bd8ad4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions gramps/gui/views/pageview.py
Expand Up @@ -156,8 +156,13 @@ def build_interface(self):
hpane = Gtk.Paned()
vpane = Gtk.Paned(orientation=Gtk.Orientation.VERTICAL)
hpane.pack1(vpane, resize=True, shrink=False)
hpane.pack2(self.sidebar, resize=False, shrink=True)
self._setup_slider_config(hpane, 'hpane.slider-position')
hpane.pack2(self.sidebar, resize=True, shrink=False)
# we don't know width of the pane yet, so estimate based on width of
# Gramps main window (left hand bar about 150 pix)
width = self.uistate.window.get_allocation().width - 150
# default will use 30% of pane for sidebar until it gets to 400 pix
pos = width - min(int(width * 0.30), 400)
self._setup_slider_config(hpane, 'hpane.slider-position', position=pos)
hpane.show()
vpane.show()

Expand All @@ -171,11 +176,11 @@ def build_interface(self):

return hpane

def _setup_slider_config(self, widget, setting):
def _setup_slider_config(self, widget, setting, position=-1):
"""
Setup the slider configuration setting.
"""
self._config.register(setting, -1)
self._config.register(setting, position)
widget.set_position(self._config.get(setting))
widget.connect('notify::position', self._position_changed, setting)

Expand Down
2 changes: 1 addition & 1 deletion gramps/gui/widgets/grampletbar.py
Expand Up @@ -370,7 +370,7 @@ def __add_tab(self, gramplet):
"""
Add a tab to the notebook for the given gramplet.
"""
width = min(int(self.uistate.screen_width() * 0.25), 400)
width = -1 # Allow tab width to adjust (smaller) to sidebar
height = min(int(self.uistate.screen_height() * 0.20), 400)
gramplet.set_size_request(width, height)

Expand Down

0 comments on commit 6bd8ad4

Please sign in to comment.