TaurusMessageBox

Inheritance diagram of TaurusMessageBox
class TaurusMessageBox(err_type=None, err_value=None, err_traceback=None, parent=None, designMode=False)[source]

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)[source]

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()[source]

Returns the current text of this panel

Returns:

the text for this panel

Return type:

str

panel()[source]

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

Returns:

the internal panel

Return type:

taurus.qt.qtgui.panel.TaurusMessagePanel

setDetailedText(text)[source]

Sets the detailed text of the dialog

Parameters:

text (str) – the new text

setError(err_type=None, err_value=None, err_traceback=None)[source]

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)[source]

Sets the icon to the dialog

Parameters:

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

setText(text)[source]

Sets the text of the dialog

Parameters:

text (str) – the new text