From 6307c89618e548de37649035996688c629d22563 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 22 Dec 2016 18:10:36 +0100 Subject: [PATCH] quick frontend (quick app): added progressFinished and progressError listeners --- frontends/src/quick_frontend/constants.py | 2 +- frontends/src/quick_frontend/quick_app.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontends/src/quick_frontend/constants.py b/frontends/src/quick_frontend/constants.py index ea6a094a..fc137152 100644 --- a/frontends/src/quick_frontend/constants.py +++ b/frontends/src/quick_frontend/constants.py @@ -83,7 +83,7 @@ class Const(constants.Const): UPDATE_SELECTION = 'SELECTION' UPDATE_STRUCTURE = 'STRUCTURE' # high level update (i.e. not item level but organisation of items) - LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', 'menu', 'notification', 'notificationsClear'} + LISTENERS = {'avatar', 'nick', 'presence', 'profilePlugged', 'disconnect', 'gotMenus', 'menu', 'notification', 'notificationsClear', 'progressFinished', 'progressError'} # Notifications NOTIFY_MESSAGE = 'MESSAGE' # a message was received diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py index 3f7baa8c..7745d087 100644 --- a/frontends/src/quick_frontend/quick_app.py +++ b/frontends/src/quick_frontend/quick_app.py @@ -363,6 +363,10 @@ class QuickApp(object): path_i18n: translated path (or None if the item is removed) item: instance of quick_menus.MenuItemBase or None if the item is removed - gotMenus: called only once when menu are available (no arg) + - progressFinished: called when a progressing action has just finished + args: (progress_id, metadata, profile) + - progressError: called when a progressing action failed + args: (progress_id, error_msg, profile): @param callback: method to call on event @param profiles_filter (set[unicode]): if set and not empty, the listener will be callable only by one of the given profiles. @@ -747,9 +751,11 @@ class QuickApp(object): def progressFinishedHandler(self, pid, metadata, profile): log.info(u"Progress {} finished".format(pid)) + self.callListeners('progressFinished', pid, metadata, profile=profile) def progressErrorHandler(self, pid, err_msg, profile): log.warning(u"Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg)) + self.callListeners('progressError', pid, err_msg, profile=profile) def _subscribe_cb(self, answer, data): entity, profile = data