def make_thread_body(self, thread):
"""
Returns the pile widget that comprises a thread in the index.
"""
button = cute_button(">>", self.thread_load, thread["thread_id"])
title = urwid.Text(thread["title"])
user = self.usermap[thread["author"]]
dateline = [
("default", "by "),
(str(user["color"]), "~%s " % user["user_name"]),
("dim", "@ %s" % self.timestring(thread["created"]))
]
infoline = "%d replies; active %s" % (
thread["reply_count"],
self.timestring(thread["last_mod"], "delta"))
last_author = self.usermap[thread["last_author"]]
pile = [
urwid.Columns([(3, urwid.AttrMap(button, "button", "hover")), title]),
urwid.Text(dateline),
urwid.Text(("dim", infoline)),
urwid.Text([
("dim", "last post by "),
(str(last_author["color"]), "~" + last_author["user_name"])
]),
urwid.AttrMap(urwid.Divider("-"), "dim")
]
if self.prefs["index_spacing"]:
pile.insert(4, urwid.Divider())
pile = urwid.Pile(pile)
pile.thread = thread
return pile
评论列表
文章目录