feat(ui): add catalogue picker, schedule pane and per-provider hero
This commit is contained in:
1 parent
058d336a2c
commit
b31ad3f6fb
16 files changed
+1211
-65
No files matched your search
@@ -13,6 +13,7 @@ from textual.app import ComposeResult
|
||||
from textual.screen import ModalScreen
|
||||
from textual.widgets import Static
|
||||
|
||||
from ..providers import PROVIDERS, available_providers
|
||||
from .common import SPECTRUM_STOPS, gradient
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -33,7 +34,8 @@ HELP_ROWS: tuple[tuple[str, str], ...] = (
|
||||
"v",
|
||||
"cycle visualiser: mirror → bars → wave → waterfall → radial → braille",
|
||||
),
|
||||
("r", "refresh station list and song history"),
|
||||
("r", "refresh stations, schedule and song history"),
|
||||
("p", "switch station catalogue (SomaFM / tilderadio)"),
|
||||
("g / G", "jump to the top / bottom of the list"),
|
||||
("? ", "this help"),
|
||||
("q", "quit"),
|
||||
@@ -68,12 +70,40 @@ ABOUT_MACOS = (
|
||||
|
||||
class HelpScreen(ModalScreen[None]):
|
||||
def compose(self) -> ComposeResult:
|
||||
provider = cast("BeefyPlayerApp", self.app).provider
|
||||
app = cast("BeefyPlayerApp", self.app)
|
||||
provider = app.provider
|
||||
about = (
|
||||
f"Stations and song history come from {provider.name} "
|
||||
f"({provider.station_source} + {provider.history_source}).",
|
||||
) + (ABOUT_MACOS if sys.platform == "darwin" else ABOUT_LINUX)
|
||||
|
||||
catalogues = Table.grid(padding=(0, 2), expand=False)
|
||||
catalogues.add_column(style="bold cyan", no_wrap=True, justify="right")
|
||||
catalogues.add_column(style="bold", no_wrap=True)
|
||||
catalogues.add_column(style="dim")
|
||||
for slug in available_providers():
|
||||
catalogue = PROVIDERS[slug]
|
||||
marker = "●" if slug == provider.id else " "
|
||||
pane = "schedule pane" if catalogue.has_schedule else "station list"
|
||||
catalogues.add_row(
|
||||
marker, slug, f"{catalogue.name} — {pane}"
|
||||
)
|
||||
|
||||
pane_note = Text()
|
||||
if provider.has_schedule:
|
||||
pane_note.append(
|
||||
f"{provider.name} is a single stream, so the left pane is its "
|
||||
"broadcast schedule; the station filter and favourites only "
|
||||
"apply to multi-station catalogues.",
|
||||
style="dim italic",
|
||||
)
|
||||
|
||||
catalogue_title = Text()
|
||||
catalogue_title.append("CATALOGUES", style="bold cyan")
|
||||
catalogue_title.append(
|
||||
" switch with p or --provider at start", style="dim"
|
||||
)
|
||||
|
||||
table = Table.grid(padding=(0, 2), expand=False)
|
||||
table.add_column(style="bold cyan", no_wrap=True, justify="right")
|
||||
table.add_column(style="")
|
||||
@@ -90,7 +120,17 @@ class HelpScreen(ModalScreen[None]):
|
||||
for line in textwrap.wrap(paragraph, width=70):
|
||||
footer.append(line + "\n", style="dim")
|
||||
|
||||
body = Group(header, Text(""), table, Text(""), footer)
|
||||
body = Group(
|
||||
header,
|
||||
Text(""),
|
||||
table,
|
||||
Text(""),
|
||||
pane_note,
|
||||
catalogue_title,
|
||||
catalogues,
|
||||
Text(""),
|
||||
footer,
|
||||
)
|
||||
yield Static(body, id="help")
|
||||
|
||||
def on_key(self, event) -> None:
|
||||
|
||||
Reference in new issue
Block a user