From: Simon Tatham Date: Sun, 17 Dec 2023 11:39:12 +0000 (+0000) Subject: Option to view a post by its numeric id. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=bcd4992a04fecc3ff3839e6b95e68fa34f9ec277;p=mastodonochrome.git Option to view a post by its numeric id. --- diff --git a/cursesclient.py b/cursesclient.py index 4b76ee3..b970312 100644 --- a/cursesclient.py +++ b/cursesclient.py @@ -352,6 +352,10 @@ class MainMenu(Menu): '#', text.ColouredString("Timeline for a #hashtag", " K "))) self.items.append(text.BlankLine()) + self.items.append(text.MenuKeypressLine( + 'I', text.ColouredString("View a post by its ID", + " K "))) + self.items.append(text.BlankLine()) self.items.append(text.MenuKeypressLine( 'C', text.ColouredString("Compose a post", "K "))) @@ -383,6 +387,10 @@ class MainMenu(Menu): self.push_to(BottomLinePrompt( self.cc, self.got_hashtag_to_view, "View feed for hashtag: ")) + elif ch in {'i', 'I'}: + self.push_to(BottomLinePrompt( + self.cc, self.got_post_id_to_view, + "View post with id: ")) else: return super().handle_key(ch) @@ -396,6 +404,16 @@ class MainMenu(Menu): f"Posts mentioning hashtag #{tag}", 'H') self.push_to(StatusFile(self.cc, feed, title)) + def got_post_id_to_view(self, post_id): + post_id = post_id.strip() + if post_id == "": + return + + try: + self.push_to(StatusInfoFile(self.cc, post_id)) + except client.HTTPError: + curses.beep() + class EscMenu(Menu): def __init__(self, cc): super().__init__(cc)