core, bridge: new method paramsRegisterApp to register frontend's specific parameters

This commit is contained in:
souliane 2013-12-27 13:28:26 +01:00
commit 4a0d8be8ec
5 changed files with 175 additions and 59 deletions

View file

@ -152,17 +152,17 @@ class DBusBridgeFrontend(BridgeFrontend):
def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
return unicode(self.db_core_iface.getParamA(name, category, attribute, profile_key))
def getParams(self, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParams(security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getParams(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParams(security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getParamsCategories(self, ):
return self.db_core_iface.getParamsCategories()
def getParamsForCategory(self, category, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParamsForCategory(category, security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getParamsForCategory(self, category, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParamsForCategory(category, security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getParamsUI(self, security_limit=-1, profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParamsUI(security_limit, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getParamsUI(self, security_limit=-1, app='', profile_key="@DEFAULT@", callback=None, errback=None):
return unicode(self.db_core_iface.getParamsUI(security_limit, app, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])))
def getPresenceStatus(self, profile_key="@DEFAULT@"):
return self.db_core_iface.getPresenceStatus(profile_key)
@ -191,6 +191,9 @@ class DBusBridgeFrontend(BridgeFrontend):
def launchAction(self, callback_id, data, profile_key="@DEFAULT@", callback=None, errback=None):
return self.db_core_iface.launchAction(callback_id, data, profile_key, reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
def paramsRegisterApp(self, xml, security_limit=-1, app=''):
return self.db_core_iface.paramsRegisterApp(xml, security_limit, app)
def registerNewAccount(self, login, password, email, host, port=5222):
return unicode(self.db_core_iface.registerNewAccount(login, password, email, host, port))

View file

@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from sat.core.i18n import _
from sat.core.i18n import _, D_
try:
from collections import OrderedDict # only available from python 2.7
@ -56,7 +56,7 @@ class Const(object):
MENU_NORMAL = "NORMAL"
# from plugin_misc_text_syntaxes
_SYNTAX_XHTML = "XHTML"
_SYNTAX_CURRENT = "@CURRENT@"
SYNTAX_XHTML = "XHTML"
SYNTAX_CURRENT = "@CURRENT@"
NO_SECURITY_LIMIT = -1

View file

@ -574,11 +574,11 @@ class PrimitivusApp(QuickApp, InputHistory):
def onParam(self, menu):
def success(params):
self.addWindow(XMLUI(self,xml_data=params))
self.addWindow(XMLUI(self, xml_data=params))
def failure(error):
self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters"), ok_cb=self.removePopUp))
self.bridge.getParamsUI(profile_key=self.profile, callback=success, errback=failure)
self.bridge.getParamsUI(app=Const.APP_NAME, profile_key=self.profile, callback=success, errback=failure)
def onExitRequest(self, menu):
QuickApp.onExit(self)

View file

@ -407,9 +407,7 @@ class MainWindow(wx.Frame, QuickApp):
def onParam(self, e):
debug(_("Param request"))
#xmlui = self.bridge.getParamsUI(profile_key=self.profile)
#XMLUI(self, xml_data = xmlui)
param=Param(self)
param = Param(self)
def onAbout(self, e):
about = wx.AboutDialogInfo()

View file

@ -25,6 +25,7 @@ import pdb
from xml.dom import minidom
from logging import debug, info, error
from sat.tools.jid import JID
from sat_frontends.wix.constants import Const
class Param(wx.Frame):
@ -104,6 +105,7 @@ class Param(wx.Frame):
cat_dom.unlink()
self.host.bridge.getParamsForCategory(category,
app=Const.APP_NAME,
profile_key=self.host.profile,
callback=gotParams,
errback=errorGettingParams)