summary refs log tree commit diff
path: root/browset.py
diff options
context:
space:
mode:
authorZach DeCook <zach@vostro.home.zachdecook.com>2022-12-10 14:29:04 -0500
committerZach DeCook <zachdecook@librem.one>2022-12-10 14:29:48 -0500
commitdb8880b82dafde1392edda7e1cf73f321cb6bb88 (patch)
treed9ba80c4be1939159437e67329c62f34a66819be /browset.py
parenteb7e03866d67cd34afd136a7e36403b08d208d28 (diff)
downloadbrowset-db8880b82dafde1392edda7e1cf73f321cb6bb88.tar.gz
browset: basic input tests
Diffstat (limited to 'browset.py')
-rw-r--r--browset.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/browset.py b/browset.py
index 42bfec9..a396768 100644
--- a/browset.py
+++ b/browset.py
@@ -1,10 +1,17 @@
 from textual.app import App, ComposeResult
-from textual.widgets import Input, Button
+from textual.widgets import Input, Button, Static
 from textual.containers import Container
+from rich.markdown import Markdown
+from textual.binding import Binding
 
 
 class Browset(App):
     CSS_PATH = "browset.css"
+    BINDINGS = [
+        Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True),
+    ]
+
+    content = "## Hello\n* Bullet points\n*OH Yeah!"
     def compose(self) -> ComposeResult:
         yield Container(
             Button("🔙"), # ⏪
@@ -15,6 +22,10 @@ class Browset(App):
             Input(placeholder="Enter URI"),
             id="toolbar"
         )
+        yield Static(Markdown(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))
 
 if __name__ == "__main__":
     app = Browset()