From dd90247d8c14ff837db878e99c1896a04d90013e Mon Sep 17 00:00:00 2001 From: Blake DeMarcy Date: Sat, 15 Apr 2017 05:28:05 -0500 Subject: [PATCH] restrict on_post actions when the composer is open --- clients/urwid/main.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/clients/urwid/main.py b/clients/urwid/main.py index 20695e3..be559c5 100644 --- a/clients/urwid/main.py +++ b/clients/urwid/main.py @@ -482,16 +482,19 @@ class App(object): def on_post(self, button, message): quotes = self.get_quotes(message) author = self.usermap[message["author"]] - buttons = [ - urwid.Button("Reply", self.reply, message), - ] + buttons = [] + + if not self.window_split: + buttons.append(urwid.Button("Reply", self.reply, message)) if quotes and message["post_id"] != 0: - buttons.insert(1, urwid.Button( + buttons.append(urwid.Button( "View %sQuote" % ("a " if len(quotes) != 1 else ""), self.quote_view_menu, quotes)) - if network.can_edit(message["thread_id"], message["post_id"]): + if network.can_edit(message["thread_id"], message["post_id"]) \ + and not self.window_split: + if message["post_id"] == 0: msg = "Thread" else: msg = "Post" @@ -499,6 +502,9 @@ class App(object): buttons.insert(0, urwid.Button("Delete %s" % msg, self.deletion_dialog, message)) buttons.insert(0, urwid.Button("Edit Post", self.edit_post, message)) + if not buttons: + return + widget = OptionsMenu( urwid.ListBox(urwid.SimpleFocusListWalker(buttons)), title=str(">>%d (%s)" % (message["post_id"], author["user_name"])),