# `TaurusMessageBox`

digraph inheritance73f480411a { bgcolor=transparent; rankdir=UD; ratio=compress; size="8.0, 12.0"; "QDialog" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QDialog(parent: QWidget|None = None, flags: Qt.WindowFlags|Qt.WindowType = Qt.WindowFlags())"]; "QWidget" -> "QDialog" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QObject" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QObject(parent: QObject|None = None)"]; "wrapper" -> "QObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QPaintDevice()"]; "simplewrapper" -> "QPaintDevice" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QWidget" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,tooltip="QWidget(parent: QWidget|None = None, flags: Qt.WindowFlags|Qt.WindowType = Qt.WindowFlags())"]; "QObject" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "QPaintDevice" -> "QWidget" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TaurusMessageBox" [URL="#taurus.qt.qtgui.dialog.TaurusMessageBox",color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded,target="_top",tooltip="A panel intended to display a taurus error."]; "QDialog" -> "TaurusMessageBox" [arrowsize=0.5,style="setlinewidth(0.5)"]; "simplewrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "wrapper" [color=dodgerblue1,fillcolor=white,fontcolor=black,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.5,shape=box,style=rounded]; "simplewrapper" -> "wrapper" [arrowsize=0.5,style="setlinewidth(0.5)"]; }

class TaurusMessageBox(err_type=None, err_value=None, err_traceback=None, parent=None, designMode=False)

  A panel intended to display a taurus error. Example:

      dev = taurus.Device("sys/tg_test/1")
      try:
          print(dev.read_attribute("throw_exception"))
      except PyTango.DevFailed, df:
          msgbox = TaurusMessageBox()
          msgbox.show()

  You can show the error outside the exception handling code. If you do this, you should keep a record of the exception information as given by `sys.exc_info()`:

      dev = taurus.Device("sys/tg_test/1")
      exc_info = None
      try:
          print(dev.read_attribute("throw_exception"))
      except PyTango.DevFailed, df:
          exc_info = sys.exc_info()

      if exc_info:
          msgbox = TaurusMessageBox(*exc_info)
          msgbox.show()

  Import from `taurus.qt.qtgui.dialog` as:

      from taurus.qt.qtgui.dialog import TaurusMessageBox

  addButton(button, role=3)

    Adds the given button with the given to the button box

    Parameters:

      - button (PyQt5.Qt.QPushButton) – the button to be added

      - role (PyQt5.Qt.QDialogButtonBox.ButtonRole) – button role

  getText()

    Returns the current text of this panel

    Returns:

      the text for this panel

    Return type:

      str

  panel()

    Returns the `taurus.qt.qtgui.panel.TaurusMessagePanel`.

    Returns:

      the internal panel

    Return type:

      taurus.qt.qtgui.panel.TaurusMessagePanel

  setDetailedText(text)

    Sets the detailed text of the dialog

    Parameters:

      text (str) – the new text

  setError(err_type=None, err_value=None, err_traceback=None)

    Sets the exception object. Example usage:

        dev = taurus.Device("sys/tg_test/1")
        exc_info = None
        msgbox = TaurusMessageBox()
        try:
            print(dev.read_attribute("throw_exception"))
        except PyTango.DevFailed, df:
            exc_info = sys.exc_info()

        if exc_info:
            msgbox.setError(*exc_info)
            msgbox.show()

    Parameters:

      - err_type – the exception type of the exception being handled (a class object)

      - err_value (object) – exception object

      - err_traceback (TracebackType) – a traceback object which encapsulates the call stack at the point where the exception originally occurred

  setIconPixmap(pixmap)

    Sets the icon to the dialog

    Parameters:

      pixmap (PyQt5.Qt.QPixmap) – the icon pixmap

  setText(text)

    Sets the text of the dialog

    Parameters:

      text (str) – the new text