def enable():
# Initialize curses
global stdscr
global status_pad
global usage_win
global curses_sighandler
global map_track_num
global enabled
global pad_height, pad_width
global had_special
global extra_lines
if enabled:
return
had_special = 0
extra_lines = 2 # top + bottom status lines
if jack.display.discname:
extra_lines = extra_lines + 1
stdscr = initscr()
enabled = 1
jack.term.sig_winch_cache = signal.signal(signal.SIGWINCH, signal.SIG_IGN)
# Turn off echoing of keys, and enter cbreak mode,
# where no buffering is performed on keyboard input
noecho()
cbreak()
# In keypad mode, escape sequences for special keys
# (like the cursor keys) will be interpreted and
# a special value like KEY_LEFT will be returned
stdscr.keypad(1)
stdscr.leaveok(0)
# build the pad
pad_height, pad_width = len(
jack.ripstuff.all_tracks_todo_sorted), jack.ripstuff.max_name_len + 72
status_pad = newpad(pad_height, pad_width)
usage_win = newwin(usage_win_height, usage_win_width, 0, 0)
map_track_num = {}
for i in range(len(jack.ripstuff.all_tracks_todo_sorted)):
map_track_num[jack.ripstuff.all_tracks_todo_sorted[i][NUM]] = i
sig_winch_handler(None, None)
评论列表
文章目录