sidebar: Create a Stack Box
Containing our Stack and other widgets that get displayed along with it Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
34350d5700
commit
6ac08eb2bd
|
@ -1,9 +1,12 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
import audio
|
||||
import db
|
||||
import lib
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
from . import model
|
||||
from . import view
|
||||
from . import widgets
|
||||
|
||||
class Stack(Gtk.Stack):
|
||||
def __init__(self):
|
||||
|
@ -44,3 +47,19 @@ class Switcher(Gtk.StackSwitcher):
|
|||
self.add_css_class("osd")
|
||||
self.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
self.set_stack(Stack())
|
||||
|
||||
|
||||
class Box(Gtk.Box):
|
||||
def __init__(self, stack):
|
||||
Gtk.Box.__init__(self)
|
||||
self.set_orientation(Gtk.Orientation.VERTICAL)
|
||||
|
||||
self.append(audio.Artwork())
|
||||
self.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
self.append(lib.filter.Entry(model.TableFilter))
|
||||
self.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
self.append(stack)
|
||||
self.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
self.append(widgets.AddUpdateBox())
|
||||
self.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
self.append(widgets.ProgressBar())
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
import audio
|
||||
import db
|
||||
import lib
|
||||
import unittest
|
||||
from gi.repository import Gtk
|
||||
from . import model
|
||||
from . import stack
|
||||
from . import view
|
||||
from . import widgets
|
||||
|
||||
class TestStack(unittest.TestCase):
|
||||
def playlist_changed(self, stack, playlist):
|
||||
|
@ -83,3 +86,39 @@ class TestSwitcher(unittest.TestCase):
|
|||
self.assertEqual(switcher.get_orientation(), Gtk.Orientation.VERTICAL)
|
||||
self.assertTrue(switcher.has_css_class("large-icons"))
|
||||
self.assertTrue(switcher.has_css_class("osd"))
|
||||
|
||||
|
||||
class TestBox(unittest.TestCase):
|
||||
def test_init(self):
|
||||
s = stack.Stack()
|
||||
box = stack.Box(s)
|
||||
self.assertIsInstance(box, Gtk.Box)
|
||||
self.assertEqual(box.get_orientation(), Gtk.Orientation.VERTICAL)
|
||||
|
||||
child = box.get_first_child()
|
||||
self.assertIsInstance(child, audio.artwork.Artwork)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, Gtk.Separator)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, lib.filter.Entry)
|
||||
self.assertEqual(child.filter, model.TableFilter)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, Gtk.Separator)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertEqual(child, s)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, Gtk.Separator)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, widgets.AddUpdateBox)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, Gtk.Separator)
|
||||
|
||||
child = child.get_next_sibling()
|
||||
self.assertIsInstance(child, widgets.ProgressBar)
|
||||
|
|
Loading…
Reference in New Issue