Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 262:af3d4f11fe43
Added management of connection error
- core: connection_error signal is sent if it's impossible to connect
- bridge: added connection_error signal
- quick_frontend: an error_message is shown when a connection_error is received
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 22 Jan 2011 15:53:56 +0100 |
parents | 3bc4457687a2 |
children | bfd01aed0a3a |
comparison
equal
deleted
inserted
replaced
261:0ecd9c33fa3a | 262:af3d4f11fe43 |
---|---|
44 print(_(u"Can't connect to SàT backend, are you sure it's launched ?")) | 44 print(_(u"Can't connect to SàT backend, are you sure it's launched ?")) |
45 import sys | 45 import sys |
46 sys.exit(1) | 46 sys.exit(1) |
47 self.bridge.register("connected", self.connected) | 47 self.bridge.register("connected", self.connected) |
48 self.bridge.register("disconnected", self.disconnected) | 48 self.bridge.register("disconnected", self.disconnected) |
49 self.bridge.register("connection_error", self.connection_error) | |
49 self.bridge.register("newContact", self.newContact) | 50 self.bridge.register("newContact", self.newContact) |
50 self.bridge.register("newMessage", self.newMessage) | 51 self.bridge.register("newMessage", self.newMessage) |
51 self.bridge.register("newAlert", self.newAlert) | 52 self.bridge.register("newAlert", self.newAlert) |
52 self.bridge.register("presenceUpdate", self.presenceUpdate) | 53 self.bridge.register("presenceUpdate", self.presenceUpdate) |
53 self.bridge.register("roomJoined", self.roomJoined) | 54 self.bridge.register("roomJoined", self.roomJoined) |
175 """called when the connection is made""" | 176 """called when the connection is made""" |
176 if not self.check_profile(profile): | 177 if not self.check_profile(profile): |
177 return | 178 return |
178 debug(_("Connected")) | 179 debug(_("Connected")) |
179 self.setStatusOnline(True) | 180 self.setStatusOnline(True) |
180 | |
181 | 181 |
182 def disconnected(self, profile): | 182 def disconnected(self, profile): |
183 """called when the connection is closed""" | 183 """called when the connection is closed""" |
184 if not self.check_profile(profile): | 184 if not self.check_profile(profile): |
185 return | 185 return |
186 debug(_("Disconnected")) | 186 debug(_("Disconnected")) |
187 self.CM.clear() | 187 self.CM.clear() |
188 self.contactList.clear_contacts() | 188 self.contactList.clear_contacts() |
189 self.setStatusOnline(False) | 189 self.setStatusOnline(False) |
190 | 190 |
191 def connection_error(self, profile, error_type): | |
192 """called when something goest wrong with the connection""" | |
193 if not self.check_profile(profile): | |
194 return | |
195 debug(_("Connection Error")) | |
196 self.disconnected(profile) | |
197 if error_type == "AUTH_ERROR": | |
198 self.showDialog(_("Can't connect to account, check your password"), _("Connection error"), "error") | |
199 else: | |
200 error(_('FIXME: error_type %s not implemented') % error_type) | |
201 | |
191 def newContact(self, JabberId, attributes, groups, profile): | 202 def newContact(self, JabberId, attributes, groups, profile): |
192 if not self.check_profile(profile): | 203 if not self.check_profile(profile): |
193 return | 204 return |
194 entity=JID(JabberId) | 205 entity=JID(JabberId) |
195 self.rosterList[entity.short]=(dict(attributes), list(groups)) | 206 self.rosterList[entity.short]=(dict(attributes), list(groups)) |