Exemple #1
0
 def setModel(self, model):
     print '*' * 80
     self.info('VaccaProfilePlot.setModel(%s)' % model)
     print '*' * 80
     try:
         #if self._profile_loaded: return
         if fandango.isSequence(
                 model
         ) or 'attributename' in fandango.tango.parse_tango_model(model):
             self.info('setting an attribute model')
             TaurusPlot.setModel(self, model)  # model = model[0]# str(
             # model).rsplit('/',1)[0]
         else:
             self.info('setting a composer model')
             assert fandango.check_device(model)
             dev = taurus.Device(model)
             if all(a in map(str.lower, dev.get_attribute_list())
                    for a in ('ccgaxxis', 'ccgpressures', 'ipaxxis',
                              'ippressures', 'thermoaxxis', 'thermocouples',
                              'axxispositions', 'axxislabels')):
                 TaurusPlot.setModel(self, [])
                 setup_profile_plot(self, model)
             else:
                 self.warning('%s has not all required attributes' % model)
         if len(self._positions) and len(self._labels):
             self.info('Setting CustomXLabels ...')
             self.setAxisCustomLabels(Qwt5.QwtPlot.xBottom,
                                      zip(self._positions, self._labels),
                                      60)
     except Exception, e:
         self.warning('VaccaProfilePlot.setModel(%s) failed!: %s' %
                      (model, e))
#!/usr/bin/env python

import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.plot import TaurusPlot

app = Qt.QApplication(sys.argv)
##########################
# BEGUIN EXAMPLE CODE
##########################

panel = TaurusPlot()
model = ['sys/taurustest/1/abscissas', 'sys/taurustest/1/curve']
panel.setModel(model)

########################
# END EXAMPLE CODE
########################
panel.show()
sys.exit(app.exec_())