From: Armaan Bhojwani Date: Mon, 1 Feb 2021 17:57:40 +0000 (-0500) Subject: Only cache stack X-Git-Tag: v0.5.0~4 X-Git-Url: https://git.armaanb.net/?p=lightcards.git;a=commitdiff_plain;h=c812ea549b247e92fc32227be419061a94c318a9 Only cache stack Stop caching headers and status --- diff --git a/lightcards/display.py b/lightcards/display.py index 4984058..d0dd9a7 100644 --- a/lightcards/display.py +++ b/lightcards/display.py @@ -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" + diff --git a/lightcards/lightcards.py b/lightcards/lightcards.py index ed1916d..596f896 100644 --- a/lightcards/lightcards.py +++ b/lightcards/lightcards.py @@ -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: