comparison frontends/src/primitivus/chat.py @ 2075:4f3ebf786fbc

quick_frontend, primitivus (chat): renamed updated to update, using a dict as argument + fixed Primitivus group chat
author Goffi <goffi@goffi.org>
date Thu, 15 Sep 2016 21:58:35 +0200
parents 7834743705f0
children 7df0a77a5064
comparison
equal deleted inserted replaced
2074:db5cda61740f 2075:4f3ebf786fbc
137 markup.append(msg) 137 markup.append(msg)
138 138
139 return markup 139 return markup
140 140
141 # events 141 # events
142 def updated(self, attributes): 142 def update(self, update_dict=None):
143 """update all the linked message widgets
144
145 @param update_dict(dict, None): key=attribute updated value=new_value
146 """
143 self.redraw() 147 self.redraw()
144 148
145 @total_ordering 149 @total_ordering
146 class OccupantWidget(urwid.WidgetWrap): 150 class OccupantWidget(urwid.WidgetWrap):
147 151
210 if o.state is not None: 214 if o.state is not None:
211 markup.append(u' {}'.format(C.CHAT_STATE_ICON[o.state])) 215 markup.append(u' {}'.format(C.CHAT_STATE_ICON[o.state]))
212 return markup 216 return markup
213 217
214 # events 218 # events
215 def updated(self, attributes): 219 def update(self, update_dict=None):
216 self.redraw() 220 self.redraw()
217 221
218 222
219 class OccupantsWidget(urwid.WidgetWrap): 223 class OccupantsWidget(urwid.WidgetWrap):
220 224
256 self.parent.host.redraw() # FIXME: should not be necessary 260 self.parent.host.redraw() # FIXME: should not be necessary
257 261
258 262
259 class Chat(PrimitivusWidget, quick_chat.QuickChat): 263 class Chat(PrimitivusWidget, quick_chat.QuickChat):
260 264
261 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, occupants=None, subject=None, profiles=None): 265 def __init__(self, host, target, type_=C.CHAT_ONE2ONE, nick=None, occupants=None, subject=None, profiles=None):
262 quick_chat.QuickChat.__init__(self, host, target, type_, occupants, subject, profiles=profiles) 266 quick_chat.QuickChat.__init__(self, host, target, type_, nick, occupants, subject, profiles=profiles)
263 self.filters = [] # list of filter callbacks to apply 267 self.filters = [] # list of filter callbacks to apply
264 self.mess_walker = urwid.SimpleListWalker([]) 268 self.mess_walker = urwid.SimpleListWalker([])
265 self.mess_widgets = urwid.ListBox(self.mess_walker) 269 self.mess_widgets = urwid.ListBox(self.mess_walker)
266 self.chat_widget = urwid.Frame(self.mess_widgets) 270 self.chat_widget = urwid.Frame(self.mess_widgets)
267 self.chat_colums = urwid.Columns([('weight', 8, self.chat_widget)]) 271 self.chat_colums = urwid.Columns([('weight', 8, self.chat_widget)])