Remove no longer needed args to Timeline

Read them directly from TUI
pull/342/head
Ivan Habunek 2023-03-15 09:54:18 +01:00
rodzic 6047a51c4f
commit 45fd2901de
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F5F0623FF5EBCB3D
2 zmienionych plików z 6 dodań i 13 usunięć

Wyświetl plik

@ -260,7 +260,7 @@ class TUI(urwid.Frame):
self.loop.set_alarm_in(5, lambda *args: self.footer.clear_message()) self.loop.set_alarm_in(5, lambda *args: self.footer.clear_message())
config.save_config(self.config) config.save_config(self.config)
timeline = Timeline(self, name, statuses, self.can_translate, self.followed_tags, self.followed_accounts) timeline = Timeline(self, name, statuses)
self.connect_default_timeline_signals(timeline) self.connect_default_timeline_signals(timeline)
urwid.connect_signal(timeline, "next", _next) urwid.connect_signal(timeline, "next", _next)
@ -289,8 +289,7 @@ class TUI(urwid.Frame):
statuses = ancestors + [status] + descendants statuses = ancestors + [status] + descendants
focus = len(ancestors) focus = len(ancestors)
timeline = Timeline(self, "thread", statuses, self.can_translate, timeline = Timeline(self, "thread", statuses, focus=focus, is_thread=True)
self.followed_tags, self.followed_accounts, focus, is_thread=True)
self.connect_default_timeline_signals(timeline) self.connect_default_timeline_signals(timeline)
urwid.connect_signal(timeline, "close", _close) urwid.connect_signal(timeline, "close", _close)

Wyświetl plik

@ -49,9 +49,6 @@ class Timeline(urwid.Columns):
tui: "app.TUI", tui: "app.TUI",
name, name,
statuses, statuses,
can_translate,
followed_tags=[],
followed_accounts=[],
focus=0, focus=0,
is_thread=False): is_thread=False):
@ -59,10 +56,7 @@ class Timeline(urwid.Columns):
self.name = name self.name = name
self.is_thread = is_thread self.is_thread = is_thread
self.statuses = statuses self.statuses = statuses
self.can_translate = can_translate
self.status_list = self.build_status_list(statuses, focus=focus) self.status_list = self.build_status_list(statuses, focus=focus)
self.followed_tags = followed_tags
self.followed_accounts = followed_accounts
try: try:
focused_status = statuses[focus] focused_status = statuses[focus]
@ -132,7 +126,7 @@ class Timeline(urwid.Columns):
"[P]oll" if poll and not poll["expired"] else "", "[P]oll" if poll and not poll["expired"] else "",
"So[u]rce", "So[u]rce",
"[Z]oom", "[Z]oom",
"Tra[n]slate" if self.can_translate else "", "Tra[n]slate" if self.tui.can_translate else "",
"Cop[y]", "Cop[y]",
"[H]elp", "[H]elp",
] ]
@ -242,7 +236,7 @@ class Timeline(urwid.Columns):
return return
if key in ("n", "N"): if key in ("n", "N"):
if self.can_translate: if self.tui.can_translate:
self._emit("translate", status) self._emit("translate", status)
return return
@ -331,8 +325,8 @@ class Timeline(urwid.Columns):
class StatusDetails(urwid.Pile): class StatusDetails(urwid.Pile):
def __init__(self, timeline: Timeline, status: Optional[Status]): def __init__(self, timeline: Timeline, status: Optional[Status]):
self.status = status self.status = status
self.followed_tags = timeline.followed_tags self.followed_tags = timeline.tui.followed_tags
self.followed_accounts = timeline.followed_accounts self.followed_accounts = timeline.tui.followed_accounts
reblogged_by = status.author if status and status.reblog else None reblogged_by = status.author if status and status.reblog else None
widget_list = list(self.content_generator(status.original, reblogged_by) widget_list = list(self.content_generator(status.original, reblogged_by)