]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/display.py
Clean up code
[lightcards.git] / lightcards / display.py
index 59a5bca194a0a8500728a477d34d00ba2190e429..0ce321fcb1727105bd865b5d5f9ac8a1517b7f6b 100755 (executable)
@@ -3,6 +3,7 @@
 
 import curses
 from random import shuffle
+import sys
 
 
 def disp_bar(stdscr, stack, headers, obj):
@@ -29,6 +30,7 @@ def disp_bar(stdscr, stack, headers, obj):
 
 
 def disp_menu(stdscr, stack, headers, idx):
+    stdscr.clear()
     curses.init_pair(1, curses.COLOR_CYAN, 0)
     curses.init_pair(2, curses.COLOR_RED, 0)
     stdscr.addstr("Good job, you've completed a round!\n\n",
@@ -42,7 +44,7 @@ def disp_menu(stdscr, stack, headers, idx):
     while True:
         key = stdscr.getkey()
         if key == "q":
-            exit(0)
+            sys.exit(0)
         elif key == "r":
             idx.setIdx(0)
             get_key(stdscr, stack, headers, idx)
@@ -78,9 +80,9 @@ def disp_card(stdscr, stack, headers, obj):
         disp_menu(stdscr, stack, headers, obj)
     else:
         if obj.getSide() == 0:
-            top = headers[obj.getSide()] + " " + str(obj.getIdx() + 1) + "\n"
+            top = headers[obj.getSide()] + "; " + str(obj.getIdx() + 1) + "\n"
         else:
-            top = headers[obj.getSide()] + " " + str(obj.getIdx() + 1) + \
+            top = headers[obj.getSide()] + "; " + str(obj.getIdx() + 1) + \
                 "; " + str(stack[obj.getIdx()][0]) + "\n"
 
         stdscr.addstr(top, curses.A_BOLD)
@@ -101,7 +103,7 @@ def get_key(stdscr, stack, headers, idx):
     while True:
         key = stdscr.getkey()
         if key == "q":
-            exit(0)
+            sys.exit(0)
         elif key in ["l", "KEY_LEFT"]:
             idx.forward(stack)
             idx.setSide(0)