from textual.app import App, ComposeResult from textual.widgets import Input, Button, Static, Footer from textual.containers import Container from rich.markdown import Markdown from textual.binding import Binding from gemtext import Gemtext from protocol.gemini import GeminiProtocol class Browset(App): CSS_PATH = "browset.css" BINDINGS = [ Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True), ] content = ["## Hello","* Bullet points","*OH Yeah!","=>URI some link"] def compose(self) -> ComposeResult: yield Footer() yield Container( Button("🔙"), # ⏪ Button("🔝"), # ⏫ Button("🔜"), # ⏩ Button("🔄"), # 🔁 Input(placeholder="Enter URI"), id="toolbar" ) yield Gemtext(fp=self.content, id="content") async def on_input_submitted(self, message: Input.Submitted) -> None: (mime, fp) = GeminiProtocol.get(message.value) self.query_one("#content").remove() self.mount(Gemtext(fp=fp, id="content")) if __name__ == "__main__": app = Browset() app.run()