#!/usr/bin/env python
#############################################################################
##
# This file is part of Taurus
##
# http://taurus-scada.org
##
# Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
##
# Taurus is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
##
# Taurus is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
##
# You should have received a copy of the GNU Lesser General Public License
# along with Taurus. If not, see
%s" % error msgbox.setDetailedHtml(msg) html_orig = '' \ '' exc_info = "".join(traceback.format_exception(err_type, err_value, err_traceback)) style = "" if pygments is not None: formatter = HtmlFormatter() style = formatter.get_style_defs() html = html_orig.format(style=style) if pygments is None: html += "
%s" % exc_info else: formatter = HtmlFormatter() html += highlight(exc_info, PythonTracebackLexer(), formatter) html += "" msgbox.setOriginHtml(html) class TangoMessageErrorHandler(TaurusMessageErrorHandler): """This class is designed to handle :class:`PyTango.DevFailed` error into a :class:`TaurusMessagePanel`""" # TODO: tango-centric def setError(self, err_type=None, err_value=None, err_traceback=None): """Translates the given error object into an HTML string and places it it the message panel :param error: an error object (typically an exception object) :type error: object""" msgbox = self._msgbox html_orig = '' \ '' style, formatter = "", None if pygments is not None: formatter = HtmlFormatter() style = formatter.get_style_defs() html = html_orig.format(style=style) for de in err_value.args: e_html = """
{reason}: {desc}{origin}
%s" % origin html += e_html.format(desc=desc, origin=origin, reason=reason) html += "" msgbox.setText(err_value.args[0].desc) msgbox.setDetailedHtml(html) exc_info = "".join(traceback.format_exception(err_type, err_value, err_traceback)) html = html_orig.format(style=style) if pygments is None: html += "
%s" % exc_info else: html += highlight(exc_info, PythonTracebackLexer(), formatter) html += "