]> git.armaanb.net Git - lightcards.git/commitdiff
Update status bar
authorArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 01:43:44 +0000 (20:43 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 31 Jan 2021 01:43:44 +0000 (20:43 -0500)
lightcards/display.py

index 86740d6421b43f0ef6f2b5a9426216687305fc2b..349d77abbb9417c9b363ea6943c59cf2166ae78e 100755 (executable)
@@ -16,19 +16,20 @@ def disp_card(stdscr, stack, headers, obj):
     stdscr.addstr("\n" + str(stack[obj.getIdx()][obj.getSide()]))
 
     (mlines, mcols) = stdscr.getmaxyx()
-    mlines -= 1
-    mcols -= 5
-
     try:
-        stdscr.insch(mlines, mcols, str(obj.getIdx() + 1))
-        stdscr.insch(mlines, mcols+1, '-')
-        if obj.getSide() == 0:
-            stdscr.insch(mlines, mcols+2, '1')
-        else:
-            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())
+        stdscr.insstr(mlines - 1, 1,
+                      "[" +
+                      stack[obj.getIdx()].getStar() +
+                      "] [" +
+                      str(round(obj.getIdx() / (len(stack) - 1) * 100)).zfill(3) +
+                      "% (" +
+                      str(obj.getIdx() + 1) +
+                      "/" +
+                      str(len(stack)) +
+                      ")]" +
+                      " [" +
+                      headers[obj.getSide()] +
+                      "]")
     except Exception:
         pass