Finishing the Sardana configuration: /online_dir/

The file /online_dir/ is executed at the end of the script. This is an example:

# /online_dir/
import PyTango
import HasyUtils
import sys

print "\n--- executing %s \n" % __file__

# change the configuration of several attributes
devices = { "motor/omsvme58_d1/1": 
            { "Position": { "Label": "Ort1",  "Format": "%12g", "Unit": "mm"},
              "Offset": { "Label": "Aufsatz", "Format": "%11g", "Unit": "mm"},
            { "Position": { "Label": "Ort2", "Format": "%12g", "Unit": "Degree"},
              "Offset": { "Label": "Aufsatz2", "Format": "%11g", "Unit": "Degree"},
for dev in devices.keys():
    print "device", dev
        proxy = PyTango.DeviceProxy( dev)
        print "The attribute configuration failed for %s" % dev
    for attr in devices[dev].keys():
        print " ",attr
        attrInfo = proxy.get_attribute_config( attr)
        for attrCfg in devices[dev][attr].keys():
            temp = "attrInfo.%s = \"%s\"" % (attrCfg.lower(), devices[dev][attr][attrCfg])
            print "  ",temp
            exec temp            
        proxy.set_attribute_config( attrInfo)
# Set some view options
    [ "setvo ShowDial False",
      "setvo ShowCtrlAxis True"])
# Set some environment variables. 'Cautious' means that variables
# are not overridden, if the exist already
    {"JsonRecorder": "True", 
     "ScanDir": "/home/kracht/temp", 
     "ScanFile": "tst.fio"})

sys.exit( 0)

To overwrite the MacroPath property of the MacroServer, maybe during the development of new Macros, the following lines have to be added before sys.exit().


HasyUtils.putDeviceProperty( 'p17/macroserver/haspp17.01',

HasyUtils.restartServer( 'MacroServer/haspp17')