# Copyright 2022 (c) Anna Schumaker. """Displays our genre playlists.""" from .. import db from . import row from . import section class GenreRow(row.TreeRow): """A TreeRow for displaying Genre playlists.""" def __init__(self, *args, **kwargs): """Initialize a GenreRow.""" super().__init__(*args, indented=False, **kwargs) self.child = row.Row() class Section(section.Section): """A sidebar Section for the genre list.""" def __init__(self, table: db.genres.Table): """Initialize our Genre section.""" super().__init__(table, GenreRow, icon_name="theater", title="Genres", subtitle="0 genres") def do_get_subtitle(self, n_genres: int) -> str: """Return a subtitle for this section.""" s_genres = "s" if n_genres != 1 else "" return f"{n_genres} genre{s_genres}"