]> git.armaanb.net Git - lightcards.git/commitdiff
Print yellow in the footer if card is starred
authorArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 19:02:30 +0000 (14:02 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 19:02:30 +0000 (14:02 -0500)
lightcards/display.py

index d541a12ae5cd36b65663c962dd73b9b29fe509ad..8e7bba405a4ed3b404bdbd2be88b472529276f51 100755 (executable)
@@ -20,11 +20,15 @@ def disp_bar(stdscr, stack, headers, obj):
     else:
         percent = str(round(obj.getIdx() / (len(stack) - 1) * 100)).zfill(3)
 
+    # Print yellow if starred
+    stdscr.addstr(mlines - 1, 0, "[", curses.color_pair(1))
+    if stack[obj.getIdx()].getStar():
+        stdscr.addstr(stack[obj.getIdx()].printStar(), curses.color_pair(3))
+    else:
+        stdscr.addstr(stack[obj.getIdx()].printStar(), curses.color_pair(1))
+
     # Put all the info together
-    stdscr.insstr(mlines - 1, 0,
-                  "[" +
-                  stack[obj.getIdx()].printStar() +
-                  "] [" +
+    stdscr.addstr("] [" +
                   percent +
                   "% (" +
                   str(obj.getIdx() + 1).zfill(len(str(len(stack)))) +
@@ -167,6 +171,7 @@ def init_disp(stdscr, stack, headers, idx):
     curses.curs_set(0)  # Hide cursor
     curses.init_pair(1, curses.COLOR_CYAN, 0)
     curses.init_pair(2, curses.COLOR_RED, 0)
+    curses.init_pair(3, curses.COLOR_YELLOW, 0)
     get_key(stdscr, stack, headers, idx)