restrict on_post actions when the composer is open

This commit is contained in:
Blake DeMarcy 2017-04-15 05:28:05 -05:00
parent 2a2a9e8762
commit dd90247d8c
1 changed files with 11 additions and 5 deletions

View File

@ -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"])),