Pass the TUI object to Timeline in constructor

This commit is contained in:
Ivan Habunek 2023-03-15 09:43:54 +01:00
parent 71a2520198
commit 6047a51c4f
No known key found for this signature in database
GPG key ID: F5F0623FF5EBCB3D
2 changed files with 6 additions and 3 deletions

View file

@ -260,7 +260,7 @@ class TUI(urwid.Frame):
self.loop.set_alarm_in(5, lambda *args: self.footer.clear_message())
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)
urwid.connect_signal(timeline, "next", _next)
@ -289,7 +289,7 @@ class TUI(urwid.Frame):
statuses = ancestors + [status] + descendants
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.connect_default_timeline_signals(timeline)

View file

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