quick frontend (quick app): added progressFinished and progressError listeners
This commit is contained in:
parent
9fff6e1343
commit
6307c89618
2 changed files with 7 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue