Mercurial > libervia-web
comparison browser_side/dialog.py @ 271:d868181d0649
browser_side: update contacts in "group and contact chooser" when the a user connect/disconnect
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 19 Nov 2013 21:21:49 +0100 |
parents | 79970bf6af93 |
children | 0cb9869b42b6 |
comparison
equal
deleted
inserted
replaced
270:52e60dd2bc43 | 271:d868181d0649 |
---|---|
183 | 183 |
184 self.setWidget(main_panel) | 184 self.setWidget(main_panel) |
185 self.setHTML(title) | 185 self.setHTML(title) |
186 self.show() | 186 self.show() |
187 | 187 |
188 # needed to update the contacts list when someone logged in/out | |
189 self.host.room_contacts_chooser = self | |
190 | |
188 def getRoom(self, asSuffix=False): | 191 def getRoom(self, asSuffix=False): |
189 room = self.room_panel.getRoom() | 192 room = self.room_panel.getRoom() |
190 if asSuffix: | 193 if asSuffix: |
191 return room if room == "" else ": %s" % room | 194 return room if room == "" else ": %s" % room |
192 else: | 195 else: |
204 visible = sender.getWidget(index).getVisible() | 207 visible = sender.getWidget(index).getVisible() |
205 if index == 0: | 208 if index == 0: |
206 sender.setStackText(0, self.title_room + ("" if visible else self.getRoom(True))) | 209 sender.setStackText(0, self.title_room + ("" if visible else self.getRoom(True))) |
207 elif index == 1: | 210 elif index == 1: |
208 sender.setStackText(1, self.title_invite + ("" if visible else self.getContacts(True))) | 211 sender.setStackText(1, self.title_invite + ("" if visible else self.getContacts(True))) |
209 if visible: | 212 |
210 # update the contacts list in case someone recently logged in/out | 213 def resetContacts(self): |
211 self.contact_panel.setContacts(self.getContacts()) | 214 """Called when someone log in/out to update the list""" |
215 self.contact_panel.setContacts(self.getContacts()) | |
212 | 216 |
213 def onOK(self, sender): | 217 def onOK(self, sender): |
214 room_jid = self.getRoom() | 218 room_jid = self.getRoom() |
215 if room_jid != "" and "@" not in room_jid: | 219 if room_jid != "" and "@" not in room_jid: |
216 Window.alert('You must enter a room jid in the form room@chat.%s' % self.host._defaultDomain) | 220 Window.alert('You must enter a room jid in the form room@chat.%s' % self.host._defaultDomain) |
217 self.hide() | 221 self.hide() |
218 self.callback(room_jid, self.getContacts()) | 222 self.callback(room_jid, self.getContacts()) |
219 | 223 |
220 def onCancel(self, sender): | 224 def onCancel(self, sender): |
221 self.hide() | 225 self.hide() |
226 | |
227 def hide(self): | |
228 self.host.room_contacts_chooser = None | |
229 DialogBox.hide(self, autoClosed=True) | |
222 | 230 |
223 | 231 |
224 class GenericConfirmDialog(DialogBox): | 232 class GenericConfirmDialog(DialogBox): |
225 | 233 |
226 def __init__(self, widgets, callback, title='Confirmation', **kwargs): | 234 def __init__(self, widgets, callback, title='Confirmation', **kwargs): |