home · contact · privacy
More comments and refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 10 Apr 2019 00:04:59 +0000 (02:04 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 10 Apr 2019 00:04:59 +0000 (02:04 +0200)
new/example_client.py

index 54435460ab1411140fa9c1b011893e392980f6b7..44b0993dbff05d4705946518dee944025192b318 100755 (executable)
@@ -585,9 +585,12 @@ class TUI:
             curses.init_pair(3, curses.COLOR_BLACK, curses.COLOR_BLUE)
             curses.init_pair(4, curses.COLOR_BLACK, curses.COLOR_YELLOW)
 
+        # Basic curses initialization work.
         setup_screen(stdscr)
         curses.curs_set(False)  # hide cursor
         init_colors()
+
+        # With screen initialized, set up widgets with their curses windows.
         edit_widget = TextLineWidget('SEND:', self, (0, 0), (1, 20))
         edit_line_widget = EditWidget(self, (0, 6), (1, 14), ['edit'])
         edit_widget.children += [edit_line_widget]
@@ -605,10 +608,12 @@ class TUI:
                        descriptor_widget, map_widget, inventory_widget,
                        pickable_items_widget]
         popup_widget = PopUpWidget(self, (0, 0), (1, 1), visible=False)
-        write_mode = False
+
+        # Ensure initial window state before loop starts.
         for w in top_widgets:
             w.ensure_freshness(True)
         self.socket.send('GET_GAMESTATE')
+        write_mode = False
         while True:
 
             # Draw screen.