#python script
from connect2j import scriptContext
from sys import argv

with scriptContext('widget', dict=globals()):
    print("Updating widget %s" % widget.getName())
    widget.setPropertyValue("text", "Hello")
#executed with native python
""" Input:
    pvs[0] - PV name to use
"""
from connect2j import scriptContext

with scriptContext('widget', 'pvs', PVUtil='util', dict=globals()):
    value = util.getString(pvs[0]); #PVUtil imported as 'util'
    # print "update_pv_name.py: Name is %s" % value
    widget.setPropertyValue("pv_name", value)
Пример #3
0
#executed with native python
""" Input:
    pvs[0] - Value around -5 .. 5
    pvs[1] - Default value for X
    pvs[2] - Scaling factor
"""
from connect2j import scriptContext

with scriptContext('widget', 'pvs', 'PVUtil', dict=globals()):
    value = PVUtil.getDouble(pvs[0])
    x0 = PVUtil.getDouble(pvs[1])
    scale = PVUtil.getDouble(pvs[2])
    widget.setPropertyValue("x", x0 + scale * value)
#python script
from connect2j import scriptContext
from sys import argv

with scriptContext('widget', dict=globals()):
    print("Updating widget %s" % widget.getName())
    widget.setPropertyValue("text", "Hello");