feat(ui): draw pane frames, page keys and a scroll thumb
This commit is contained in:
1 parent
49f7efe0d2
commit
0219df454c
14 files changed
+571
-64
No files matched your search
@@ -76,6 +76,8 @@ class BeefyPlayerApp(App[None]):
|
||||
Binding("down,j", "cursor_down", "down", show=False),
|
||||
Binding("g", "cursor_top", "top", show=False),
|
||||
Binding("shift+g", "cursor_bottom", "bottom", show=False),
|
||||
Binding("pageup", "page_up", "page up", show=False),
|
||||
Binding("pagedown", "page_down", "page down", show=False),
|
||||
Binding("enter", "tune", "tune in"),
|
||||
Binding("space", "toggle_play", "play/pause"),
|
||||
Binding("s", "stop", "stop", show=False),
|
||||
@@ -824,6 +826,19 @@ class BeefyPlayerApp(App[None]):
|
||||
self.index = min(len(self.view) - 1, self.index + 1)
|
||||
self.query_one(StationList).refresh()
|
||||
|
||||
def _page(self, delta: int) -> None:
|
||||
if not self.view:
|
||||
return
|
||||
page = max(1, self.query_one(StationList).size.height - 1)
|
||||
self.index = max(0, min(len(self.view) - 1, self.index + delta * page))
|
||||
self.query_one(StationList).refresh()
|
||||
|
||||
def action_page_up(self) -> None:
|
||||
self._page(-1)
|
||||
|
||||
def action_page_down(self) -> None:
|
||||
self._page(1)
|
||||
|
||||
def action_cursor_top(self) -> None:
|
||||
if not self.view:
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user