Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 2086:4633cfcbcccb
bridge (D-Bus): bad design fixes:
- renamed outputed module to dbus_bridge (to avoid uppercase and conflict with dbus module)
- class name is now Bridge for both frontend and core (make discovery/import more easy)
- register renamed to register_method in core, and register_signal in frontend
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 03 Oct 2016 21:15:39 +0200 |
parents | 7834743705f0 |
children | 0931b5a6213c |
comparison
equal
deleted
inserted
replaced
2085:da4097de5a95 | 2086:4633cfcbcccb |
---|---|
285 @param with_profile (boolean): True if the signal concerns a specific profile, in that case the profile name has to be passed by the caller | 285 @param with_profile (boolean): True if the signal concerns a specific profile, in that case the profile name has to be passed by the caller |
286 """ | 286 """ |
287 if handler is None: | 287 if handler is None: |
288 handler = getattr(self, "{}{}".format(function_name, 'Handler')) | 288 handler = getattr(self, "{}{}".format(function_name, 'Handler')) |
289 if not with_profile: | 289 if not with_profile: |
290 self.bridge.register(function_name, handler, iface) | 290 self.bridge.register_signal(function_name, handler, iface) |
291 return | 291 return |
292 | 292 |
293 def signalReceived(*args, **kwargs): | 293 def signalReceived(*args, **kwargs): |
294 profile = kwargs.get('profile') | 294 profile = kwargs.get('profile') |
295 if profile is None: | 295 if profile is None: |
301 if profile in self.profiles: | 301 if profile in self.profiles: |
302 # profile is not ready but is in self.profiles, that's mean that it's being connecting and we need to cache the signal | 302 # profile is not ready but is in self.profiles, that's mean that it's being connecting and we need to cache the signal |
303 self.signals_cache.setdefault(profile, []).append((function_name, handler, args, kwargs)) | 303 self.signals_cache.setdefault(profile, []).append((function_name, handler, args, kwargs)) |
304 return # we ignore signal for profiles we don't manage | 304 return # we ignore signal for profiles we don't manage |
305 handler(*args, **kwargs) | 305 handler(*args, **kwargs) |
306 self.bridge.register(function_name, signalReceived, iface) | 306 self.bridge.register_signal(function_name, signalReceived, iface) |
307 | 307 |
308 def addListener(self, type_, callback, profiles_filter=None): | 308 def addListener(self, type_, callback, profiles_filter=None): |
309 """Add a listener for an event | 309 """Add a listener for an event |
310 | 310 |
311 /!\ don't forget to remove listener when not used anymore (e.g. if you delete a widget) | 311 /!\ don't forget to remove listener when not used anymore (e.g. if you delete a widget) |