sidebar: Bold the top playlist on the trackdb.Stack

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-07-07 20:29:32 -04:00
parent aa15f9bf69
commit 6c8903e7fd
2 changed files with 10 additions and 2 deletions

View File

@ -29,6 +29,11 @@ def switch_page(toggle):
Stack.set_visible_child_name(toggle.get_name())
settings.set("sidebar.page", toggle.get_name())
def on_tag_push_pop(old, new):
old.widgets.set_label()
new.widgets.set_label()
trackdb.Stack.PushPop.register(on_tag_push_pop)
def add_stack_page(name, page):
toggle = Gtk.ToggleButton()
toggle.set_icon_name(page.icon)

View File

@ -1,5 +1,6 @@
# Copyright 2021 (c) Anna Schumaker.
from gi.repository import Gtk, Pango
from gi.repository import Gtk, GLib, Pango
import trackdb
class TagRow(Gtk.ListBoxRow):
def __init__(self, tag, icon):
@ -23,8 +24,10 @@ class TagRow(Gtk.ListBoxRow):
def set_label(self):
count = len(self.tag)
bold = trackdb.Stack.current() == self.tag
text = f"{self.tag.name}\n{count} Track{'s' if count != 1 else ''}"
self.label.set_label(text)
self.label.set_markup(("<b>%s</b>" if bold else "%s") %
GLib.markup_escape_text(text))
class ParentTagRow(TagRow):