def on_post(self, button, message):
quotes = self.get_quotes(message)
author = self.usermap[message["author"]]
buttons = []
if not self.window_split:
buttons.append(urwid.Button("Reply", self.reply, message))
if quotes and message["post_id"] != 0:
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"]) \
and not self.window_split:
if message["post_id"] == 0:
msg = "Thread"
else: msg = "Post"
raw = message["send_raw"]
buttons.insert(0, urwid.Button("Delete %s" % msg, self.deletion_dialog, message))
buttons.insert(0, urwid.Button(
"Enable Formatting" if raw else "Disable Formatting",
self.toggle_formatting, 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"])),
**frame_theme()
)
size = self.loop.screen_size
self.loop.widget = urwid.Overlay(
urwid.AttrMap(widget, str(author["color"]*10)),
self.loop.widget,
align=("relative", 50),
valign=("relative", 50),
width=30,
height=len(buttons) + 2
)
评论列表
文章目录