Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 1323:a599b6a70dc0 frontends_multi_profiles
frontends (quick_frontend): fixes a typo (listerner --> listener)
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 20 Feb 2015 22:06:13 +0100 |
parents | 781ee3539252 |
children | 49f967fc87aa |
comparison
equal
deleted
inserted
replaced
1322:1f13a837e4b2 | 1323:a599b6a70dc0 |
---|---|
194 | 194 |
195 # widgets | 195 # widgets |
196 self.selected_widget = None # widget currently selected (must be filled by frontend) | 196 self.selected_widget = None # widget currently selected (must be filled by frontend) |
197 | 197 |
198 # listeners | 198 # listeners |
199 self._listeners = {} # key: listerner type ("avatar", "selected", etc), value: list of callbacks | 199 self._listeners = {} # key: listener type ("avatar", "selected", etc), value: list of callbacks |
200 | 200 |
201 ## bridge ## | 201 ## bridge ## |
202 try: | 202 try: |
203 self.bridge = create_bridge() | 203 self.bridge = create_bridge() |
204 except exceptions.BridgeExceptionNoService: | 204 except exceptions.BridgeExceptionNoService: |
285 if profile is not None and not self.check_profile(profile): | 285 if profile is not None and not self.check_profile(profile): |
286 return # we ignore signal for profiles we don't manage | 286 return # we ignore signal for profiles we don't manage |
287 handler(*args, **kwargs) | 287 handler(*args, **kwargs) |
288 self.bridge.register(functionName, signalReceived, iface) | 288 self.bridge.register(functionName, signalReceived, iface) |
289 | 289 |
290 def addListerner(self, type_, callback): | 290 def addListener(self, type_, callback): |
291 """Add a listerner for an event | 291 """Add a listener for an event |
292 | 292 |
293 /!\ don't forget to remove listener when not used anymore (e.g. if you delete a widget) | 293 /!\ don't forget to remove listener when not used anymore (e.g. if you delete a widget) |
294 @param type_: type of event, can be: | 294 @param type_: type of event, can be: |
295 - avatar: called when avatar data is updated | 295 - avatar: called when avatar data is updated |
296 args: (entity, avatar file, profile) | 296 args: (entity, avatar file, profile) |
300 self._listeners.setdefault(type_, []).append(callback) | 300 self._listeners.setdefault(type_, []).append(callback) |
301 | 301 |
302 def removeListener(self, type_, callback): | 302 def removeListener(self, type_, callback): |
303 """Remove a callback from listeners | 303 """Remove a callback from listeners |
304 | 304 |
305 @param type_: same as for [addListerner] | 305 @param type_: same as for [addListener] |
306 @param callback: callback to remove | 306 @param callback: callback to remove |
307 """ | 307 """ |
308 assert type_ in C.LISTENERS | 308 assert type_ in C.LISTENERS |
309 self._listeners[type_].remove(callback) | 309 self._listeners[type_].remove(callback) |
310 | 310 |
311 def callListeners(self, type_, *args): | 311 def callListeners(self, type_, *args): |
312 """Call all methods which listen of type_ event | 312 """Call all methods which listen of type_ event |
313 | 313 |
314 @param type_: same as for [addListerner] | 314 @param type_: same as for [addListener] |
315 @param *args: arguments sent to callback | 315 @param *args: arguments sent to callback |
316 """ | 316 """ |
317 assert type_ in C.LISTENERS | 317 assert type_ in C.LISTENERS |
318 try: | 318 try: |
319 listeners = self._listeners[type_] | 319 listeners = self._listeners[type_] |