display.py 文件源码

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

项目:sshchan 作者: einchan 项目源码 文件源码
def make_header(self):
        """Populate the row of board buttons on top."""
        # TODO: make it intelligent so it fits in the terminal window
        # and doesn't depend on arbitrary values from config.
        # Keep count of number of printed boards so we won't print too many.
        i = 0
        longest = 0
        btn_list = []

        for board in sorted(self.config.get_boardlist().keys()):
            # This `if` block should be removed when the function learns to
            # calculate horizontal space required.
            if i >= self.config.max_boards:
                break
            if len(board) > longest:
                longest = len(board)
            btn_list.append(CleanButton(
                "/" + board + "/", self.button_press, board))
            i += 1

        # `longest + 2` to account for slashes.
        return ur.AttrMap(ur.GridFlow(btn_list, longest + 2, 1, 0, "center"),
                          "reverse")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号