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")
评论列表
文章目录