diff --git a/sat_frontends/quick_frontend/constants.py b/sat_frontends/quick_frontend/constants.py index 2778d36f..acde2180 100644 --- a/sat_frontends/quick_frontend/constants.py +++ b/sat_frontends/quick_frontend/constants.py @@ -98,6 +98,7 @@ class Const(constants.Const): "avatar", "nick", "presence", + "selected", "profilePlugged", "contactsFilled", "disconnect", diff --git a/sat_frontends/quick_frontend/quick_app.py b/sat_frontends/quick_frontend/quick_app.py index 8fb2d635..b372f6f6 100644 --- a/sat_frontends/quick_frontend/quick_app.py +++ b/sat_frontends/quick_frontend/quick_app.py @@ -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