Skip to content

Commit

Permalink
exposed multipaned paned set
Browse files Browse the repository at this point in the history
  • Loading branch information
elbeardmorez committed Mar 11, 2018
1 parent 5c7a820 commit a2224ff
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions quodlibet/quodlibet/qltk/paned.py
Expand Up @@ -184,7 +184,7 @@ def get_paned(self):
return self._root_paned

def make_pane_sizes_equal(self):
paneds = self._get_paneds()
paneds = self.get_paneds()

# the relative paned widths must be equal to the reciprocal (1/i) of
# their respective indices (i) in reverse order (from right to left)
Expand All @@ -201,7 +201,7 @@ def change_orientation(self, horizontal):
hor = Gtk.Orientation.HORIZONTAL
ver = Gtk.Orientation.VERTICAL

for paned in self._get_paneds():
for paned in self.get_paneds():
paned.props.orientation = hor if horizontal else ver

def destroy(self):
Expand All @@ -211,7 +211,7 @@ def destroy(self):
def show_all(self):
self._root_paned.show_all()

def _get_paneds(self):
def get_paneds(self):
"""Get all internal paneds in a flat, ordered list."""

paneds = [self._root_paned]
Expand Down Expand Up @@ -246,7 +246,7 @@ def __init__(self, section, option):

def set_widgets(self, widgets):
super(ConfigMultiRPaned, self).set_widgets(widgets)
paneds = self._get_paneds()
paneds = self.get_paneds()

# Connect all paneds
for paned in paneds:
Expand All @@ -257,7 +257,7 @@ def set_widgets(self, widgets):
def save_widths(self):
"""Save all current paned widths."""

paneds = self._get_paneds()
paneds = self.get_paneds()
if len(paneds) == 1 and not paneds[0].get_child1():
# If there's only one pane (i.e. the only paned has just one
# child), do not save the paned width, as this will cause
Expand All @@ -273,7 +273,7 @@ def _restore_widths(self):
"""Restore pane widths from the config."""

widths = config.getstringlist(self.section, self.option, [])
paneds = self._get_paneds()
paneds = self.get_paneds()

if not widths:
# If no widths are saved, save the current widths
Expand Down
2 changes: 1 addition & 1 deletion quodlibet/tests/test_browsers_paned.py
Expand Up @@ -165,7 +165,7 @@ def test_make_pane_widths_equal(self):
config.set("browsers", "panes", "artist\talbum\t~year\t~#track")
self.bar.set_all_panes()
self.bar.make_pane_sizes_equal()
paneds = self.bar.multi_paned._get_paneds()
paneds = self.bar.multi_paned.get_paneds()

self.failUnlessAlmostEqual(paneds[0].get_relative(), 1.0 / 4.0)
self.failUnlessAlmostEqual(paneds[1].get_relative(), 1.0 / 3.0)
Expand Down
4 changes: 2 additions & 2 deletions quodlibet/tests/test_qltk_paned.py
Expand Up @@ -153,7 +153,7 @@ def test_change_orientation(self):
horizontal_opposite = False

p.change_orientation(horizontal=horizontal_opposite)
for paned in p._get_paneds():
for paned in p.get_paneds():
self.assertIs(paned.props.orientation, opposite)

def test_destroy(self):
Expand Down Expand Up @@ -183,7 +183,7 @@ def test_basic(self):
sws = [Gtk.ScrolledWindow() for _ in range(3)]
p.set_widgets(sws)

paneds = p._get_paneds()
paneds = p.get_paneds()
paneds[0].set_relative(0.4)
paneds[1].set_relative(0.6)
p.save_widths()
Expand Down

0 comments on commit a2224ff

Please sign in to comment.