1 # Display card output and retreive input
7 from .deck import Status
10 def disp_card(stdscr, stack, headers, obj):
12 side_title = headers[obj.getSide()]
13 stdscr.addstr(side_title + "\n")
14 for i in range(len(side_title)):
16 stdscr.addstr("\n" + str(stack[obj.getIdx()][obj.getSide()]))
18 (mlines, mcols) = stdscr.getmaxyx()
20 stdscr.insstr(mlines - 1, 1,
22 stack[obj.getIdx()].getStar() +
24 str(round(obj.getIdx() / (len(stack) - 1) * 100)).zfill(3) +
26 str(obj.getIdx() + 1) +
31 headers[obj.getSide()] +
37 def get_key(stdscr, stack, headers):
40 disp_card(stdscr, stack, headers, idx)
45 if key == "q" or key == os.linesep:
47 elif key in ["l", "KEY_LEFT"]:
50 disp_card(stdscr, stack, headers, idx)
51 elif key in ["h", "KEY_RIGHT"]:
54 disp_card(stdscr, stack, headers, idx)
55 elif key in ["j", "k", "KEY_UP", "KEY_DOWN"]:
57 disp_card(stdscr, stack, headers, idx)
58 elif key in ["i", "/"]:
59 stack[idx.getIdx()].toggleStar()
60 disp_card(stdscr, stack, headers, idx)