etherlab/etherlab.py
changeset 2356 c26e0c66d8d5
parent 2355 fec77f2b9e07
child 2357 7c67286cddbe
equal deleted inserted replaced
2355:fec77f2b9e07 2356:c26e0c66d8d5
    24 from EthercatMaster import _EthercatCTN
    24 from EthercatMaster import _EthercatCTN
    25 from ConfigEditor import LibraryEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
    25 from ConfigEditor import LibraryEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
    26 
    26 
    27 ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
    27 ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
    28 
    28 
    29 #--------------------------------------------------
    29 # --------------------------------------------------
    30 #                 Ethercat ConfNode
    30 #                 Ethercat ConfNode
    31 #--------------------------------------------------
    31 # --------------------------------------------------
    32 
    32 
    33 EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd"))
    33 EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd"))
    34 EtherCATInfo_XPath = lambda xpath: etree.XPath(xpath)
    34 EtherCATInfo_XPath = lambda xpath: etree.XPath(xpath)
    35 
    35 
    36 def HexDecValue(context, *args):
    36 def HexDecValue(context, *args):
   221 
   221 
   222                         vendor_category["groups"].setdefault(group_type,
   222                         vendor_category["groups"].setdefault(group_type,
   223                             {"name": ExtractName(group.getName(), group_type),
   223                             {"name": ExtractName(group.getName(), group_type),
   224                              "parent": group.getParentGroup(),
   224                              "parent": group.getParentGroup(),
   225                              "order": group.getSortOrder(),
   225                              "order": group.getSortOrder(),
   226                              #"value": group.getcontent()["value"],
   226                              # "value": group.getcontent()["value"],
   227                              "devices": []})
   227                              "devices": []})
   228 
   228                              
   229                     for device in self.devices_xpath(self.modules_infos):
   229                     for device in self.devices_xpath(self.modules_infos):
   230                         device_group = device.getGroupType()
   230                         device_group = device.getGroupType()
   231                         if not vendor_category["groups"].has_key(device_group):
   231                         if not vendor_category["groups"].has_key(device_group):
   232                             raise ValueError, "Not such group \"%\"" % device_group
   232                             raise ValueError, "Not such group \"%\"" % device_group
   233                         vendor_category["groups"][device_group]["devices"].append(
   233                         vendor_category["groups"][device_group]["devices"].append(