本文整理汇总了Python中org.csstudio.opibuilder.scriptUtil.PVUtil.getStringArray方法的典型用法代码示例。如果您正苦于以下问题:Python PVUtil.getStringArray方法的具体用法?Python PVUtil.getStringArray怎么用?Python PVUtil.getStringArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.csstudio.opibuilder.scriptUtil.PVUtil
的用法示例。
在下文中一共展示了PVUtil.getStringArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_visible
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getStringArray [as 别名]
from org.csstudio.opibuilder.scriptUtil import PVUtil
indices = [0, 1, 2]
positions = PVUtil.getStringArray(pvs[0])
def get_visible(index):
"""
Args:
index: The index of the set point
Returns: True if a motion set point with this index exists, False otherwise.
"""
if not positions:
return False
elif len(positions) <= index + 1:
return False
return True
def set_macros(widget, index):
"""
Sets the proper index and name macros on the LED indicator widgets for a given motion setpoint.
Args:
widget: The target widget
index: The index of the motion set point
"""
macros = widget.getPropertyValue("macros")
macros.put("INDEX", str(index))
macros.put("POS", positions[index].strip())
示例2: _add_macros
# 需要导入模块: from org.csstudio.opibuilder.scriptUtil import PVUtil [as 别名]
# 或者: from org.csstudio.opibuilder.scriptUtil.PVUtil import getStringArray [as 别名]
widget.setPropertyValue("opi_file", "param_move.opi")
def _add_macros(widget_index, name, value):
"""
Add the macro with name to a motor widget with value.
Widgets are identified as "Motor_n" for n in [1,8] in the parent OPI
Args:
widget_index: index of the widget
name: macro name
value: macro value
"""
motor_widget = display.getWidget("pos_" + str(widget_index))
motor_macros = motor_widget.getPropertyValue("macros")
motor_macros.put(name, value)
motor_widget.setPropertyValue("macros", motor_macros)
motor_widget.setPropertyValue("visible", True)
value = PVUtil.getStringArray(pvs[0])
value = "".join(chr(int(i)) for i in value[:-1])
value = zlib.decompress(value.decode("hex"))
params = json.loads(value)
pos = 1
for pv, name in params.items():
_add_macros(pos, "PARAM_PV", pv)
_add_macros(pos, "PARAM_NAME", name)
pos += 1
reload_widgets(pos)