]> git.armaanb.net Git - lightcards.git/commitdiff
Remove main_win
authorArmaan Bhojwani <me@armaanb.net>
Fri, 12 Feb 2021 14:07:53 +0000 (09:07 -0500)
committerArmaan Bhojwani <me@armaanb.net>
Fri, 12 Feb 2021 14:07:53 +0000 (09:07 -0500)
lightcards/display.py

index aa5beed58c70c7b4a14a4b86ed9c8648ffde9eb1..5dc354ed02cc46fea170ce846dbdde2f57568a22 100644 (file)
@@ -211,7 +211,7 @@ class Display:
         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.main_panel = curses.panel.new_panel(self.win)
         self.menu_obj = Menu(self)
         self.help_obj = Help(self)
 
@@ -221,16 +221,16 @@ class Display:
         (mlines, mcols) = self.win.getmaxyx()
 
         while mlines < 24 or mcols < 60:
-            self.main_win.clear()
-            self.main_win.addstr(
+            self.win.clear()
+            self.win.addstr(
                 0,
                 0,
                 textwrap.fill(
                     "Terminal too small! Min size 60x24", width=mcols
                 ),
             )
-            self.main_win.redrawwin()
-            self.main_win.refresh()
+            self.win.redrawwin()
+            self.win.refresh()
             (mlines, mcols) = self.win.getmaxyx()
             time.sleep(0.1)
         else:
@@ -313,7 +313,7 @@ class Display:
         """
         (mlines, mcols) = self.win.getmaxyx()
         self.main_panel.bottom()
-        self.main_win.clear()
+        self.win.clear()
         # If on the back of the card, show the content of the front side in
         # the header
         num_done = str(self.obj.index + 1).zfill(len(str(len(self.stack))))
@@ -332,7 +332,7 @@ class Display:
         if mcols > 80:
             header_width = 80
 
-        self.main_win.addstr(
+        self.win.addstr(
             0,
             0,
             textwrap.shorten(top, width=header_width, placeholder="…"),
@@ -340,10 +340,10 @@ class Display:
         )
 
         # Add horizontal line
-        self.main_win.hline(1, 0, curses.ACS_HLINE, mcols)
+        self.win.hline(1, 0, curses.ACS_HLINE, mcols)
 
         # Show current side
-        self.main_win.addstr(
+        self.win.addstr(
             2,
             0,
             textwrap.fill(