Pass the TUI object to Timeline in constructor

pull/342/head
Ivan Habunek 2023-03-15 09:43:54 +01:00
rodzic 71a2520198
commit 6047a51c4f
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F5F0623FF5EBCB3D
2 zmienionych plików z 6 dodań i 3 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(name, statuses, self.can_translate, self.followed_tags, self.followed_accounts) timeline = Timeline(self, name, statuses, self.can_translate, self.followed_tags, self.followed_accounts)
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,7 +289,7 @@ class TUI(urwid.Frame):
statuses = ancestors + [status] + descendants statuses = ancestors + [status] + descendants
focus = len(ancestors) focus = len(ancestors)
timeline = Timeline("thread", statuses, self.can_translate, timeline = Timeline(self, "thread", statuses, self.can_translate,
self.followed_tags, self.followed_accounts, 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)

Wyświetl plik

@ -9,9 +9,10 @@ from .entities import Status
from .scroll import Scrollable, ScrollBar from .scroll import Scrollable, ScrollBar
from .utils import highlight_hashtags, parse_datetime, highlight_keys from .utils import highlight_hashtags, parse_datetime, highlight_keys
from .widgets import SelectableText, SelectableColumns from .widgets import SelectableText, SelectableColumns
from toot.tui import app
from toot.tui.utils import time_ago
from toot.utils import format_content from toot.utils import format_content
from toot.utils.language import language_name from toot.utils.language import language_name
from toot.tui.utils import time_ago
logger = logging.getLogger("toot") logger = logging.getLogger("toot")
@ -45,6 +46,7 @@ class Timeline(urwid.Columns):
] ]
def __init__(self, def __init__(self,
tui: "app.TUI",
name, name,
statuses, statuses,
can_translate, can_translate,
@ -53,6 +55,7 @@ class Timeline(urwid.Columns):
focus=0, focus=0,
is_thread=False): is_thread=False):
self.tui = tui
self.name = name self.name = name
self.is_thread = is_thread self.is_thread = is_thread
self.statuses = statuses self.statuses = statuses