comparison sat_frontends/quick_frontend/quick_app.py @ 2790:19ab67e28822

quick frontends: visible_widgets can now keep any kind of widget, new visible_quick_widgets only iters on QuickWidgets
author Goffi <goffi@goffi.org>
date Sun, 20 Jan 2019 15:46:32 +0100
parents d350f4571d82
children 441b536e28ed
comparison
equal deleted inserted replaced
2789:d350f4571d82 2790:19ab67e28822
304 if check_options is not None: 304 if check_options is not None:
305 self.options = check_options() 305 self.options = check_options()
306 else: 306 else:
307 self.options = None 307 self.options = None
308 308
309 # widgets 309 # widget currently selected (must be filled by frontend)
310 self.selected_widget = ( 310 self.selected_widget = None
311 None
312 ) # widget currently selected (must be filled by frontend)
313 311
314 # listeners 312 # listeners
315 self._listeners = {} # key: listener type ("avatar", "selected", etc), 313 self._listeners = {} # key: listener type ("avatar", "selected", etc),
316 # value: list of callbacks 314 # value: list of callbacks
317 315
405 except (TypeError, AttributeError): 403 except (TypeError, AttributeError):
406 return self.profiles.chooseOneProfile() 404 return self.profiles.chooseOneProfile()
407 405
408 @property 406 @property
409 def visible_widgets(self): 407 def visible_widgets(self):
410 """widgets currently visible (must be implemented by frontend) 408 """Widgets currently visible
411 409
412 @return (iter[QuickWidget]): iterable on visible widgets 410 This must be implemented by frontend
411 @return (iter[object]): iterable on visible widgets
412 widgets can be QuickWidgets or not
413 """ 413 """
414 raise NotImplementedError 414 raise NotImplementedError
415
416 @property
417 def visible_quick_widgets(self):
418 """QuickWidgets currently visible
419
420 This generator iterate only on QuickWidgets, discarding other kinds of
421 widget the frontend may have.
422 @return (iter[object]): iterable on visible widgets
423 """
424 for w in self.visisble_widgets:
425 if isinstance(w, quick_widgets.QuickWidget):
426 return w
415 427
416 def registerSignal( 428 def registerSignal(
417 self, function_name, handler=None, iface="core", with_profile=True 429 self, function_name, handler=None, iface="core", with_profile=True
418 ): 430 ):
419 """Register a handler for a signal 431 """Register a handler for a signal