mirror of
https://github.com/ihabunek/toot.git
synced 2024-09-22 04:25:55 -04:00
Added personal timeline, which is your own timeline of posts
Fixes issue #354
This commit is contained in:
parent
e55474158a
commit
f7ba208d3b
@ -6,7 +6,6 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
from toot import api, config, __version__
|
||||
from toot.console import get_default_visibility
|
||||
from toot.exceptions import ApiError
|
||||
from toot.commands import find_account
|
||||
|
||||
from .compose import StatusComposer
|
||||
from .constants import PALETTE
|
||||
@ -305,7 +304,7 @@ class TUI(urwid.Frame):
|
||||
def _load_accounts():
|
||||
try:
|
||||
acct = f'@{self.user.username}@{self.user.instance}'
|
||||
self.account = find_account(self.app, self.user, acct)
|
||||
self.account = api.find_account(self.app, self.user, acct)
|
||||
return api.following(self.app, self.user, self.account["id"])
|
||||
except ApiError:
|
||||
# not supported by all Mastodon servers so fail silently if necessary
|
||||
@ -411,6 +410,8 @@ class TUI(urwid.Frame):
|
||||
lambda x, local: self.goto_notifications())
|
||||
urwid.connect_signal(menu, "conversation_timeline",
|
||||
lambda x, local: self.goto_conversations())
|
||||
urwid.connect_signal(menu, "personal_timeline",
|
||||
lambda x, local: self.goto_personal_timeline())
|
||||
urwid.connect_signal(menu, "hashtag_timeline",
|
||||
lambda x, tag, local: self.goto_tag_timeline(tag, local=local))
|
||||
urwid.connect_signal(menu, "list_timeline",
|
||||
@ -418,7 +419,7 @@ class TUI(urwid.Frame):
|
||||
|
||||
self.open_overlay(menu, title="Go to", options=dict(
|
||||
align="center", width=("relative", 60),
|
||||
valign="middle", height=17 + len(user_timelines) + len(user_lists),
|
||||
valign="middle", height=18 + len(user_timelines) + len(user_lists),
|
||||
))
|
||||
|
||||
def show_help(self):
|
||||
@ -472,6 +473,14 @@ class TUI(urwid.Frame):
|
||||
)
|
||||
promise.add_done_callback(lambda *args: self.close_overlay())
|
||||
|
||||
def goto_personal_timeline(self):
|
||||
account_name = f"{self.user.username}@{self.user.instance}"
|
||||
|
||||
self.timeline_generator = api.account_timeline_generator(
|
||||
self.app, self.user, account_name, reblogs=True, limit=40)
|
||||
promise = self.async_load_timeline(is_initial=True, timeline_name=f"personal {account_name}")
|
||||
promise.add_done_callback(lambda *args: self.close_overlay())
|
||||
|
||||
def goto_list_timeline(self, list_item):
|
||||
self.timeline_generator = api.timeline_list_generator(
|
||||
self.app, self.user, list_item['id'], limit=40)
|
||||
|
@ -102,6 +102,7 @@ class GotoMenu(urwid.ListBox):
|
||||
"bookmark_timeline",
|
||||
"notification_timeline",
|
||||
"conversation_timeline",
|
||||
"personal_timeline",
|
||||
"list_timeline",
|
||||
]
|
||||
|
||||
@ -126,6 +127,9 @@ class GotoMenu(urwid.ListBox):
|
||||
def _global_public(button):
|
||||
self._emit("public_timeline", False)
|
||||
|
||||
def _personal(button):
|
||||
self._emit("personal_timeline", False)
|
||||
|
||||
def _bookmarks(button):
|
||||
self._emit("bookmark_timeline", False)
|
||||
|
||||
@ -156,6 +160,7 @@ class GotoMenu(urwid.ListBox):
|
||||
yield Button("Home timeline", on_press=_home)
|
||||
yield Button("Local public timeline", on_press=_local_public)
|
||||
yield Button("Global public timeline", on_press=_global_public)
|
||||
yield Button("Personal timeline", on_press=_personal)
|
||||
yield Button("Bookmarks", on_press=_bookmarks)
|
||||
yield Button("Notifications", on_press=_notifications)
|
||||
yield Button("Conversations", on_press=_conversations)
|
||||
|
Loading…
Reference in New Issue
Block a user