return self.index
-def disp_card(stdscr, stack, obj):
+def disp_card(stdscr, stack, headers, obj):
stdscr.clear()
- stdscr.addstr(str(stack[obj.getIdx()][obj.getSide()]))
+ side_title = headers[obj.getSide()]
+ stdscr.addstr(side_title + "\n")
+ for i in range(len(side_title)):
+ stdscr.addstr("=")
+ stdscr.addstr("\n" + str(stack[obj.getIdx()][obj.getSide()]))
-def get_key(stdscr, stack):
+def get_key(stdscr, stack, headers):
idx = Status()
- disp_card(stdscr, stack, idx)
+ disp_card(stdscr, stack, headers, idx)
while True:
key = stdscr.getkey()
if key == "j":
idx.forward(stack)
idx.setSide(0)
- disp_card(stdscr, stack, idx)
+ disp_card(stdscr, stack, headers, idx)
if key == "k":
idx.back()
idx.setSide(0)
- disp_card(stdscr, stack, idx)
+ disp_card(stdscr, stack, headers, idx)
if key == "l" or key == "h":
idx.flip()
- disp_card(stdscr, stack, idx)
+ disp_card(stdscr, stack, headers, idx)
except Exception:
pass
return parser.parse_args()
-def show(stack):
- wrapper(display.get_key, stack)
+def show(stack, headers):
+ wrapper(display.get_key, stack, headers)
def main():
headers = parse.parse_html(parse.md2html(args.inp[0]))[0]
stack = parse.parse_html(parse.md2html(args.inp[0]))[1]
- show(stack)
+ show(stack, headers)
if __name__ == "__main__":