# HG changeset patch # User Goffi # Date 1403697718 -7200 # Node ID b3b7a286306073015182f22f15f16c92b81ffa32 # Parent 2cb30f46e5601ffe7d1fc2bcdde0a847c02d1f4f frontends (XMLUI): use of logging system instead of print diff -r 2cb30f46e560 -r b3b7a2863060 frontends/src/tools/xmlui.py --- a/frontends/src/tools/xmlui.py Wed Jun 25 14:01:57 2014 +0200 +++ b/frontends/src/tools/xmlui.py Wed Jun 25 14:01:58 2014 +0200 @@ -18,6 +18,8 @@ # along with this program. If not, see . from sat.core.i18n import _ +from sat.core.log import getLogger +log = getLogger(__name__) from sat_frontends.constants import Const from sat.core.exceptions import DataError @@ -259,7 +261,7 @@ self._parseChilds(cont, node, ('row',), data) else: - print(_("Unknown container [%s], using default one") % type_) + log.warning(_("Unknown container [%s], using default one") % type_) cont = self.widget_factory.createVerticalContainer(parent) self._parseChilds(cont, node, ('widget', 'container')) try: @@ -333,7 +335,7 @@ 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")]) else: - print(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_) + log.error(_("FIXME FIXME FIXME: widget type [%s] is not implemented") % type_) raise NotImplementedError(_("FIXME FIXME FIXME: type [%s] is not implemented") % type_) if self.type == 'param' and type_ not in ('text', 'button'): @@ -342,7 +344,7 @@ ctrl._param_category = self._current_category except (AttributeError, TypeError): # XXX: TypeError is here because pyjamas raise a TypeError instead of an AttributeError if not isinstance(ctrl, (EmptyWidget, TextWidget, LabelWidget, JidWidget)): - print(_("No change listener on [%s]") % ctrl) + log.warning(_("No change listener on [%s]") % ctrl) if type_ != 'text': callback = node.getAttribute("internal_callback") or None @@ -424,7 +426,7 @@ data['index'] = idx callback_id = ctrl._xmlui_callback_id if callback_id is None: - print(_("No callback_id found")) + log.info(_("No callback_id found")) return self._xmluiLaunchAction(callback_id, data) @@ -546,12 +548,12 @@ self._xmluiLaunchAction(self.submit_id, data) else: - print(_("The form data is not sent back, the type is not managed properly")) + log.warning(_("The form data is not sent back, the type is not managed properly")) self._xmluiClose() def onFormCancelled(self, ignore=None): """ Called when a form is cancelled """ - print(_("Cancelling form")) + log.debug(_("Cancelling form")) self._xmluiClose() def onSaveParams(self, ignore=None):