frontends (XMLUI): use of logging system instead of print
This commit is contained in:
parent
8ca72f8a9f
commit
0cbc88ac39
1 changed files with 8 additions and 6 deletions
|
|
@ -18,6 +18,8 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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 @@ class XMLUI(object):
|
|||
|
||||
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 @@ class XMLUI(object):
|
|||
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 @@ class XMLUI(object):
|
|||
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 @@ class XMLUI(object):
|
|||
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 @@ class XMLUI(object):
|
|||
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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue