diff options
| author | Zach DeCook <zachdecook@librem.one> | 2022-12-22 20:45:08 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@librem.one> | 2022-12-22 20:45:08 -0500 |
| commit | 7f7c524cf1cd6188d8704af3d211ce2c0a8b4e6f (patch) | |
| tree | 07c2e55dedd2609beafb5a41c26781331a939ccf /browset.py | |
| parent | a2707df86fcd7541840f2f3091953b717a6a101b (diff) | |
| download | browset-7f7c524cf1cd6188d8704af3d211ce2c0a8b4e6f.tar.gz | |
Gemtext: Dynamically add new content
Diffstat (limited to 'browset.py')
| -rw-r--r-- | browset.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/browset.py b/browset.py index a396768..7ea57c6 100644 --- a/browset.py +++ b/browset.py @@ -1,9 +1,9 @@ from textual.app import App, ComposeResult -from textual.widgets import Input, Button, Static +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 class Browset(App): CSS_PATH = "browset.css" @@ -11,8 +11,9 @@ class Browset(App): Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True), ] - content = "## Hello\n* Bullet points\n*OH Yeah!" + content = "## Hello\n* Bullet points\n*OH Yeah!\n=>URI some link" def compose(self) -> ComposeResult: + yield Footer() yield Container( Button("🔙"), # ⏪ Button("🔝"), # ⏫ @@ -22,10 +23,10 @@ class Browset(App): Input(placeholder="Enter URI"), id="toolbar" ) - yield Static(Markdown(self.content), id="content") + yield Gemtext(txt=self.content, id="content") async def on_input_submitted(self, message: Input.Submitted) -> None: self.content = "## new stuff\n"+message.value - self.query_one("#content", Static).update(Markdown(self.content)) + self.query_one("#content", Gemtext).update(self.content) if __name__ == "__main__": app = Browset() |
