Display the statusbar at the bottom of the screen with progress, star
status, and card side.
"""
- (mlines, _) = self.win.getmaxyx()
+ (mlines, mcols) = self.win.getmaxyx()
# Calculate percent done
if len(self.stack) <= 1:
str(self.obj.getSide() + 1) + ")]"
# Put it all togethor
+ self.win.hline(mlines - 2, 0, 0, mcols)
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 wrap_width(self):
(_, mcols) = self.win.getmaxyx()
- wrap_width = mcols
- if mcols > 80:
+ wrap_width = mcols - 20
+ if wrap_width > 80:
wrap_width = 80
return wrap_width
self.stack[self.obj.getIdx()][self.obj.getSide()],
width=self.wrap_width()))
self.disp_bar()
+ self.disp_sidebar()
def disp_help(self):
"""Display help screen"""
elif key == "e":
(self.headers, self.stack) = lightcards.reparse()
self.get_key()
+
+ def disp_sidebar(self):
+ (mlines, mcols) = self.win.getmaxyx()
+ self.win.addstr(0, mcols - 16, "STARRED CARDS",
+ curses.color_pair(3) + curses.A_BOLD)
+ self.win.vline(0, mcols - 20, 0, mlines)
+ self.win.hline(1, mcols - 19, 0, mlines)
+
+ total = [card for card in self.stack if card.getStar()]
+ ntotal = len(total)
+
+ i = 0
+ for card in self.stack:
+ if i > mlines - 6:
+ self.win.addstr(2 + i, mcols - 19, f"... ({ntotal - i} more)")
+ break
+ elif card.getStar():
+ term = card[0]
+ if len(card[0]) > 18:
+ term = card[0][:18] + "…"
+ self.win.addstr(2 + i, mcols - 19, term)
+
+ i += 1
+
+ if i == 0:
+ self.win.addstr(2, mcols - 19, "None starred")
+
+ self.win.addstr(mlines - 1, mcols - 19, f"{ntotal}/{str(len(self.stack))}")