# Copyright 2022 (c) Anna Schumaker. """A card for displaying information about the currently playing track.""" from gi.repository import GObject from gi.repository import Gtk from . import tags class Card(Gtk.Box): """The Now Playing information card.""" title = GObject.Property(type=str) album = GObject.Property(type=str) artist = GObject.Property(type=str) album_artist = GObject.Property(type=str) prefer_artist = GObject.Property(type=bool, default=True) def __init__(self): """Initialize a Now Playing Card.""" super().__init__() self._grid = Gtk.Grid() self._tags = tags.TagInfo() for prop in ["title", "album", "artist", "album-artist"]: self.bind_property(prop, self._tags, prop) self.bind_property("prefer-artist", self._tags, "prefer-artist", GObject.BindingFlags.BIDIRECTIONAL) self._grid.attach(self._tags, 0, 0, 1, 1) self.append(self._grid) self.add_css_class("card")