1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
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
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!\n=>URI some link"
def compose(self) -> ComposeResult:
yield Footer()
yield Container(
Button("🔙"), # ⏪
Button("🔝"), # ⏫
Button("🔜"), # ⏩
Button("🔄"), # 🔁
Input(placeholder="Enter URI"),
id="toolbar"
)
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", Gemtext).update(self.content)
if __name__ == "__main__":
app = Browset()
app.run()
|