frontends: fix typos, do not use logging in the xmlui tools:
This commit is contained in:
parent
171feb26d2
commit
b2f32986be
2 changed files with 9 additions and 10 deletions
|
|
@ -78,7 +78,7 @@ class Jp(object):
|
||||||
except exceptions.BridgeExceptionNoService:
|
except exceptions.BridgeExceptionNoService:
|
||||||
print(_(u"Can't connect to SàT backend, are you sure it's launched ?"))
|
print(_(u"Can't connect to SàT backend, are you sure it's launched ?"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except excpetions.BridgeInitError:
|
except exceptions.BridgeInitError:
|
||||||
print(_(u"Can't init bridge"))
|
print(_(u"Can't init bridge"))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
from sat.core.i18n import _
|
from sat.core.i18n import _
|
||||||
from sat_frontends.constants import Const
|
from sat_frontends.constants import Const
|
||||||
from logging import debug, info, warning, error
|
from sat.core.exceptions import DataError
|
||||||
|
|
||||||
|
|
||||||
class InvalidXMLUI(Exception):
|
class InvalidXMLUI(Exception):
|
||||||
|
|
@ -237,7 +237,7 @@ class XMLUI(object):
|
||||||
|
|
||||||
self._parseChilds(cont, node, ('row',), data)
|
self._parseChilds(cont, node, ('row',), data)
|
||||||
else:
|
else:
|
||||||
warning(_("Unknown container [%s], using default one") % type_)
|
print(_("Unknown container [%s], using default one") % type_)
|
||||||
cont = self.widget_factory.createVerticalContainer(parent)
|
cont = self.widget_factory.createVerticalContainer(parent)
|
||||||
self._parseChilds(cont, node, ('widget', 'container'))
|
self._parseChilds(cont, node, ('widget', 'container'))
|
||||||
try:
|
try:
|
||||||
|
|
@ -312,7 +312,7 @@ class XMLUI(object):
|
||||||
ctrl = self.widget_factory.createButtonWidget(parent, value, self.onButtonPress)
|
ctrl = self.widget_factory.createButtonWidget(parent, value, self.onButtonPress)
|
||||||
ctrl._xmlui_param_id = (callback_id,[field.getAttribute('name') for field in node.getElementsByTagName("field_back")])
|
ctrl._xmlui_param_id = (callback_id,[field.getAttribute('name') for field in node.getElementsByTagName("field_back")])
|
||||||
else:
|
else:
|
||||||
error(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_)
|
print(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_)
|
||||||
raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_)
|
raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_)
|
||||||
|
|
||||||
if self.type == 'param':
|
if self.type == 'param':
|
||||||
|
|
@ -321,7 +321,7 @@ class XMLUI(object):
|
||||||
ctrl._param_category = self._current_category
|
ctrl._param_category = self._current_category
|
||||||
except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError
|
except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError
|
||||||
if not isinstance(ctrl, (EmptyWidget, TextWidget, LabelWidget, JidWidget)):
|
if not isinstance(ctrl, (EmptyWidget, TextWidget, LabelWidget, JidWidget)):
|
||||||
warning(_("No change listener on [%s]" % ctrl))
|
print(_("No change listener on [%s]") % ctrl)
|
||||||
|
|
||||||
ctrl._xmlui_name = name
|
ctrl._xmlui_name = name
|
||||||
parent._xmluiAppend(ctrl)
|
parent._xmluiAppend(ctrl)
|
||||||
|
|
@ -384,7 +384,7 @@ class XMLUI(object):
|
||||||
try:
|
try:
|
||||||
name = self.escape(wid._xmlui_name)
|
name = self.escape(wid._xmlui_name)
|
||||||
value = wid._xmluiGetValue()
|
value = wid._xmluiGetValue()
|
||||||
ret[name] = value
|
data[name] = value
|
||||||
except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError
|
except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError
|
||||||
pass
|
pass
|
||||||
idx = ctrl._xmluiGetSelectedIndex()
|
idx = ctrl._xmluiGetSelectedIndex()
|
||||||
|
|
@ -392,7 +392,7 @@ class XMLUI(object):
|
||||||
data['index'] = idx
|
data['index'] = idx
|
||||||
callback_id = ctrl._xmlui_callback_id
|
callback_id = ctrl._xmlui_callback_id
|
||||||
if callback_id is None:
|
if callback_id is None:
|
||||||
warning(_("No callback_id found"))
|
print(_("No callback_id found"))
|
||||||
return
|
return
|
||||||
self._xmluiLaunchAction(callback_id, data)
|
self._xmluiLaunchAction(callback_id, data)
|
||||||
|
|
||||||
|
|
@ -433,15 +433,14 @@ class XMLUI(object):
|
||||||
self._xmluiLaunchAction(self.submit_id, data)
|
self._xmluiLaunchAction(self.submit_id, data)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
warning (_("The form data is not sent back, the type is not managed properly"))
|
print(_("The form data is not sent back, the type is not managed properly"))
|
||||||
self._xmluiClose()
|
self._xmluiClose()
|
||||||
|
|
||||||
def onFormCancelled(self, ignore=None):
|
def onFormCancelled(self, ignore=None):
|
||||||
""" Called when a form is cancelled """
|
""" Called when a form is cancelled """
|
||||||
debug(_("Cancelling form"))
|
print(_("Cancelling form"))
|
||||||
self._xmluiClose()
|
self._xmluiClose()
|
||||||
|
|
||||||
|
|
||||||
def onSaveParams(self, ignore=None):
|
def onSaveParams(self, ignore=None):
|
||||||
""" Params are saved, we send them to backend
|
""" Params are saved, we send them to backend
|
||||||
self.type must be param
|
self.type must be param
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue