X-Git-Url: https://git.armaanb.net/?a=blobdiff_plain;f=lightcards%2Fdisplay.py;h=bce533a690e7054ebc75446f3c0de1161685888c;hb=4d92363ae6e59e08aab84b017356cb70aae831eb;hp=8e19d3c49f57fd9c7ed69dd5ab21ff39475de03f;hpb=fc06161aeda6cfe95495c6c52d63c56c4942f889;p=lightcards.git diff --git a/lightcards/display.py b/lightcards/display.py index 8e19d3c..bce533a 100644 --- a/lightcards/display.py +++ b/lightcards/display.py @@ -132,6 +132,7 @@ class Menu: curses.color_pair(1) + curses.A_BOLD, ) self.win.hline(2, 1, curses.ACS_HLINE, mcols) + env = os.environ.get("EDITOR", "$EDITOR")[:15] text = [ "[y]: reset stack to original state", "[a]: alphabetize stack", @@ -140,8 +141,7 @@ class Menu: "[u]: unstar all", "[d]: star all", "[s]: update stack to include starred only", - "[e]: open the input file in $EDITOR", - "", + f"[e]: open the input file in {env}" "", "[r]: restart", "[m]: close menu", ] @@ -151,6 +151,10 @@ class Menu: self.win.box() + def clear_msg(self): + for i in range(42): + self.win.addch(15, i + 1, " ") + def menu_print(self, string, err=False): """Print messages on the menu screen""" if err: @@ -189,6 +193,7 @@ class Menu: shuffle(self.outer.stack) self.menu_print("Stack shuffled!") elif key == "e": + progress.dump(self.outer.stack, runner.get_orig()[1]) curses.endwin() os.system(f"$EDITOR {self.outer.input_file}"), (self.outer.headers, self.outer.stack) = parse.parse_html( @@ -220,8 +225,7 @@ class Menu: Display a menu offering multiple options on how to manipulate the deck and to continue """ - for i in range(42): - self.win.addch(14, i + 1, " ") + self.clear_msg() (mlines, mcols) = self.outer.win.getmaxyx() self.win.mvwin(int(mlines / 2) - 8, int(mcols / 2) - 22) @@ -470,7 +474,7 @@ class Display: while True: self.check_size() key = self.win.getkey() - if key == "q": + if key == self.config["quit_key"]: self.leave() elif key in self.config["card_prev"]: self.obj.back()