audio: Add an Artwork object to the Player
And add it to the Sidebar box while we're at it Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
16d31dfd3a
commit
500d0757d1
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from . import artwork
|
||||
from . import controls
|
||||
from . import nowplaying
|
||||
from . import seeker
|
||||
|
@ -26,6 +27,7 @@ class Player:
|
|||
self.Controls.connect("volume-changed", self.volume_changed)
|
||||
|
||||
self.NowPlaying = nowplaying.NowPlaying()
|
||||
self.Artwork = artwork.Artwork()
|
||||
|
||||
self.Seeker = seeker.Seeker()
|
||||
self.Seeker.connect(self.seeked)
|
||||
|
@ -82,6 +84,11 @@ class Player:
|
|||
(res, artist) = taglist.get_string("artist")
|
||||
if res == True:
|
||||
self.NowPlaying.set_artist(artist)
|
||||
(res, sample) = taglist.get_sample("image")
|
||||
if res == True:
|
||||
self.Artwork.set_from_sample(sample)
|
||||
else:
|
||||
self.Artwork.reset()
|
||||
|
||||
def pause(self, *args):
|
||||
self.playbin.set_state(Gst.State.PAUSED)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from . import artwork
|
||||
from . import controls
|
||||
from . import nowplaying
|
||||
from . import player
|
||||
|
@ -34,6 +35,7 @@ class TestPlayer(unittest.TestCase):
|
|||
self.assertIsInstance(play.bus, Gst.Bus)
|
||||
self.assertIsInstance(play.Controls, controls.Controls)
|
||||
self.assertIsInstance(play.NowPlaying, nowplaying.NowPlaying)
|
||||
self.assertIsInstance(play.Artwork, artwork.Artwork)
|
||||
self.assertIsInstance(play.Seeker, seeker.Seeker)
|
||||
self.assertIsNone(play.track)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from . import tagbox
|
|||
from . import user
|
||||
from lib import settings
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
import trackdb
|
||||
|
||||
Switcher = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
|
||||
|
@ -58,6 +59,8 @@ add_stack_page("Decades", tagbox.ParentTagBox(trackdb.tags.Decade, "x-office-c
|
|||
add_stack_page("Libraries", library.Box)
|
||||
|
||||
|
||||
Box.append(audio.Player.Artwork)
|
||||
Box.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
Box.append(Stack)
|
||||
Box.append(Gtk.Separator.new(Gtk.Orientation.HORIZONTAL))
|
||||
Box.append(pulser.Box)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from lib import settings
|
||||
import audio
|
||||
import sidebar
|
||||
import unittest
|
||||
from gi.repository import Gtk
|
||||
|
@ -13,6 +14,7 @@ class TestSidebar(unittest.TestCase):
|
|||
self.assertIsInstance(sidebar.Stack, Gtk.Stack)
|
||||
self.assertIsInstance(sidebar.Box, Gtk.Box)
|
||||
|
||||
self.assertIn(audio.Player.Artwork, sidebar.Box)
|
||||
self.assertIn(sidebar.Stack, sidebar.Box)
|
||||
self.assertIn(sidebar.pulser.Box, sidebar.Box)
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from . import icons
|
||||
from . import window
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
|
||||
class EmmentalApplication(Gtk.Application):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -13,5 +14,6 @@ class EmmentalApplication(Gtk.Application):
|
|||
def do_startup(self):
|
||||
Gtk.Application.do_startup(self)
|
||||
self.add_window(window.Window)
|
||||
audio.Player.Artwork.reset()
|
||||
|
||||
Application = EmmentalApplication()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2021 (c) Anna Schumaker.
|
||||
from lib import settings
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
import playlist
|
||||
import sidebar
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
from lib import settings
|
||||
from . import pane
|
||||
from gi.repository import Gtk
|
||||
import audio
|
||||
import playlist
|
||||
import sidebar
|
||||
import unittest
|
||||
|
|
Loading…
Reference in New Issue