pull/112/head
Ivan Habunek 2019-08-24 13:43:41 +02:00
rodzic f68f5d5716
commit 7da2e2dbbc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: CDBD63C43A30BB95
4 zmienionych plików z 26 dodań i 3 usunięć

Wyświetl plik

@ -114,6 +114,7 @@ class TUI(urwid.Frame):
finally:
self.footer.clear_message()
# # FIXME: REMOVE DEBUGGING
# with open("tmp/statuses2.json", "w") as f:
# import json
# json.dump(data, f, indent=4)

Wyświetl plik

@ -23,4 +23,5 @@ PALETTE = [
('italic', 'white', ''),
('yellow', 'yellow', ''),
('yellow_selected', 'yellow', 'dark blue'),
('gray', 'light gray', ''),
]

Wyświetl plik

@ -1,4 +1,16 @@
from datetime import datetime
from collections import namedtuple
Author = namedtuple("Author", ["account", "display_name"])
def get_author(data, instance):
# Show the author, not the persopn who reblogged
status = data["reblog"] or data
acct = status['account']['acct']
acct = acct if "@" in acct else "{}@{}".format(acct, instance)
return Author(acct, status['account']['display_name'])
def parse_datetime(value):
@ -20,6 +32,7 @@ class Status:
self.display_name = self.data["account"]["display_name"]
self.account = self.get_account()
self.created_at = parse_datetime(data["created_at"])
self.author = get_author(data, instance)
self.favourited = data.get("favourited", False)
self.reblogged = data.get("reblogged", False)

Wyświetl plik

@ -60,6 +60,7 @@ class Timeline(urwid.Columns):
def status_activated(self, *args):
"""Called when a status is clicked, or Enter is pressed."""
status = self.get_focused_status()
self._emit("status_activated", [status])
def status_focused(self):
@ -101,9 +102,16 @@ class StatusDetails(urwid.Pile):
return super().__init__(widget_list)
def content_generator(self, status):
if status.display_name:
yield urwid.Text(("green", status.display_name))
yield urwid.Text(("yellow", status.account))
if status.data["reblog"]:
yield urwid.Text([
("gray", "Reblogged by "),
("gray", status.data["account"]["display_name"])
])
yield urwid.Divider("-")
if status.author.display_name:
yield urwid.Text(("green", status.author.display_name))
yield urwid.Text(("yellow", status.author.account))
yield urwid.Divider()
for line in format_content(status.data["content"]):