def configure_settings_frame(self, pos=None):
"""
Draw `Configure Setting` frame with a index number (`pos`) of the item
selected.
:param pos: Index of selected item in `Configure Setting` frame. The
default value of `pos` is `None`.
:type pos: int or None
.. note:: None of the items in `Configure Setting` frame would be
selected if pos is `None`.
"""
self._stdscr.keypad(1)
screen = self._stdscr.subwin(8, 25, 2, 0)
screen.bkgd(' ', curses.color_pair(4))
# Set local variable
normal = curses.A_NORMAL
select = curses.color_pair(5)
select += curses.A_BOLD
for p, item in enumerate(self.settings):
item_str = item[0].ljust(12)
screen.addstr(3 + p, 2, item_str, select if p == pos else normal)
if p:
choice = "[%s]" % item[2][item[1]]
else:
choice = "[%s]" % item[2][item[1]]["label"]
screen.addstr(3 + p, 15, ''.ljust(10), normal)
screen.addstr(3 + p, 15, choice, select if p == pos else normal)
screen.refresh()
评论列表
文章目录