audio: Create a custom ControlsPopover widget
For displaying our menu controls Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
68f0541079
commit
bd49396210
|
@ -75,6 +75,15 @@ class VolumeControlBox(ControlScaleBox):
|
|||
icon.set_from_icon_name(f"audio-volume-{name}-symbolic")
|
||||
|
||||
|
||||
class ControlsPopover(Gtk.Popover):
|
||||
def __init__(self, player, apscale):
|
||||
Gtk.Popover.__init__(self)
|
||||
self.box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
|
||||
self.box.append(AutoPauseControlBox(apscale))
|
||||
self.box.append(VolumeControlBox(player))
|
||||
self.set_child(self.box)
|
||||
|
||||
|
||||
class Controls(Gtk.Box):
|
||||
def __init__(self):
|
||||
Gtk.Box.__init__(self)
|
||||
|
|
|
@ -117,6 +117,25 @@ class TestVolumeControlbox(unittest.TestCase):
|
|||
self.assertEqual(icon.get_icon_name(), "audio-volume-high-symbolic")
|
||||
|
||||
|
||||
class TestControlsPopover(unittest.TestCase):
|
||||
def test_controls_popover(self):
|
||||
fake = FakePlayer()
|
||||
apscale = scale.AutoPauseScale()
|
||||
pop = controls.ControlsPopover(fake, apscale)
|
||||
|
||||
self.assertIsInstance(pop, Gtk.Popover)
|
||||
self.assertIsInstance(pop.box, Gtk.Box)
|
||||
|
||||
expected = [ controls.AutoPauseControlBox, controls.VolumeControlBox ]
|
||||
child = pop.box.get_first_child()
|
||||
while len(expected) > 0:
|
||||
self.assertIsInstance(child, expected.pop(0))
|
||||
child = child.get_next_sibling()
|
||||
|
||||
self.assertEqual(pop.get_child(), pop.box)
|
||||
self.assertEqual(pop.box.get_orientation(), Gtk.Orientation.VERTICAL)
|
||||
|
||||
|
||||
class TestControls(unittest.TestCase):
|
||||
def test_controls_init(self):
|
||||
ctrl = controls.Controls()
|
||||
|
|
Loading…
Reference in New Issue