Mercurial > libervia-backend
diff src/core/sat_main.py @ 2050:046449cc2bff
core, bridge, frontends: removed deprecated bridge method askConfirmation, confirmationAnswer, actionResult, actionResultExt and getWaitingConf
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 28 Aug 2016 19:23:58 +0200 |
parents | 19b9d3f8a6c7 |
children | 4633cfcbcccb |
line wrap: on
line diff
--- a/src/core/sat_main.py Sun Aug 28 18:24:45 2016 +0200 +++ b/src/core/sat_main.py Sun Aug 28 19:23:58 2016 +0200 @@ -53,7 +53,6 @@ def __init__(self): self._cb_map = {} # map from callback_id to callbacks self._menus = OrderedDict() # dynamic menus. key: callback_id, value: menu data (dictionnary) - self.__private_data = {} # used for internal callbacks (key = id) FIXME: to be removed self.initialised = defer.Deferred() self.profiles = {} self.plugins = {} @@ -85,7 +84,6 @@ self.bridge.register("getMainResource", self.memory._getMainResource) self.bridge.register("getPresenceStatuses", self.memory._getPresenceStatuses) self.bridge.register("getWaitingSub", self.memory.getWaitingSub) - self.bridge.register("getWaitingConf", self.getWaitingConf) self.bridge.register("messageSend", self._messageSend) self.bridge.register("getConfig", self._getConfig) self.bridge.register("setParam", self.setParam) @@ -104,7 +102,6 @@ self.bridge.register("isConnected", self.isConnected) self.bridge.register("launchAction", self.launchCallback) self.bridge.register("actionsGet", self.actionsGet) - self.bridge.register("confirmationAnswer", self.confirmationAnswer) self.bridge.register("progressGet", self._progressGet) self.bridge.register("progressGetAll", self._progressGetAll) self.bridge.register("getMenus", self.getMenus) @@ -519,15 +516,6 @@ ## XMPP methods ## - def getWaitingConf(self, profile_key=None): - assert profile_key - client = self.getClient(profile_key) - ret = [] - for conf_id in client._waiting_conf: - conf_type, data = client._waiting_conf[conf_id][:2] - ret.append((conf_id, conf_type, data)) - return ret - def generateMessageXML(self, data): """Generate <message/> stanza from message data @@ -796,51 +784,6 @@ ## Generic HMI ## - def actionResult(self, action_id, action_type, data, profile): - """Send the result of an action - @param action_id: same action_id used with action - @param action_type: result action_type ("PARAM", "SUCCESS", "ERROR", "XMLUI") - @param data: dictionary - """ - self.bridge.actionResult(action_type, action_id, data, profile) - - def actionResultExt(self, action_id, action_type, data, profile): - """Send the result of an action, extended version - @param action_id: same action_id used with action - @param action_type: result action_type /!\ only "DICT_DICT" for this method - @param data: dictionary of dictionaries - """ - if action_type != "DICT_DICT": - log.error(_("action_type for actionResultExt must be DICT_DICT, fixing it")) - action_type = "DICT_DICT" - self.bridge.actionResultExt(action_type, action_id, data, profile) - - def askConfirmation(self, conf_id, conf_type, data, cb, profile): - """Add a confirmation callback - @param conf_id: conf_id used to get answer - @param conf_type: confirmation conf_type ("YES/NO", "FILE_TRANSFER") - @param data: data (depend of confirmation conf_type) - @param cb: callback called with the answer - """ - # FIXME: use XMLUI and *callback methods for dialog - client = self.getClient(profile) - if conf_id in client._waiting_conf: - log.error(_("Attempt to register two callbacks for the same confirmation")) - else: - client._waiting_conf[conf_id] = (conf_type, data, cb) - self.bridge.askConfirmation(conf_id, conf_type, data, profile) - - def confirmationAnswer(self, conf_id, accepted, data, profile): - """Called by frontends to answer confirmation requests""" - client = self.getClient(profile) - log.debug(_(u"Received confirmation answer for conf_id [%(conf_id)s]: %(success)s") % {'conf_id': conf_id, 'success': _("accepted") if accepted else _("refused")}) - if conf_id not in client._waiting_conf: - log.error(_(u"Received an unknown confirmation (%(id)s for %(profile)s)") % {'id': conf_id, 'profile': profile}) - else: - cb = client._waiting_conf[conf_id][-1] - del client._waiting_conf[conf_id] - cb(conf_id, accepted, data, profile) - def _killAction(self, keep_id, client): log.debug(u"Killing action {} for timeout".format(keep_id)) client.actions[keep_id]