gtk: Give Windows a sidebar property
This will be used to display a list of xfstests runs that the user can select. Signed-off-by: Anna Schumaker <anna@nowheycreamery.com>
This commit is contained in:
parent
b05a9ecc82
commit
64abc86fee
|
@ -82,6 +82,18 @@ class TestWindow(unittest.TestCase):
|
|||
self.assertEqual(window2.child, label)
|
||||
self.assertEqual(window2._splitview.props.content, label)
|
||||
|
||||
def test_sidebar(self):
|
||||
"""Test the window sidebar property."""
|
||||
self.assertIsNone(self.window.sidebar)
|
||||
self.window.sidebar = Gtk.Label()
|
||||
self.assertEqual(self.window._splitview.props.sidebar,
|
||||
self.window.sidebar)
|
||||
|
||||
label = Gtk.Label()
|
||||
window2 = xfstestsdb.gtk.window.Window(sidebar=label)
|
||||
self.assertEqual(window2.sidebar, label)
|
||||
self.assertEqual(window2._splitview.props.sidebar, label)
|
||||
|
||||
def test_runid(self):
|
||||
"""Test the window runid property."""
|
||||
self.assertEqual(self.window.runid, 0)
|
||||
|
|
|
@ -10,6 +10,7 @@ class Window(Adw.Window):
|
|||
"""Our customized Window displayed to the user."""
|
||||
|
||||
child = GObject.Property(type=Gtk.Widget)
|
||||
sidebar = GObject.Property(type=Gtk.Widget)
|
||||
headerbar = GObject.Property(type=Adw.HeaderBar)
|
||||
title = GObject.Property(type=Adw.WindowTitle)
|
||||
runid = GObject.Property(type=int)
|
||||
|
@ -22,6 +23,7 @@ class Window(Adw.Window):
|
|||
title=Adw.WindowTitle(title="xfstestsdb gtk"),
|
||||
headerbar=Adw.HeaderBar(), **kwargs)
|
||||
self._splitview = Adw.OverlaySplitView(content=self.child,
|
||||
sidebar=self.sidebar,
|
||||
collapsed=True,
|
||||
show_sidebar=self.show_sidebar)
|
||||
self._show_sidebar = Gtk.ToggleButton(icon_name="sidebar-show",
|
||||
|
@ -37,6 +39,7 @@ class Window(Adw.Window):
|
|||
self._show_sidebar.bind_property("active", self, "show-sidebar",
|
||||
GObject.BindingFlags.BIDIRECTIONAL)
|
||||
self.bind_property("show-sidebar", self._splitview, "show-sidebar")
|
||||
self.bind_property("sidebar", self._splitview, "sidebar")
|
||||
self.bind_property("child", self._splitview, "content")
|
||||
|
||||
self.connect("notify::runid", self.__notify_runid)
|
||||
|
|
Loading…
Reference in New Issue