def __init__(self, items, parent_window, which_menu="left"):
self.which_menu = which_menu
self.window = parent_window.derwin(1, 0)
self.window.keypad(1)
curses.noecho()
curses.raw()
self.position = 0
self.items = items
if self.which_menu == 'left':
nothing = namedtuple("Nothing", 'message, action_str', 'article', 'formatted')
nothing.message = "Nothing"
nothing.action_str = "Do"
nothing.article = ""
nothing.formatted = "Nothing"
self.items.insert(0, nothing)
self.detailwindow = None
code = locale.getpreferredencoding()
self.arrow_up = (3*'\u2191').encode(code)
self.arrow_down = (3*'\u2193').encode(code)
self.first_item_index = self.position
self.last_item_index = min(self.LIST_SIZE, len(self.items))
self.next_window = None
self.has_focus = False
self.item_message = '{1.action_str} {1.article} {1.message}'
评论列表
文章目录