ui: Switch over to the new sidebar.Sidebar class
Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
20b84fa019
commit
35e31d0553
|
@ -9,11 +9,10 @@ class Pane(Gtk.Paned):
|
|||
Gtk.Paned.__init__(self)
|
||||
|
||||
# Suppress some warnings during testing
|
||||
if sidebar.Box.get_parent(): sidebar.Box.unparent()
|
||||
if playlist.Box.get_parent(): playlist.Box.unparent()
|
||||
|
||||
self.set_shrink_start_child(False)
|
||||
self.set_start_child(sidebar.Box)
|
||||
self.set_start_child(sidebar.Sidebar())
|
||||
self.set_end_child(playlist.Box)
|
||||
self.set_vexpand(True)
|
||||
|
||||
|
|
|
@ -14,8 +14,8 @@ class TestPane(unittest.TestCase):
|
|||
paned = pane.Pane()
|
||||
|
||||
self.assertIsInstance(paned, Gtk.Paned)
|
||||
self.assertIsInstance(paned.get_start_child(), sidebar.Sidebar)
|
||||
self.assertEqual(paned.get_orientation(), Gtk.Orientation.HORIZONTAL)
|
||||
self.assertEqual(paned.get_start_child(), sidebar.Box)
|
||||
self.assertEqual(paned.get_end_child(), playlist.Box)
|
||||
self.assertFalse(paned.get_shrink_start_child())
|
||||
self.assertTrue(paned.get_vexpand())
|
||||
|
|
|
@ -8,18 +8,6 @@ from . import keyboard
|
|||
from . import pane
|
||||
from . import window
|
||||
|
||||
class TestBox(unittest.TestCase):
|
||||
def test_init(self):
|
||||
box = window.Box()
|
||||
self.assertIsInstance(box, Gtk.Box)
|
||||
self.assertEqual(box.get_orientation(), Gtk.Orientation.HORIZONTAL)
|
||||
|
||||
child = box.get_first_child()
|
||||
self.assertEqual(child, sidebar.Switcher)
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, pane.Pane)
|
||||
|
||||
|
||||
class TestWindow(unittest.TestCase):
|
||||
def setUp(self):
|
||||
lib.settings.reset()
|
||||
|
@ -28,7 +16,7 @@ class TestWindow(unittest.TestCase):
|
|||
win = window.Window()
|
||||
self.assertIsInstance(win, Gtk.ApplicationWindow)
|
||||
self.assertIsInstance(win.get_titlebar(), audio.Header)
|
||||
self.assertIsInstance(win.get_child(), window.Box)
|
||||
self.assertIsInstance(win.get_child(), pane.Pane)
|
||||
|
||||
self.assertEqual(win.get_icon_name(), "emmental")
|
||||
self.assertEqual(win.get_title(), lib.version.string())
|
||||
|
|
10
ui/window.py
10
ui/window.py
|
@ -6,21 +6,13 @@ from gi.repository import Gtk
|
|||
from . import keyboard
|
||||
from . import pane
|
||||
|
||||
class Box(Gtk.Box):
|
||||
def __init__(self):
|
||||
Gtk.Box.__init__(self)
|
||||
if sidebar.Switcher.get_parent(): sidebar.Switcher.unparent()
|
||||
self.append(sidebar.Switcher)
|
||||
self.append(pane.Pane())
|
||||
|
||||
|
||||
class Window(Gtk.ApplicationWindow):
|
||||
def __init__(self):
|
||||
Gtk.ApplicationWindow.__init__(self)
|
||||
self.set_icon_name("emmental")
|
||||
self.set_title(lib.version.string())
|
||||
self.set_titlebar(audio.Header())
|
||||
self.set_child(Box())
|
||||
self.set_child(pane.Pane())
|
||||
self.add_controller(keyboard.Event)
|
||||
|
||||
lib.settings.initialize("window.width", 1400)
|
||||
|
|
Loading…
Reference in New Issue