- # Create bar component
- bar_start = "["
- bar_middle = self.stack[self.obj.getIdx()].printStar()
- bar_end = f"] [{self.ntotal()}/{str(len(self.stack))} starred] " + \
- f"[{percent}% (" + \
- str(self.obj.getIdx() + 1).zfill(len(str(len(self.stack)))) + \
- f"/{str(len(self.stack))})] [" + \
- f"{self.headers[self.obj.getSide()]} (" + \
- f"{str(self.obj.getSide() + 1)})] "
+ while True:
+ key = self.win.getkey()
+ if key == "y":
+ break
+ elif key == "n":
+ self.panel.hide()
+ self.outer.get_key()
+
+
+class Help:
+ def __init__(self, outer, mlines=20, mcols=52):
+ """Initialize help screen"""
+ self.outer = outer
+ (self.win, self.panel) = panel_create(mlines, mcols)
+ self.panel.top()
+ self.panel.hide()
+
+ text = [
+ "Welcome to runner. Here are some keybindings",
+ "to get you started:",
+ "",
+ "h, left previous card",
+ "l, right next card",
+ "j, k, up, down flip card",
+ "i, / star card",
+ "0, ^, home go to the start of the deck",
+ "$, end go to the end of the deck",
+ "H, ? open this screen",
+ "m open the control menu",
+ "1, 2, 3 switch views",
+ "",
+ "More information can be found in the man page, or",
+ "by running `lightcards --help`.",
+ "",
+ "Press [H], or [?] to go back.",
+ ]
+
+ self.win.addstr(
+ 1,
+ int(mcols / 2) - 8,
+ "LIGHTCARDS HELP",
+ curses.color_pair(1) + curses.A_BOLD,
+ )
+ self.win.hline(2, 1, curses.ACS_HLINE, mcols)
+
+ for t in enumerate(text):
+ self.win.addstr(t[0] + 3, 1, t[1])
+
+ self.win.box()
+
+ def disp(self):
+ """Display help screen"""
+ (mlines, mcols) = self.outer.win.getmaxyx()
+ self.win.mvwin(int(mlines / 2) - 10, int(mcols / 2) - 25)
+ self.panel.show()