]> git.armaanb.net Git - lightcards.git/blobdiff - lightcards/display.py
Add ability to star cards
[lightcards.git] / lightcards / display.py
index f3e8b50b87553c474bb7bdca21bbeabf64288289..86740d6421b43f0ef6f2b5a9426216687305fc2b 100755 (executable)
@@ -4,33 +4,7 @@
 import curses
 import os
 
-
-class Status():
-    index = 0
-    side = 0
-
-    def forward(self, stack):
-        if not self.index == len(stack) - 1:
-            self.index += 1
-
-    def back(self):
-        if not self.index < 1:
-            self.index -= 1
-
-    def flip(self):
-        if self.side == 0:
-            self.side = 1
-        else:
-            self.side = 0
-
-    def setSide(self, inp):
-        self.side = inp
-
-    def getSide(self):
-        return self.side
-
-    def getIdx(self):
-        return self.index
+from .deck import Status
 
 
 def disp_card(stdscr, stack, headers, obj):
@@ -54,6 +28,7 @@ def disp_card(stdscr, stack, headers, obj):
             stdscr.insch(mlines, mcols+2, '2')
         stdscr.insch(mlines, mcols+3, '/')
         stdscr.insch(mlines, mcols+4, str(len(stack)))
+        stdscr.insstr(mlines, 1, stack[obj.getIdx()].getStar())
     except Exception:
         pass
 
@@ -79,5 +54,8 @@ def get_key(stdscr, stack, headers):
             elif key in ["j", "k", "KEY_UP", "KEY_DOWN"]:
                 idx.flip()
                 disp_card(stdscr, stack, headers, idx)
+            elif key in ["i", "/"]:
+                stack[idx.getIdx()].toggleStar()
+                disp_card(stdscr, stack, headers, idx)
         except Exception:
             pass