]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/lightcards.py
Change menu text based on how the menu was opened
[lightcards.git] / lightcards / lightcards.py
index a996ccc8a46ab9aa315ab01ab4b287534bdbedca..768ac6852a14eb9d18a9c2960125db0ced324b2f 100644 (file)
@@ -25,6 +25,7 @@ def parse_args():
     parser.add_argument("-p", "--purge",
                         action='store_true',
                         help="don't check cached info before starting")
+    # TODO: don't require input file when using  -P
     parser.add_argument("-P", "--purge-all",
                         action='store_true',
                         help="don't check cached info before starting")
@@ -42,28 +43,23 @@ def parse_args():
 
 def show(args, stack, headers):
     """
-    Manipulate deck according to passed arguments, and send it to the display
-    functions
+    Get objects from cache, manipulate deck according to passed arguments, and
+    send it to the display functions
     """
+    # Purge caches if asked
     if args.purge:
         progress.purge(stack)
     if args.purge_all:
         progress.purge_all()
 
-    ida = progress.dive("status", stack)
-    if ida and not args.purge:
-        idx = ida
+    # Check for caches
+    ida = progress.dive(stack)
+    if ida:
+        (idx, stack, headers) = ida
     else:
         idx = Status()
 
-    stackb = progress.dive("stack", stack)
-    if stackb and not args.purge:
-        stack = stackb
-
-    headerb = progress.dive("headers", stack)
-    if headerb and not args.purge:
-        headers = headerb
-
+    # Manipulate deck
     if args.flip:
         for x in stack:
             x[0], x[1] = x[1], x[0]
@@ -73,6 +69,7 @@ def show(args, stack, headers):
     if args.reverse:
         stack.reverse()
 
+    # Send to display
     win = Display(stack, headers, idx)
     wrapper(win.run)