Mercurial > libervia-backend
comparison sat_frontends/quick_frontend/quick_app.py @ 3164:9dc170635bee
quick frontend(app): added listener for selected widget
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 10 Feb 2020 22:02:31 +0100 |
parents | 30e08d904208 |
children | 122075ceaa53 |
comparison
equal
deleted
inserted
replaced
3163:d10b2368684e | 3164:9dc170635bee |
---|---|
1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
2 | |
3 | 2 |
4 # helper class for making a SAT frontend | 3 # helper class for making a SAT frontend |
5 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) | 4 # Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org) |
6 | 5 |
7 # This program is free software: you can redistribute it and/or modify | 6 # This program is free software: you can redistribute it and/or modify |
448 def selected_widget(self, wid): | 447 def selected_widget(self, wid): |
449 """Set the currently selected widget | 448 """Set the currently selected widget |
450 | 449 |
451 Must be set by frontend | 450 Must be set by frontend |
452 """ | 451 """ |
452 if self._selected_widget == wid: | |
453 return | |
453 self._selected_widget = wid | 454 self._selected_widget = wid |
454 try: | 455 try: |
455 onSelected = wid.onSelected | 456 onSelected = wid.onSelected |
456 except AttributeError: | 457 except AttributeError: |
457 pass | 458 pass |
458 else: | 459 else: |
459 onSelected() | 460 onSelected() |
461 | |
462 self.callListeners("selected", wid) | |
460 | 463 |
461 # backend state management | 464 # backend state management |
462 | 465 |
463 @property | 466 @property |
464 def sync(self): | 467 def sync(self): |
552 args: (entity, avatar file, profile) | 555 args: (entity, avatar file, profile) |
553 - nick: called when nick data is updated | 556 - nick: called when nick data is updated |
554 args: (entity, new_nick, profile) | 557 args: (entity, new_nick, profile) |
555 - presence: called when a presence is received | 558 - presence: called when a presence is received |
556 args: (entity, show, priority, statuses, profile) | 559 args: (entity, show, priority, statuses, profile) |
560 - selected: called when a widget is selected | |
561 args: (selected_widget,) | |
557 - notification: called when a new notification is emited | 562 - notification: called when a new notification is emited |
558 args: (entity, notification_data, profile) | 563 args: (entity, notification_data, profile) |
559 - notification_clear: called when notifications are cleared | 564 - notification_clear: called when notifications are cleared |
560 args: (entity, type_, profile) | 565 args: (entity, type_, profile) |
561 - menu: called when a menu item is added or removed | 566 - menu: called when a menu item is added or removed |