sidebar: Put the Pulser into the Sidebar.Box directly
Rather than putting it in the Window.Grid. I add some labels to provide spacing and to make sure the pulser area stays visible even if the pulser is hidden. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
05742d0bbc
commit
70f9bc5015
|
@ -1,5 +1,6 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from . import library
|
||||
from . import pulser
|
||||
from . import tagbox
|
||||
from . import user
|
||||
from lib import settings
|
||||
|
@ -8,7 +9,7 @@ import trackdb
|
|||
|
||||
Switcher = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
|
||||
Stack = Gtk.Stack()
|
||||
Box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
|
||||
Box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
|
||||
|
||||
|
||||
#
|
||||
|
@ -58,3 +59,5 @@ add_stack_page("Libraries", library.Box)
|
|||
|
||||
|
||||
Box.append(Stack)
|
||||
Box.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
Box.append(pulser.Box)
|
||||
|
|
|
@ -10,8 +10,12 @@ Timeout = None
|
|||
|
||||
Bar.hide()
|
||||
Bar.set_valign(Gtk.Align.CENTER)
|
||||
Bar.set_margin_start(10)
|
||||
Bar.set_margin_end(10)
|
||||
Bar.set_hexpand(True)
|
||||
|
||||
Box = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
|
||||
Box.append(Gtk.Label.new(str=" "))
|
||||
Box.append(Bar)
|
||||
Box.append(Gtk.Label.new(str=" "))
|
||||
|
||||
def do_pulses():
|
||||
global Timeout
|
||||
|
|
|
@ -18,15 +18,16 @@ class TestUIPulser(unittest.TestCase):
|
|||
|
||||
def test_pulser_init(self):
|
||||
self.assertIsInstance(pulser.Bar, Gtk.ProgressBar)
|
||||
self.assertIsInstance(pulser.Box, Gtk.Box)
|
||||
self.assertIsInstance(pulser.Lock, type(threading.Lock()))
|
||||
self.assertIsNone(pulser.Timeout)
|
||||
|
||||
self.assertTrue(pulser.Bar.get_hexpand())
|
||||
self.assertFalse(pulser.Bar.get_visible())
|
||||
self.assertEqual(pulser.Threads, [ ])
|
||||
self.assertEqual(pulser.Bar.get_valign(), Gtk.Align.CENTER)
|
||||
self.assertEqual(pulser.Bar.get_margin_start(), 10)
|
||||
self.assertEqual(pulser.Bar.get_margin_end(), 10)
|
||||
|
||||
self.assertIn(pulser.Bar, pulser.Box)
|
||||
self.assertIn(pulser.start_pulsing, lib.thread.Start.subscribers)
|
||||
self.assertIn(pulser.start_pulsing, lib.bus.Start.subscribers)
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ class TestSidebar(unittest.TestCase):
|
|||
self.assertIsInstance(sidebar.Box, Gtk.Box)
|
||||
|
||||
self.assertIn(sidebar.Stack, sidebar.Box)
|
||||
self.assertIn(sidebar.pulser.Box, sidebar.Box)
|
||||
|
||||
def test_sidebar_pages(self):
|
||||
self.assertTrue(sidebar.Switcher.has_css_class("osd"))
|
||||
|
|
|
@ -4,7 +4,6 @@ from lib import version
|
|||
from . import window
|
||||
from . import header
|
||||
from . import pane
|
||||
from sidebar import pulser
|
||||
from gi.repository import Gtk
|
||||
import sidebar
|
||||
import unittest
|
||||
|
@ -25,7 +24,6 @@ class TestUIWindow(unittest.TestCase):
|
|||
|
||||
self.assertIn(sidebar.Switcher, window.Grid)
|
||||
self.assertIn(pane.Pane, window.Grid)
|
||||
self.assertIn(pulser.Bar, window.Grid)
|
||||
self.assertIn(window.Sep, window.Grid)
|
||||
|
||||
self.assertEqual(window.Window.get_titlebar(), header.Header)
|
||||
|
|
|
@ -7,7 +7,6 @@ gi.require_version("Gtk", "4.0")
|
|||
from gi.repository import Gtk
|
||||
from . import header
|
||||
from . import pane
|
||||
from sidebar import pulser
|
||||
|
||||
Window = Gtk.ApplicationWindow()
|
||||
Grid = Gtk.Grid()
|
||||
|
@ -22,7 +21,6 @@ initialize()
|
|||
Grid.attach(sidebar.Switcher, 0, 0, 1, 2)
|
||||
Grid.attach(pane.Pane, 1, 0, 4, 1)
|
||||
Grid.attach(Sep, 1, 1, 4, 1)
|
||||
Grid.attach(pulser.Bar, 1, 2, 1, 1)
|
||||
|
||||
Window.set_title(version.string())
|
||||
Window.set_icon_name("emmental")
|
||||
|
|
Loading…
Reference in New Issue