Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_app.py @ 2103:b44558286bbb
quick frontend (quick app): added progressFinished and progressError listeners
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 22 Dec 2016 18:10:36 +0100 |
parents | 071423b3a413 |
children | c42aab22c2c0 |
comparison
equal
deleted
inserted
replaced
2102:071423b3a413 | 2103:b44558286bbb |
---|---|
361 type_: same as in [sat.core.sat_main.SAT.importMenu] | 361 type_: same as in [sat.core.sat_main.SAT.importMenu] |
362 path: same as in [sat.core.sat_main.SAT.importMenu] | 362 path: same as in [sat.core.sat_main.SAT.importMenu] |
363 path_i18n: translated path (or None if the item is removed) | 363 path_i18n: translated path (or None if the item is removed) |
364 item: instance of quick_menus.MenuItemBase or None if the item is removed | 364 item: instance of quick_menus.MenuItemBase or None if the item is removed |
365 - gotMenus: called only once when menu are available (no arg) | 365 - gotMenus: called only once when menu are available (no arg) |
366 - progressFinished: called when a progressing action has just finished | |
367 args: (progress_id, metadata, profile) | |
368 - progressError: called when a progressing action failed | |
369 args: (progress_id, error_msg, profile): | |
366 @param callback: method to call on event | 370 @param callback: method to call on event |
367 @param profiles_filter (set[unicode]): if set and not empty, the | 371 @param profiles_filter (set[unicode]): if set and not empty, the |
368 listener will be callable only by one of the given profiles. | 372 listener will be callable only by one of the given profiles. |
369 """ | 373 """ |
370 assert type_ in C.LISTENERS | 374 assert type_ in C.LISTENERS |
745 def progressStartedHandler(self, pid, metadata, profile): | 749 def progressStartedHandler(self, pid, metadata, profile): |
746 log.info(u"Progress {} started".format(pid)) | 750 log.info(u"Progress {} started".format(pid)) |
747 | 751 |
748 def progressFinishedHandler(self, pid, metadata, profile): | 752 def progressFinishedHandler(self, pid, metadata, profile): |
749 log.info(u"Progress {} finished".format(pid)) | 753 log.info(u"Progress {} finished".format(pid)) |
754 self.callListeners('progressFinished', pid, metadata, profile=profile) | |
750 | 755 |
751 def progressErrorHandler(self, pid, err_msg, profile): | 756 def progressErrorHandler(self, pid, err_msg, profile): |
752 log.warning(u"Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg)) | 757 log.warning(u"Progress {pid} error: {err_msg}".format(pid=pid, err_msg=err_msg)) |
758 self.callListeners('progressError', pid, err_msg, profile=profile) | |
753 | 759 |
754 def _subscribe_cb(self, answer, data): | 760 def _subscribe_cb(self, answer, data): |
755 entity, profile = data | 761 entity, profile = data |
756 type_ = "subscribed" if answer else "unsubscribed" | 762 type_ = "subscribed" if answer else "unsubscribed" |
757 self.bridge.subscription(type_, unicode(entity.bare), profile_key=profile) | 763 self.bridge.subscription(type_, unicode(entity.bare), profile_key=profile) |