- self.reply_widget, a urwid.Text widget printing self.socket replies
"""
edit_widget = self.EditToSocketWidget(self.socket, 'SEND: ')
- self.reply_widget, a urwid.Text widget printing self.socket replies
"""
edit_widget = self.EditToSocketWidget(self.socket, 'SEND: ')
self.map_widget = self.MapWidget('', wrap='clip')
map_box = urwid.Padding(self.map_widget, width=50)
widget_pile = urwid.Pile([edit_widget, map_box, self.reply_widget])
self.map_widget = self.MapWidget('', wrap='clip')
map_box = urwid.Padding(self.map_widget, width=50)
widget_pile = urwid.Pile([edit_widget, map_box, self.reply_widget])
+ class LogWidget(urwid.Text):
+ """Display client log, newest message on top."""
+
+ def add(self, text):
+ """Add text to (top of) log."""
+ self.set_text(text + '\n' + self.text)
+
- def __init__(self, widget1, widget2, message_container):
- self.widget1 = widget1
- self.widget2 = widget2
+ def __init__(self, log_widget, map_widget, message_container):
+ self.log_widget = log_widget
+ self.map_widget = map_widget
self.message_container = message_container
def handle_input(self, trigger):
self.message_container = message_container
def handle_input(self, trigger):
def mapdraw_command(prefix, func):
n = len(prefix)
if len(msg) > n and msg[:n] == prefix:
def mapdraw_command(prefix, func):
n = len(prefix)
if len(msg) > n and msg[:n] == prefix:
mapdraw_command('POSITION ', 'update_position') or
mapdraw_command('MAP_SIZE ', 'update_map_size'))
except ArgumentError as e:
mapdraw_command('POSITION ', 'update_position') or
mapdraw_command('MAP_SIZE ', 'update_map_size'))
except ArgumentError as e: