1 # Display card output and retreive input
12 def forward(self, stack):
13 if not self.index == len(stack) - 1:
17 if not self.index < 1:
26 def setSide(self, inp):
36 def disp_card(stdscr, stack, headers, obj):
38 side_title = headers[obj.getSide()]
39 stdscr.addstr(side_title + "\n")
40 for i in range(len(side_title)):
42 stdscr.addstr("\n" + str(stack[obj.getIdx()][obj.getSide()]))
44 (mlines, mcols) = stdscr.getmaxyx()
49 stdscr.insch(mlines, mcols, str(obj.getIdx() + 1))
50 stdscr.insch(mlines, mcols+1, '-')
51 if obj.getSide() == 0:
52 stdscr.insch(mlines, mcols+2, '1')
54 stdscr.insch(mlines, mcols+2, '2')
55 stdscr.insch(mlines, mcols+3, '/')
56 stdscr.insch(mlines, mcols+4, str(len(stack)))
61 def get_key(stdscr, stack, headers):
64 disp_card(stdscr, stack, headers, idx)
69 if key == "q" or key == os.linesep:
71 elif key in ["l", "KEY_LEFT"]:
74 disp_card(stdscr, stack, headers, idx)
75 elif key in ["h", "KEY_RIGHT"]:
78 disp_card(stdscr, stack, headers, idx)
79 elif key in ["j", "k", "KEY_UP", "KEY_DOWN"]:
81 disp_card(stdscr, stack, headers, idx)