ui: Switch to the new audio.Header()
And delete the old ui/header.py code Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
880f0a686b
commit
7979cb1a4a
|
@ -1,28 +1,15 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
import sys
|
||||
import tagdb
|
||||
from gi.repository import Gtk
|
||||
|
||||
from . import artwork
|
||||
from . import controls
|
||||
from . import nowplaying
|
||||
from . import player
|
||||
from . import scale
|
||||
|
||||
Player = player.Player()
|
||||
|
||||
|
||||
from . import controls
|
||||
def AudioControls():
|
||||
return controls.AudioControls(Player, Player.Autopause)
|
||||
|
||||
from . import artwork
|
||||
def Artwork():
|
||||
return artwork.Artwork(Player)
|
||||
|
||||
from . import nowplaying
|
||||
def NowPlaying():
|
||||
return nowplaying.NowPlaying(Player)
|
||||
|
||||
from . import scale
|
||||
def SeekControl():
|
||||
return scale.ScaleButtonBox(scale.SeekScale(Player))
|
||||
|
||||
def Artwork(): return artwork.Artwork(Player)
|
||||
|
||||
class Header(Gtk.HeaderBar):
|
||||
def __init__(self):
|
||||
|
|
|
@ -28,14 +28,5 @@ class TestAudio(unittest.TestCase):
|
|||
audio.nowplaying.NowPlaying)
|
||||
|
||||
def test_widgets(self):
|
||||
seeker = audio.SeekControl()
|
||||
|
||||
self.assertIsInstance(audio.AudioControls(),
|
||||
audio.controls.AudioControls)
|
||||
self.assertIsInstance(audio.Artwork(),
|
||||
audio.artwork.Artwork)
|
||||
self.assertIsInstance(audio.NowPlaying(),
|
||||
audio.nowplaying.NowPlaying)
|
||||
self.assertIsInstance(seeker, audio.scale.ScaleButtonBox)
|
||||
self.assertIsInstance(seeker.get_first_child().get_next_sibling(),
|
||||
audio.scale.SeekScale)
|
||||
|
|
13
ui/header.py
13
ui/header.py
|
@ -1,13 +0,0 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
|
||||
Header = Gtk.HeaderBar()
|
||||
|
||||
controls = audio.AudioControls()
|
||||
Header.pack_start(controls)
|
||||
|
||||
Header.set_title_widget(audio.NowPlaying())
|
||||
|
||||
seekctrl = audio.SeekControl()
|
||||
Header.pack_end(seekctrl)
|
|
@ -1,13 +0,0 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
import audio
|
||||
import unittest
|
||||
from gi.repository import Gtk
|
||||
from . import header
|
||||
|
||||
class TestHeader(unittest.TestCase):
|
||||
def test_header_init(self):
|
||||
self.assertIsInstance(header.Header, Gtk.HeaderBar)
|
||||
self.assertIsInstance(header.controls, audio.controls.AudioControls)
|
||||
self.assertIsInstance(header.Header.get_title_widget(),
|
||||
audio.nowplaying.NowPlaying)
|
||||
self.assertIsInstance(header.seekctrl, audio.scale.ScaleButtonBox)
|
|
@ -2,10 +2,10 @@
|
|||
from lib import settings
|
||||
from lib import version
|
||||
from . import window
|
||||
from . import header
|
||||
from . import keyboard
|
||||
from . import pane
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
import sidebar
|
||||
import unittest
|
||||
|
||||
|
@ -20,12 +20,12 @@ class TestUIWindow(unittest.TestCase):
|
|||
|
||||
def test_window_init(self):
|
||||
self.assertIsInstance(window.Window, Gtk.ApplicationWindow)
|
||||
self.assertIsInstance(window.Window.get_titlebar(), audio.Header)
|
||||
self.assertIsInstance(window.Box, Gtk.Box)
|
||||
|
||||
self.assertIn(sidebar.Switcher, window.Box)
|
||||
self.assertIn(pane.Pane, window.Box)
|
||||
|
||||
self.assertEqual(window.Window.get_titlebar(), header.Header)
|
||||
self.assertEqual(window.Window.get_child(), window.Box)
|
||||
window.Window.present()
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from lib import settings
|
||||
from lib import version
|
||||
import audio
|
||||
import sidebar
|
||||
import gi
|
||||
gi.require_version("Gtk", "4.0")
|
||||
from gi.repository import Gtk
|
||||
from . import header
|
||||
from . import keyboard
|
||||
from . import pane
|
||||
|
||||
|
@ -24,7 +24,7 @@ Box.append(pane.Pane)
|
|||
Window.add_controller(keyboard.Event)
|
||||
Window.set_title(version.string())
|
||||
Window.set_icon_name("emmental")
|
||||
Window.set_titlebar(header.Header)
|
||||
Window.set_titlebar(audio.Header())
|
||||
Window.set_child(Box)
|
||||
Window.set_default_size(settings.get_int("window.width"),
|
||||
settings.get_int("window.height"))
|
||||
|
|
Loading…
Reference in New Issue