Broken project to implement a cross-protocol browser in textual
Diffstat (limited to 'browset.py')
-rw-r--r--browset.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/browset.py b/browset.py
index 9dce9c3..817ad91 100644
--- a/browset.py
+++ b/browset.py
@@ -4,6 +4,7 @@ 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"
@@ -11,7 +12,7 @@ class Browset(App):
Binding("ctrl+c,ctrl+q", "app.quit", "Quit", show=True),
]
- content = "## Hello\n* Bullet points\n*OH Yeah!\n=>URI some link"
+ content = ["## Hello","* Bullet points","*OH Yeah!","=>URI some link"]
def compose(self) -> ComposeResult:
yield Footer()
yield Container(
@@ -23,11 +24,11 @@ class Browset(App):
Input(placeholder="Enter URI"),
id="toolbar"
)
- yield Gemtext(txt=self.content, id="content")
+ yield Gemtext(fp=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).remove()
- self.mount(Gemtext(txt=self.content, id="content"))
+ (mime, fp) = GeminiProtocol.get(message.value)
+ self.query_one("#content").remove()
+ self.mount(Gemtext(fp=fp, id="content"))
if __name__ == "__main__":
app = Browset()