sidebar: Create a new Sidebar class

Containing both the Stack Switcher and Stack Box

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-10-12 15:55:00 -04:00
parent 6ac08eb2bd
commit 20b84fa019
2 changed files with 21 additions and 1 deletions

View File

@ -1,6 +1,7 @@
# Copyright 2021 (c) Anna Schumaker.
from . import library
from . import pulser
from . import stack
from . import tagbox
from . import user
from lib import settings
@ -8,6 +9,13 @@ from gi.repository import Gtk
import audio
import tagdb
class Sidebar(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(self)
switcher = stack.Switcher()
self.append(switcher)
self.append(stack.Box(switcher.get_stack()))
Switcher = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
Stack = Gtk.Stack()
Box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)

View File

@ -1,11 +1,23 @@
# Copyright 2021 (c) Anna Schumaker.
from lib import settings
import audio
import sidebar
import unittest
from lib import settings
from gi.repository import Gtk
from . import stack
class TestSidebar(unittest.TestCase):
def test_init(self):
sbar = sidebar.Sidebar()
self.assertIsInstance(sbar, Gtk.Box)
child = sbar.get_first_child()
self.assertIsInstance(child, stack.Switcher)
child = child.get_next_sibling()
self.assertIsInstance(child, stack.Box)
class TestOldSidebar(unittest.TestCase):
def setUpClass():
sidebar.initialize()