main.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:bbj 作者: desvox 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号