def _cw_setup_run(cls, app, window):
cls.RUNNING = True
cls.APP = app
height, width = window.getmaxyx()
if width < cls.WIDTH:
raise CursedSizeError('terminal width is %d and window width is '
'%d' % (width, cls.WIDTH))
if height < cls.HEIGHT:
raise CursedSizeError('terminal height is %d and window height '
'is %d' % (height, cls.HEIGHT))
if cls.PAD:
cls.WINDOW = curses.newpad(cls.PAD_HEIGHT, cls.PAD_WIDTH)
else:
cls.WINDOW = window.subwin(cls.HEIGHT, cls.WIDTH, cls.Y, cls.X)
if cls.SCROLL:
cls.WINDOW.scrollok(True)
cls.WINDOW.idlok(1)
if cls.BORDERED:
cls.WINDOW.border()
for attr in cls._CW_WINDOW_FUNCS:
cls._cw_set_window_func(attr)
for attr in cls._CW_SCREEN_FUNCS:
cls._cw_set_screen_func(attr)
for attr in cls._CW_WINDOW_SWAP_FUNCS:
cls._cw_swap_window_func(attr)
for attr in cls._CW_SCREEN_SWAP_FUNCS:
cls._cw_swap_screen_func(attr)
评论列表
文章目录