Using your own widgets derived from Taurus base classes

The following example demonstrates how widgets displaying devices of the OmsVme58 server class are configured with an update period of 300 msecs. This is done by creating a new class, TaurusValueHB, derived from TaurusValue.

Figure 7.41: taurusform: replacing taurus widgets
\includegraphics[width=12.98cm]{heartbeatform.ps}

The code:

from taurus.qt.qtgui.taurusgui.utils import PanelDescription,\
    ExternalApp, ToolBarDescription, AppletDescription

from taurus.qt.qtgui.panel.taurusform import TaurusForm

GUI_NAME = 'heartbeatform'
ORGANIZATION = 'DESY'


dcm_motor_control = PanelDescription(
    'DCM motor control',
    classname = 'TaurusForm',
    model = ['tango://haso228k:10000/p09/motor/exp.29',
             'tango://haso228k:10000/p09/motor/exp.30'])


if __name__ == '__main__':
    from taurus.qt.qtgui.application import TaurusApplication
    from taurus.qt.qtgui.taurusgui import TaurusGui
    from taurus.external.qt import Qt
    app = TaurusApplication()
    gui = TaurusGui()
    cwmap = gui.getCustomWidgetMap()
    cwmap.update({
        'OmsVme58': ('nxstaurusgui.heartbeat.TaurusValueHB', (),
                     {'period': 300, 'attr': 'position'}),
    })
    gui.setCustomWidgetMap(cwmap)
    gui.loadConfiguration(__file__)
    gui.show()
    app.exec_()

In the above example:

2019-11-13