comparison frontends/src/quick_frontend/quick_app.py @ 1633:2071d5cec5d6

quick frontend: added progressIdHandler to managed progress id on action result + ignore meta_* action results
author Goffi <goffi@goffi.org>
date Fri, 20 Nov 2015 01:57:16 +0100
parents e2ed8009e66e
children e00f450c25fc
comparison
equal deleted inserted replaced
1632:4f9fa67758eb 1633:2071d5cec5d6
673 pass #FIXME 673 pass #FIXME
674 674
675 def dialogFailure(self, failure): 675 def dialogFailure(self, failure):
676 log.warning(u"Failure: {}".format(failure)) 676 log.warning(u"Failure: {}".format(failure))
677 677
678 def progressIdHandler(self, progress_id, profile):
679 """Callback used when an action result in a progress id"""
680 log.info(u"Progress ID received: {}".format(progress_id))
681
678 def updateAlertsCounter(self): 682 def updateAlertsCounter(self):
679 """Update the over whole alerts counter 683 """Update the over whole alerts counter
680 684
681 """ 685 """
682 pass 686 pass
720 except KeyError: 724 except KeyError:
721 pass 725 pass
722 else: 726 else:
723 ui = self.xmlui.create(self, xml_data=xmlui, callback=callback, profile=profile) 727 ui = self.xmlui.create(self, xml_data=xmlui, callback=callback, profile=profile)
724 ui.show() 728 ui.show()
729
730 try:
731 progress_id = action_data.pop('progress')
732 except KeyError:
733 pass
734 else:
735 self.progressIdHandler(progress_id, profile)
736
737 # we ignore metadata
738 action_data = {k:v for k,v in action_data.iteritems() if not k.startswith("meta_")}
739
725 if action_data: 740 if action_data:
726 raise exceptions.DataError(u"Not all keys in action_data are managed ({keys})".format(keys=', '.join(action_data.keys()))) 741 raise exceptions.DataError(u"Not all keys in action_data are managed ({keys})".format(keys=', '.join(action_data.keys())))
727 742
728 def launchAction(self, callback_id, data=None, callback=None, profile=C.PROF_KEY_NONE): 743 def launchAction(self, callback_id, data=None, callback=None, profile=C.PROF_KEY_NONE):
729 """ Launch a dynamic action 744 """ Launch a dynamic action