chiark / gitweb /
Also display From: lines.
authorSimon Tatham <anakin@pobox.com>
Fri, 1 Dec 2023 09:03:52 +0000 (09:03 +0000)
committerSimon Tatham <anakin@pobox.com>
Fri, 1 Dec 2023 09:03:52 +0000 (09:03 +0000)
mastodonochrome
text.py

index c68528a799e9e836b9ff4393a06723efeece1cea..6614d08df8cdb4c1afe5be33731c5f4946be6fe2 100755 (executable)
@@ -56,8 +56,12 @@ class Post:
         tm = time.strptime(date, "%Y-%m-%dT%H:%M:%S")
         self.datestamp = calendar.timegm(tm)
 
+        self.account = data['account']
+
     def text(self):
         yield text.SeparatorLine(self.datestamp)
+        yield text.FromLine('@' + self.account['acct'],
+                            self.account['display_name'])
 
 class MainUI(Client):
     def run(self):
diff --git a/text.py b/text.py
index 3fb55f4600037b3ccb7c5df365ac22a805366f50..00f9c60b44531fb2f359aae7eeea3b60a78e8422 100644 (file)
--- a/text.py
+++ b/text.py
@@ -12,3 +12,13 @@ class SeparatorLine:
         # FIXME: colours
         suffix = "[" + date + "]--"
         return "-" * (width - len(suffix)) + suffix
+
+class FromLine:
+    def __init__(self, account, nameline):
+        self.account = account
+        self.nameline = nameline
+
+    def render(self, width):
+        # FIXME: truncate
+
+        return f"From: {self.nameline} ({self.account})"