def _start_ui(self, stdscr):
"""TODO docs"""
rogue_height = 26
rogue_width = 84
# using a pad instead of the default win, it's safer
self.stdscr = curses.newpad(rogue_height, rogue_width)
self.stdscr.nodelay(True)
curses.curs_set(False)
self.draw_from_rogue()
minlogsize = 4
if curses.LINES - 1 >= rogue_height + minlogsize:
# there's enough space to show the logs
self.logpad = curses.newpad(curses.LINES - 1, curses.COLS - 1)
while True:
if self.timer_callback:
self.timer_callback()
time.sleep(self.sleep_time)
if self.keypress_callback:
try:
key = self.stdscr.getkey()
event = Event()
event.char = key
self.keypress_callback(event)
except curses.error:
pass
评论列表
文章目录