quick_frontend, primitivus (chat): renamed updated to update, using a dict as argument + fixed Primitivus group chat
This commit is contained in:
parent
3aee03c381
commit
bb9e22c020
2 changed files with 13 additions and 9 deletions
|
|
@ -139,7 +139,11 @@ class MessageWidget(urwid.WidgetWrap):
|
|||
return markup
|
||||
|
||||
# events
|
||||
def updated(self, attributes):
|
||||
def update(self, update_dict=None):
|
||||
"""update all the linked message widgets
|
||||
|
||||
@param update_dict(dict, None): key=attribute updated value=new_value
|
||||
"""
|
||||
self.redraw()
|
||||
|
||||
@total_ordering
|
||||
|
|
@ -212,7 +216,7 @@ class OccupantWidget(urwid.WidgetWrap):
|
|||
return markup
|
||||
|
||||
# events
|
||||
def updated(self, attributes):
|
||||
def update(self, update_dict=None):
|
||||
self.redraw()
|
||||
|
||||
|
||||
|
|
@ -258,8 +262,8 @@ class OccupantsWidget(urwid.WidgetWrap):
|
|||
|
||||
class Chat(PrimitivusWidget, quick_chat.QuickChat):
|
||||
|
||||
def __init__(self, host, target, type_=C.CHAT_ONE2ONE, occupants=None, subject=None, profiles=None):
|
||||
quick_chat.QuickChat.__init__(self, host, target, type_, occupants, subject, profiles=profiles)
|
||||
def __init__(self, host, target, type_=C.CHAT_ONE2ONE, nick=None, occupants=None, subject=None, profiles=None):
|
||||
quick_chat.QuickChat.__init__(self, host, target, type_, nick, occupants, subject, profiles=profiles)
|
||||
self.filters = [] # list of filter callbacks to apply
|
||||
self.mess_walker = urwid.SimpleListWalker([])
|
||||
self.mess_widgets = urwid.ListBox(self.mess_walker)
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class Message(object):
|
|||
def status(self, status):
|
||||
self._status = status
|
||||
for w in self.widgets:
|
||||
w.updated(["status"])
|
||||
w.update(["status"])
|
||||
|
||||
def handleMe(self):
|
||||
"""Check if messages starts with "/me " and change them if it is the case
|
||||
|
|
@ -212,11 +212,11 @@ class Occupant(object):
|
|||
def state(self, new_state):
|
||||
self._state = new_state
|
||||
for w in self.widgets:
|
||||
w.updated(["state"])
|
||||
w.update(["state"])
|
||||
|
||||
def update(self, key=None):
|
||||
def update(self, update_dict=None):
|
||||
for w in self.widgets:
|
||||
w.update(key)
|
||||
w.update(update_dict)
|
||||
|
||||
|
||||
class QuickChat(quick_widgets.QuickWidget):
|
||||
|
|
@ -573,7 +573,7 @@ class QuickChat(quick_widgets.QuickWidget):
|
|||
def onAvatar(self, entity, filename, profile):
|
||||
if self.type == C.CHAT_GROUP:
|
||||
if entity.bare == self.target and entity.resource in self.occupants:
|
||||
self.occupants[entity.resource].update('avatar')
|
||||
self.occupants[entity.resource].update(['avatar'])
|
||||
for m in self.messages.values():
|
||||
if m.nick == entity.resource:
|
||||
for w in m.widgets:
|
||||
|
|
|
|||
Loading…
Reference in a new issue