comparison frontends/src/quick_frontend/quick_app.py @ 2036:db3bbbd745e4

frontends (xmlui): added a user_action attribute: this attribute indicate if the data is a result of a user interaction or an event from the backend (in the later case, the frontend can choose to avoid interrupting the user). Internally (in XMLUI), "FROM_BACKEND" is added to XMLUI.flags if the UI result from a backend event.
author Goffi <goffi@goffi.org>
date Sun, 21 Aug 2016 12:07:31 +0200
parents 3f745370a39a
children f607349a01a4
comparison
equal deleted inserted replaced
2035:5c6db4329288 2036:db3bbbd745e4
788 raise NotImplementedError 788 raise NotImplementedError
789 789
790 def actionResultHandler(self, type, id, data, profile): 790 def actionResultHandler(self, type, id, data, profile):
791 raise NotImplementedError 791 raise NotImplementedError
792 792
793 def actionManager(self, action_data, callback=None, ui_show_cb=None, profile=C.PROF_KEY_NONE): 793 def actionManager(self, action_data, callback=None, ui_show_cb=None, user_action=True, profile=C.PROF_KEY_NONE):
794 """Handle backend action 794 """Handle backend action
795 795
796 @param action_data(dict): action dict as sent by launchAction or returned by an UI action 796 @param action_data(dict): action dict as sent by launchAction or returned by an UI action
797 @param callback(None, callback): if not None, callback to use on XMLUI answer 797 @param callback(None, callback): if not None, callback to use on XMLUI answer
798 @param ui_show_cb(None, callback): if not None, method to call to show the XMLUI 798 @param ui_show_cb(None, callback): if not None, method to call to show the XMLUI
799 @param user_action(bool): if True, the action is a result of a user interaction
800 else the action come from backend direclty (i.e. actionNew)
799 """ 801 """
800 try: 802 try:
801 xmlui = action_data.pop('xmlui') 803 xmlui = action_data.pop('xmlui')
802 except KeyError: 804 except KeyError:
803 pass 805 pass
804 else: 806 else:
805 ui = self.xmlui.create(self, xml_data=xmlui, callback=callback, profile=profile) 807 ui = self.xmlui.create(self, xml_data=xmlui, flags=("FROM_BACKEND",) if not user_action else None, callback=callback, profile=profile)
806 if ui_show_cb is None: 808 if ui_show_cb is None:
807 ui.show() 809 ui.show()
808 else: 810 else:
809 ui_show_cb(ui) 811 ui_show_cb(ui)
810 812