+ self.outer.obj.index = 0
+ self.outer.get_key()
+
+ def disp(self):
+ """
+ Display a menu offering multiple options on how to manipulate the deck
+ and to continue
+ """
+ (mlines, mcols) = self.outer.win.getmaxyx()
+ self.win.mvwin(int(mlines / 2) - 9, int(mcols / 2) - 22)
+ self.panel.show()
+ self.outer.update_panels()
+
+ self.menu_grab()
+
+
+class Display:
+ def __init__(self, stack, headers, obj):
+ self.stack = stack
+ self.headers = headers
+ self.obj = obj
+
+ def run(self, stdscr):
+ """Set important options that require stdscr before starting"""
+ self.win = stdscr
+ (mlines, mcols) = self.win.getmaxyx()
+ curses.curs_set(0) # Hide cursor
+ curses.use_default_colors() # Allow transparency
+ curses.init_pair(1, curses.COLOR_CYAN, -1)
+ curses.init_pair(2, curses.COLOR_RED, -1)
+ curses.init_pair(3, curses.COLOR_YELLOW, -1)
+
+ (self.main_win, self.main_panel) = panel_create(mlines, mcols)
+ self.menu_obj = Menu(self)
+ self.help_obj = Help(self)
+
+ self.get_key()
+
+ def check_size(self):
+ (mlines, mcols) = self.win.getmaxyx()
+
+ while mlines < 24 or mcols < 60:
+ self.main_win.clear()
+ self.main_win.addstr(
+ 0,
+ 0,
+ textwrap.fill(
+ "Terminal too small! Min size 60x24", width=mcols
+ ),
+ )
+ self.main_win.redrawwin()
+ self.main_win.refresh()
+ (mlines, mcols) = self.win.getmaxyx()
+ time.sleep(0.1)
+ else:
+ self.disp_card()
+
+ def update_panels(self):
+ """Update panel and window contents"""
+ curses.panel.update_panels()
+ self.win.refresh()