]> git.armaanb.net Git - lightcards.git/commitdiff
Only cache stack
authorArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 17:57:40 +0000 (12:57 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Mon, 1 Feb 2021 17:57:40 +0000 (12:57 -0500)
Stop caching headers and status

lightcards/display.py
lightcards/lightcards.py

index 49840583eb27c1987a68bd0df13db85dfc07f3c6..d0dd9a779b2881f19c897b1d8dad153ce362fb26 100644 (file)
@@ -27,7 +27,7 @@ class Display():
         if self.obj.getIdx() == len(self.stack):
             self.obj.setIdx(0)
 
-        progress.dump((self.obj, self.stack, self.headers), self.stack)
+        progress.dump(self.stack, lightcards.get_orig())
         sys.exit(0)
 
     def ntotal(self):
@@ -92,6 +92,9 @@ class Display():
             elif key == "y":
                 self.stack = lightcards.get_orig()[1]
                 self.menu_print("Stack reset!")
+            elif key == "a":
+                self.stack.sort()
+                self.menu_print("Stack alphabetized!")
             elif key == "u":
                 [x.unStar() for x in self.stack]
                 self.menu_print("All unstarred!")
@@ -146,6 +149,7 @@ class Display():
                         curses.A_BOLD)
         self.win.hline(1, 0, curses.ACS_HLINE, 15)
         self.win.addstr(2, 0, "[y]: reset stack to original state\n" +
+                        "[a]: alphabetize stack\n" +
                         "[z]: shuffle stack\n" +
                         "[f]: flip all cards in stack\n" +
                         "[t]: reverse stack order\n" +
index ed1916d371ae9d833af41435772c5ed2680c8a70..596f89644baffd6ad1b614db52b2e982cfb1e0a5 100644 (file)
@@ -56,11 +56,10 @@ def show(args, stack, headers):
         progress.purge_all()
 
     # Check for caches
-    ida = progress.dive(stack)
-    if ida:
-        (idx, stack, headers) = ida
-    else:
-        idx = Status()
+    idx = Status()
+    cache = progress.dive(get_orig())
+    if cache:
+        (stack) = cache
 
     # Manipulate deck
     if args.shuffle: