Commit 7062974a authored by Matias Guijarro's avatar Matias Guijarro Committed by Wout De Nolf

new SetParameters command

parent e6c21c0a
......@@ -44,6 +44,7 @@ __docformat__ = 'restructuredtext'
import tango
import sys
import ast
# Add additional import
#----- PROTECTED REGION ID(MetadataManager.additionnal_import) ENABLED START -----#
import os.path
......@@ -832,6 +833,30 @@ class MetadataManager (tango.LatestDeviceImpl):
self.warn_stream("Error retrieving poll value: %s" %e)
beat = 0
def SetParameters(self, python_dict):
d = ast.literal_eval(python_dict)
class AlreadySuppliedParameterDefinition(ParameterDefinition):
def __init__(self, name, value):
self.value = value
def isRemote(self):
# we fool the thing to think it is a remote param => will call 'buildValue'
return True
def buildValue(self, *args, **kwargs):
return self.value
for k, v in d.items():
# k in our case is the parameter name (like: "TOMO_comment" for example or "Sample_name")
# v is supposed to be the parameter value
d[k] = AlreadySuppliedParameterDefinition(k, v)
# this will overwrite existing parameter definition map... Is it a problem?
self.parameterDefinitionMap = d
# Gets the parameters defined on the parameters list in the tango device
# Return List<Parameter>
......@@ -1149,6 +1174,10 @@ class MetadataManagerClass(tango.DeviceClass):
[tango.DevVoid, "none"]]
"SetParameters": [
[tango.DevString, "String representation of Python dictionary"],
[tango.DevVoid, "none"],
# Attribute definitions
attr_list = {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment