1 # Display card output and retreive input
11 def forward(self, stack):
12 if not self.index == len(stack) - 1:
16 if not self.index < 1:
25 def setSide(self, inp):
35 def disp_card(stdscr, stack, headers, obj):
37 side_title = headers[obj.getSide()]
38 stdscr.addstr(side_title + "\n")
39 for i in range(len(side_title)):
41 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)))
60 def get_key(stdscr, stack, headers):
63 disp_card(stdscr, stack, headers, idx)
68 if key == "q" or key == os.linesep:
73 disp_card(stdscr, stack, headers, idx)
77 disp_card(stdscr, stack, headers, idx)
78 if key == "l" or key == "h":
80 disp_card(stdscr, stack, headers, idx)