quick frontend(app): added listener for selected widget
This commit is contained in:
parent
d684685e24
commit
697e91ff75
2 changed files with 7 additions and 1 deletions
|
|
@ -98,6 +98,7 @@ class Const(constants.Const):
|
|||
"avatar",
|
||||
"nick",
|
||||
"presence",
|
||||
"selected",
|
||||
"profilePlugged",
|
||||
"contactsFilled",
|
||||
"disconnect",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
# helper class for making a SAT frontend
|
||||
# Copyright (C) 2009-2020 Jérôme Poisson (goffi@goffi.org)
|
||||
|
||||
|
|
@ -450,6 +449,8 @@ class QuickApp(object):
|
|||
|
||||
Must be set by frontend
|
||||
"""
|
||||
if self._selected_widget == wid:
|
||||
return
|
||||
self._selected_widget = wid
|
||||
try:
|
||||
onSelected = wid.onSelected
|
||||
|
|
@ -458,6 +459,8 @@ class QuickApp(object):
|
|||
else:
|
||||
onSelected()
|
||||
|
||||
self.callListeners("selected", wid)
|
||||
|
||||
# backend state management
|
||||
|
||||
@property
|
||||
|
|
@ -554,6 +557,8 @@ class QuickApp(object):
|
|||
args: (entity, new_nick, profile)
|
||||
- presence: called when a presence is received
|
||||
args: (entity, show, priority, statuses, profile)
|
||||
- selected: called when a widget is selected
|
||||
args: (selected_widget,)
|
||||
- notification: called when a new notification is emited
|
||||
args: (entity, notification_data, profile)
|
||||
- notification_clear: called when notifications are cleared
|
||||
|
|
|
|||
Loading…
Reference in a new issue