Mercurial > libervia-backend
changeset 2168:255830fdb80b
core, bridge: renamed getProfileName to profileNameGet according to new conventions
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 05 Mar 2017 21:36:01 +0100 |
parents | 4b78b4c7f805 |
children | f472179305a1 |
files | frontends/src/bridge/dbus_bridge.py frontends/src/jp/base.py frontends/src/jp/cmd_profile.py frontends/src/quick_frontend/quick_profile_manager.py src/bridge/bridge_constructor/bridge_template.ini src/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py src/bridge/dbus_bridge.py src/core/sat_main.py |
diffstat | 8 files changed, 27 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/bridge/dbus_bridge.py Sun Feb 26 18:23:01 2017 +0100 +++ b/frontends/src/bridge/dbus_bridge.py Sun Mar 05 21:36:01 2017 +0100 @@ -375,20 +375,6 @@ kwargs['error_handler'] = error_handler return self.db_core_iface.getPresenceStatuses(profile_key, **kwargs) - def getProfileName(self, profile_key="@DEFAULT@", callback=None, errback=None): - if callback is None: - error_handler = None - else: - if errback is None: - errback = log.error - error_handler = lambda err:errback(dbus_to_bridge_exception(err)) - kwargs={} - if callback is not None: - kwargs['timeout'] = const_TIMEOUT - kwargs['reply_handler'] = callback - kwargs['error_handler'] = error_handler - return unicode(self.db_core_iface.getProfileName(profile_key, **kwargs)) - def getReady(self, callback=None, errback=None): if callback is None: error_handler = None @@ -555,6 +541,20 @@ kwargs['error_handler'] = error_handler return self.db_core_iface.profileIsSessionStarted(profile_key, **kwargs) + def profileNameGet(self, profile_key="@DEFAULT@", callback=None, errback=None): + if callback is None: + error_handler = None + else: + if errback is None: + errback = log.error + error_handler = lambda err:errback(dbus_to_bridge_exception(err)) + kwargs={} + if callback is not None: + kwargs['timeout'] = const_TIMEOUT + kwargs['reply_handler'] = callback + kwargs['error_handler'] = error_handler + return unicode(self.db_core_iface.profileNameGet(profile_key, **kwargs)) + def profileSetDefault(self, profile, callback=None, errback=None): if callback is None: error_handler = None
--- a/frontends/src/jp/base.py Sun Feb 26 18:23:01 2017 +0100 +++ b/frontends/src/jp/base.py Sun Mar 05 21:36:01 2017 +0100 @@ -465,7 +465,7 @@ log.error(_(u"Can't start {profile}'s session: {reason}").format(profile=self.profile, reason=failure)) self.quit(1) - self.profile = self.bridge.getProfileName(self.args.profile) + self.profile = self.bridge.profileNameGet(self.args.profile) if not self.profile: log.error(_("The profile [{profile}] doesn't exist").format(profile=self.args.profile))
--- a/frontends/src/jp/cmd_profile.py Sun Feb 26 18:23:01 2017 +0100 +++ b/frontends/src/jp/cmd_profile.py Sun Mar 05 21:36:01 2017 +0100 @@ -50,7 +50,7 @@ pass def start(self): - print self.host.bridge.getProfileName('@DEFAULT@') + print self.host.bridge.profileNameGet('@DEFAULT@') class ProfileDelete(base.CommandBase):
--- a/frontends/src/quick_frontend/quick_profile_manager.py Sun Feb 26 18:23:01 2017 +0100 +++ b/frontends/src/quick_frontend/quick_profile_manager.py Sun Mar 05 21:36:01 2017 +0100 @@ -123,7 +123,7 @@ log.error(u"Can't retrieve profile name: {}".format(failure)) for profile_key in profile_keys: - self.host.bridge.getProfileName(profile_key, callback=getProfileNameCb, errback=getProfileNameEb) + self.host.bridge.profileNameGet(profile_key, callback=getProfileNameCb, errback=getProfileNameEb) def getParamError(self, dummy):
--- a/src/bridge/bridge_constructor/bridge_template.ini Sun Feb 26 18:23:01 2017 +0100 +++ b/src/bridge/bridge_constructor/bridge_template.ini Sun Mar 05 21:36:01 2017 +0100 @@ -187,7 +187,7 @@ plugin import name is used as key, data is an other dict managed by the plugin async= -[getProfileName] +[profileNameGet] type=method category=core sig_in=s
--- a/src/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py Sun Feb 26 18:23:01 2017 +0100 +++ b/src/bridge/bridge_constructor/constructors/dbus/dbus_frontend_template.py Sun Mar 05 21:36:01 2017 +0100 @@ -18,7 +18,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from sat.core.i18n import _ -from bridge_frontend import BridgeFrontend, BridgeException +from bridge_frontend import BridgeException import dbus from sat.core.log import getLogger log = getLogger(__name__) @@ -59,7 +59,7 @@ return BridgeException(name, message, condition) -class Bridge(BridgeFrontend): +class Bridge(object): def bridgeConnect(self, callback, errback): try:
--- a/src/bridge/dbus_bridge.py Sun Feb 26 18:23:01 2017 +0100 +++ b/src/bridge/dbus_bridge.py Sun Mar 05 21:36:01 2017 +0100 @@ -318,12 +318,6 @@ return self._callback("getPresenceStatuses", unicode(profile_key)) @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, - in_signature='s', out_signature='s', - async_callbacks=None) - def getProfileName(self, profile_key="@DEFAULT@"): - return self._callback("getProfileName", unicode(profile_key)) - - @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='', out_signature='', async_callbacks=('callback', 'errback')) def getReady(self, callback=None, errback=None): @@ -408,6 +402,12 @@ return self._callback("profileIsSessionStarted", unicode(profile_key)) @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, + in_signature='s', out_signature='s', + async_callbacks=None) + def profileNameGet(self, profile_key="@DEFAULT@"): + return self._callback("profileNameGet", unicode(profile_key)) + + @dbus.service.method(const_INT_PREFIX+const_CORE_SUFFIX, in_signature='s', out_signature='', async_callbacks=None) def profileSetDefault(self, profile):
--- a/src/core/sat_main.py Sun Feb 26 18:23:01 2017 +0100 +++ b/src/core/sat_main.py Sun Mar 05 21:36:01 2017 +0100 @@ -74,7 +74,7 @@ self.bridge.register_method("getReady", lambda: self.initialised) self.bridge.register_method("getVersion", lambda: self.full_version) self.bridge.register_method("getFeatures", self.getFeatures) - self.bridge.register_method("getProfileName", self.memory.getProfileName) + self.bridge.register_method("profileNameGet", self.memory.getProfileName) self.bridge.register_method("profilesListGet", self.memory.getProfilesList) self.bridge.register_method("getEntityData", lambda jid_, keys, profile: self.memory.getEntityData(jid.JID(jid_), keys, profile)) self.bridge.register_method("getEntitiesData", self.memory._getEntitiesData)