示例#1
0
def set_push_events(filein, period=3000, diff=1e-5):
    print('set_push_events(%s,%s,%s)' % (filein, period, diff))
    devs = fandango.get_matching_devices(filein)
    if devs:
        devs = dict(
            (d,
             fandango.Struct(
                 {'attrs': fandango.get_device(d).get_attribute_list()}))
            for d in devs)
    else:
        devs = pickle.load(open(filein))
    for d, t in sorted(devs.items()):
        print('Setting events (%s,%s) for %s' % (period, diff, d))
        dp = PyTango.DeviceProxy(d)
        for a in t.attrs:
            dp.poll_attribute(a, int(period))
            if period > 0:
                ac = dp.get_attribute_config(a)
                cei = PyTango.ChangeEventInfo()
                cei.rel_change = str(diff)
                ac.events.ch_event = cei
                try:
                    dp.set_attribute_config(ac)
                except:
                    pass
    print('done')
示例#2
0
def set_push_events(filein, period=3000, diff=1e-5):
    print('set_push_events(%s,%s,%s)' % (filein, period, diff))
    devs = fd.get_matching_devices(filein)
    for d in devs[:]:
        if not check_device(d):
            q = raw_input('Unable to configure events for %s, '
                          'do you wish to continue?' % d).lower()
            if 'y' not in q: return
            devs.remove(d)

    if devs:
        devs = dict(
            (d, fd.Struct({'attrs': fd.get_device(d).get_attribute_list()}))
            for d in devs)
    else:
        devs = pickle.load(open(filein))
    for d, t in sorted(devs.items()):
        print('Setting events (%s,%s) for %s' % (period, diff, d))
        try:
            dp = PyTango.DeviceProxy(d)
            for a in t.attrs:
                dp.poll_attribute(a, int(period))
                if period > 0:
                    ac = dp.get_attribute_config(a)
                    cei = PyTango.ChangeEventInfo()
                    cei.rel_change = str(diff)
                    ac.events.ch_event = cei
                    try:
                        dp.set_attribute_config(ac)
                    except:
                        pass
        except:
            q = raw_input('Unable to configure events for %s, '
                          'do you wish to continue?' % d)
            if 'y' not in q.lower():
                break
    print('done')
示例#3
0
import imp, fandango
from vacca.utils import *
try:
    from vaccagui.beamlines import *
except:
    from beamlines import *

#The device that will be shown by default when loading the application
COMPOSER = DEVICE = fandango.get_matching_devices('BL00/VC/ALL')[0]
DEVICE = 'BL00/CT/ALARMS'
DOMAIN = BL = COMPOSER.split('/')[0]
URL_HELP = 'http://controls01/vacca/index.html'

print '>' * 20 + ' Loading config for beamline %s' % BL

#DEFINING THE DEVICES IN THE TREE
EXTRA_DEVICES = [
    d for d in (fandango.get_matching_devices(
        '(bl|fe)00*(pnv|eps|vfcs|ccg|tpg|mvc|pir|elotech|bestec|/hc-|/ip-|rga|ipct|vgct|bakeout|tsp|cry|fcv|fs-|otr|vc/all|alarm)*',
        fullname=False))
    if not any(s in d.lower()
               for s in ('dserver', 'mbus', 'serial', 'ccd', 'iba'))
]

#DEFINING THE GAUGES IN THE TREND
GAUGES = [
    'BL00/VC/VGCT-01/P1',
    'BL00/VC/VGCT-01/P2',
    'BL00/VC/VGCT-02/P1',
    'BL00/VC/VGCT-02/P2',
    'BL00/VC/TPG-01/P1',
示例#4
0
JDRAW_HOOK = None  #lambda s: apply_transform(get_coordinates(s))
# Enable multiple selection of objects in Synoptic
#from taurus.qt.qtgui.graphic import TaurusGraphicsScene
#TaurusGraphicsScene.ANY_ATTRIBUTE_SELECTS_DEVICE = True

###############################################################################
# Setup of the tree

#Domain/Target used to generate grids/trees ; domain may be regexp, target should not
DOMAIN = 'elinac*'
TARGET = DOMAIN
USE_DEVICE_TREE = True

#Devices not in JDraw or regular expression to be added to the tree
EXTRA_DEVICES = fandango.get_matching_devices(
    'elin*'
)  #map(bool,set(['%s/VC/ALL'%TARGET,'%s/CT/ALARMS'%TARGET,DEVICE,COMPOSER]))

#Custom tree branches are built using nested dictionaries and regular expressions (if empty a jive-like tree is built).
CUSTOM_TREE = {}
# {'CT':'BL*(CT|ALARMS|PLC)$',
#  'FE':'FE*/VC/*',
#  'Valves': {'.OH':'*OH/PNV*',
#             'EH01':'*EH01/PNV*',},
#  'BAKEOUTS':'BL*(BAKE|BK)*',}

###############################################################################
# Device Panel setup

#PyStateComposer to get Vacuum Profile curves
COMPOSER = ''  #'%s/vc/all'%DOMAIN
示例#5
0
            self._pickedMarker.setLabel(Qwt5.QwtText(label))
            self._pickedMarker.alignLabel()
            self.replot()
        else:
            popup = Qt.QWidget(self, Qt.Qt.Popup)
            popup.setLayout(Qt.QVBoxLayout())
            popup.layout().addWidget(
                Qt.QLabel(infotxt)
            )  #@todo: make the widget background semitransparent green!
            popup.setWindowOpacity(self._pickedMarker.labelOpacity)
            popup.show()
            popup.move(self.pos().x() - popup.size().width(), self.pos().y())
            popup.move(self.pos())
            Qt.QTimer.singleShot(5000, popup.hide)

    return picked, pickedCurveName, pickedIndex


import doc
__doc__ = doc.get_autodoc(__name__, vars())

if __name__ == '__main__':
    import taurus.qt.qtgui.application
    app = taurus.qt.qtgui.application.TaurusApplication()
    cmps = fandango.get_matching_devices('*/vc/all')
    tp = VaccaProfilePlot()
    tp.setWindowTitle(cmps[0])
    tp.setModel(cmps[0])
    tp.show()
    app.exec_()