Broken project to implement a cross-protocol browser in textual
Toolbar buttons: Make refresh and up buttons work
| -rw-r--r-- | browset.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -18,9 +18,9 @@ class Browset(App): yield Footer() yield Container( Button("🔙"), # ⏪ - Button("🔝"), # ⏫ + Button("🔝", name='../'), # ⏫ Button("🔜"), # ⏩ - Button("🔄"), # 🔁 + Button("🔄", variant='primary', name='refresh'), # 🔁 Input(placeholder="Enter URI", id="url"), id="toolbar" @@ -30,6 +30,10 @@ class Browset(App): self._do_url(message.value) async def on_button_pressed(self, event: Button.Pressed) -> None: + if event.button.variant == 'primary': + if event.button.name == "refresh": + self._do_url(self.url) + else: url = event.button.name if not ":" in url: url = GeminiProtocol.relativeURL(url, self.url) |