comparison frontends/src/quick_frontend/quick_chat.py @ 2076:529a6d7f7f6a

quick frontend (chat): update use a dict
author Goffi <goffi@goffi.org>
date Fri, 23 Sep 2016 22:50:13 +0200
parents 4f3ebf786fbc
children 3a0a7e5cef49
comparison
equal deleted inserted replaced
2075:4f3ebf786fbc 2076:529a6d7f7f6a
140 140
141 @status.setter 141 @status.setter
142 def status(self, status): 142 def status(self, status):
143 self._status = status 143 self._status = status
144 for w in self.widgets: 144 for w in self.widgets:
145 w.update(["status"]) 145 w.update({"status": None})
146 146
147 def handleMe(self): 147 def handleMe(self):
148 """Check if messages starts with "/me " and change them if it is the case 148 """Check if messages starts with "/me " and change them if it is the case
149 149
150 if several messages (different languages) are presents, they all need to start with "/me " 150 if several messages (different languages) are presents, they all need to start with "/me "
210 210
211 @state.setter 211 @state.setter
212 def state(self, new_state): 212 def state(self, new_state):
213 self._state = new_state 213 self._state = new_state
214 for w in self.widgets: 214 for w in self.widgets:
215 w.update(["state"]) 215 w.update({"state":None})
216 216
217 def update(self, update_dict=None): 217 def update(self, update_dict=None):
218 for w in self.widgets: 218 for w in self.widgets:
219 w.update(update_dict) 219 w.update(update_dict)
220 220
571 mess_data.status = status 571 mess_data.status = status
572 572
573 def onAvatar(self, entity, filename, profile): 573 def onAvatar(self, entity, filename, profile):
574 if self.type == C.CHAT_GROUP: 574 if self.type == C.CHAT_GROUP:
575 if entity.bare == self.target and entity.resource in self.occupants: 575 if entity.bare == self.target and entity.resource in self.occupants:
576 self.occupants[entity.resource].update(['avatar']) 576 self.occupants[entity.resource].update({'avatar': filename})
577 for m in self.messages.values(): 577 for m in self.messages.values():
578 if m.nick == entity.resource: 578 if m.nick == entity.resource:
579 for w in m.widgets: 579 for w in m.widgets:
580 w.update('avatar', filename) 580 w.update({'avatar': filename})
581 else: 581 else:
582 if entity.bare == self.target.bare: 582 if entity.bare == self.target.bare:
583 log.info("entity avatar updated") 583 log.info("entity avatar updated")
584 # TODO: call a specific method 584 # TODO: call a specific method
585 585