From: Armaan Bhojwani Date: Sun, 31 Jan 2021 22:30:31 +0000 (-0500) Subject: Clean up bar implementation X-Git-Tag: v0.4.0~11 X-Git-Url: https://git.armaanb.net/?p=lightcards.git;a=commitdiff_plain;h=c9afe870b65de0bbfb51a8461216b5cde9b284fb Clean up bar implementation --- diff --git a/lightcards/display.py b/lightcards/display.py index 3f55a56..5257c47 100755 --- a/lightcards/display.py +++ b/lightcards/display.py @@ -38,28 +38,24 @@ class Display(): len(self.stack) * 100)).zfill(3) # Print yellow if starred - self.win.addstr(mlines - 1, 0, "[", curses.color_pair(1)) if self.stack[self.obj.getIdx()].getStar(): - self.win.addstr(self.stack[self.obj.getIdx()].printStar(), - curses.color_pair(3)) + star_color = curses.color_pair(3) else: - self.win.addstr(self.stack[self.obj.getIdx()].printStar(), - curses.color_pair(1)) - - # Put all the info together - self.win.addstr("] [" + - percent + - "% (" + - str(self.obj.getIdx() + - 1).zfill(len(str(len(self.stack)))) + - "/" + - str(len(self.stack)) + - ")]" + - " [" + - self.headers[self.obj.getSide()] + - " (" + - str(self.obj.getSide() + 1) + - ")]", curses.color_pair(1)) + star_color = curses.color_pair(1) + + # Create bar component + bar_start = "[" + bar_middle = self.stack[self.obj.getIdx()].printStar() + bar_end= "] [" + percent + "% (" + \ + str(self.obj.getIdx() + 1).zfill(len(str(len(self.stack)))) + \ + "/" + str(len(self.stack)) + ")] [" + \ + self.headers[self.obj.getSide()] + " (" + \ + str(self.obj.getSide() + 1) + ")]" + + # Put it all togethor + self.win.addstr(mlines - 1, 0, bar_start, curses.color_pair(1)) + self.win.addstr(bar_middle, star_color) + self.win.insstr(bar_end, curses.color_pair(1)) def menu_print(self, string, err=False): self.win.clear()