--- a/etherlab/etherlab.py Fri Sep 28 18:00:50 2018 +0300
+++ b/etherlab/etherlab.py Fri Sep 28 18:04:28 2018 +0300
@@ -34,9 +34,11 @@
EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd"))
EtherCATInfo_XPath = lambda xpath: etree.XPath(xpath)
+
def HexDecValue(context, *args):
return str(ExtractHexDecValue(args[0][0]))
+
def EntryName(context, *args):
return ExtractName(args[0],
args[1][0] if len(args) > 1 else None)
@@ -53,6 +55,7 @@
("PDO name", str, ""),
("PDO type", str, "")]
+
class EntryListFactory:
def __init__(self, entries):
@@ -128,6 +131,7 @@
return sync_managers
setattr(cls, "GetSyncManagers", GetSyncManagers)
+
def GroupItemCompare(x, y):
if x["type"] == y["type"]:
if x["type"] == ETHERCAT_GROUP:
@@ -138,12 +142,14 @@
return -1
return 1
+
def SortGroupItems(group):
for item in group["children"]:
if item["type"] == ETHERCAT_GROUP:
SortGroupItems(item)
group["children"].sort(GroupItemCompare)
+
class ModulesLibrary:
MODULES_EXTRA_PARAMS = [
@@ -384,6 +390,7 @@
ModulesDatabase = ModulesLibrary(
os.path.join(USERDATA_DIR, "ethercat_modules"))
+
class RootClass:
CTNChildrenTypes = [("EthercatNode",_EthercatCTN,"Ethercat Master")]