etherlab/etherlab.py
author Laurent Bessard
Tue, 24 Sep 2013 15:18:25 +0200
changeset 2159 93797d4303a3
parent 2157 a2385e535cf5
child 2160 75349c51a34b
permissions -rw-r--r--
Fixed bug when compiling
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
     1
import os, shutil
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
     2
from lxml import etree
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
     3
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
     4
import wx
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
     5
import csv
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
     6
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
     7
from xmlclass import *
2111
f2cffda17d00 Split etherlab.py into multiple files
Laurent Bessard
parents: 2109
diff changeset
     8
2048
5726f2bbdace reflected changes in beremiz extension mechanism
Edouard Tisserant
parents: 2047
diff changeset
     9
from ConfigTreeNode import ConfigTreeNode
5726f2bbdace reflected changes in beremiz extension mechanism
Edouard Tisserant
parents: 2047
diff changeset
    10
from PLCControler import UndoBuffer, LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP, LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY
2111
f2cffda17d00 Split etherlab.py into multiple files
Laurent Bessard
parents: 2109
diff changeset
    11
f2cffda17d00 Split etherlab.py into multiple files
Laurent Bessard
parents: 2109
diff changeset
    12
from EthercatSlave import ExtractHexDecValue, ExtractName
f2cffda17d00 Split etherlab.py into multiple files
Laurent Bessard
parents: 2109
diff changeset
    13
from EthercatMaster import _EthercatCTN
f2cffda17d00 Split etherlab.py into multiple files
Laurent Bessard
parents: 2109
diff changeset
    14
from ConfigEditor import LibraryEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
    15
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    16
ScriptDirectory = os.path.split(os.path.realpath(__file__))[0]
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    17
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
    18
#--------------------------------------------------
2048
5726f2bbdace reflected changes in beremiz extension mechanism
Edouard Tisserant
parents: 2047
diff changeset
    19
#                 Ethercat ConfNode
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
    20
#--------------------------------------------------
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
    21
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    22
EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd")) 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    23
EtherCATInfo_XPath = lambda xpath: etree.XPath(xpath)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    24
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    25
def extract_param(el):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    26
    if el.tag == "Index":
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    27
        return "#x%4.4X" % int(el.text)
2159
93797d4303a3 Fixed bug when compiling
Laurent Bessard
parents: 2157
diff changeset
    28
    elif el.tag == "BitSize":
93797d4303a3 Fixed bug when compiling
Laurent Bessard
parents: 2157
diff changeset
    29
        if el.text is None:
93797d4303a3 Fixed bug when compiling
Laurent Bessard
parents: 2157
diff changeset
    30
            return 0
93797d4303a3 Fixed bug when compiling
Laurent Bessard
parents: 2157
diff changeset
    31
        return int(el.text)
93797d4303a3 Fixed bug when compiling
Laurent Bessard
parents: 2157
diff changeset
    32
    elif el.tag == "PDOMapping":
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    33
        if el.text is None:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    34
            return ""
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    35
        return el.text.upper()
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    36
    if el.text is None:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    37
        return ""
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    38
    return el.text
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    39
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    40
def extract_pdo_infos(pdo_infos):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    41
    return {
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    42
        pdo_infos.tag + " " + el.tag: extract_param(el)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    43
        for el in pdo_infos}
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    44
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    45
def HexDecValue(ctxt, values):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    46
    return str(ExtractHexDecValue(values[0]))
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    47
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    48
def EntryName(ctxt, values):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    49
    default=None
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    50
    names = []
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    51
    for element in values:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    52
        if element.tag == "Default":
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    53
            default = element.text
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    54
        else:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    55
            names.append(element)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    56
    return ExtractName(names, default)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    57
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    58
class AddEntry(etree.XSLTExtension):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    59
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    60
    def __init__(self, entries):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    61
        etree.XSLTExtension.__init__(self)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    62
        self.Entries = entries
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    63
    
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    64
    def execute(self, context, self_node, input_node, output_parent):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    65
        infos = etree.Element('entry_infos')
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    66
        self.process_children(context, infos)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    67
        index, subindex = map(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    68
            lambda x: int(infos.find(x).text),
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    69
            ["Index", "SubIndex"])
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    70
        new_entry_infos = {
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    71
            el.tag: extract_param(el)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    72
            for el in infos if el.tag != "PDO"}
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    73
        if (index, subindex) != (0, 0):
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    74
            entry_infos = self.Entries.get((index, subindex))
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    75
            if entry_infos is not None:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    76
                PDO_infos = infos.find("PDO")
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    77
                if PDO_infos is not None:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    78
                    entry_infos.update(extract_pdo_infos(PDO_infos))
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    79
            else:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    80
                self.Entries[(index, subindex)] = new_entry_infos
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    81
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    82
entries_list_xslt = etree.parse(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    83
    os.path.join(ScriptDirectory, "entries_list.xslt"))
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    84
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    85
cls = EtherCATInfoParser.GetElementClass("DeviceType")
2074
bf2fa4cb62a9 Adding support for loading Profile dictionaries only if needed
Laurent Bessard
parents: 2073
diff changeset
    86
if cls:
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    87
    
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    88
    profile_numbers_xpath = EtherCATInfo_XPath("Profile/ProfileNo")
2032
766078d83e22 Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents: 2031
diff changeset
    89
    def GetProfileNumbers(self):
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
    90
        return [number.text for number in profile_numbers_xpath(self)]
2032
766078d83e22 Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents: 2031
diff changeset
    91
    setattr(cls, "GetProfileNumbers", GetProfileNumbers)
766078d83e22 Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents: 2031
diff changeset
    92
    
2079
49242019a9ca Fix C code Generator to use CoE section contained in the slave ESI file for defining Ethercat network configuration
Laurent Bessard
parents: 2077
diff changeset
    93
    def getCoE(self):
2032
766078d83e22 Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents: 2031
diff changeset
    94
        mailbox = self.getMailbox()
2079
49242019a9ca Fix C code Generator to use CoE section contained in the slave ESI file for defining Ethercat network configuration
Laurent Bessard
parents: 2077
diff changeset
    95
        if mailbox is not None:
49242019a9ca Fix C code Generator to use CoE section contained in the slave ESI file for defining Ethercat network configuration
Laurent Bessard
parents: 2077
diff changeset
    96
            return mailbox.getCoE()
49242019a9ca Fix C code Generator to use CoE section contained in the slave ESI file for defining Ethercat network configuration
Laurent Bessard
parents: 2077
diff changeset
    97
        return None
49242019a9ca Fix C code Generator to use CoE section contained in the slave ESI file for defining Ethercat network configuration
Laurent Bessard
parents: 2077
diff changeset
    98
    setattr(cls, "getCoE", getCoE)
2032
766078d83e22 Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents: 2031
diff changeset
    99
2098
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   100
    def GetEntriesList(self, limits=None):
2029
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   101
        entries = {}
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   102
        
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   103
        entries_list_xslt_tree = etree.XSLT(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   104
            entries_list_xslt, extensions = {
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   105
                ("entries_list_ns", "add_entry"): AddEntry(entries),
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   106
                ("entries_list_ns", "HexDecValue"): HexDecValue,
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   107
                ("entries_list_ns", "EntryName"): EntryName})
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   108
        entries_list_xslt_tree(self, **dict(zip(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   109
            ["min_index", "max_index"], 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   110
            map(lambda x: etree.XSLT.strparam(str(x)),
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   111
                limits if limits is not None else [0x0000, 0xFFFF])
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   112
            )))
2029
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   113
        
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   114
        return entries
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   115
    setattr(cls, "GetEntriesList", GetEntriesList)
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   116
2029
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   117
    def GetSyncManagers(self):
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   118
        sync_managers = []
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   119
        for sync_manager in self.getSm():
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   120
            sync_manager_infos = {}
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   121
            for name, value in [("Name", sync_manager.getcontent()),
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   122
                                ("Start Address", sync_manager.getStartAddress()),
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   123
                                ("Default Size", sync_manager.getDefaultSize()),
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   124
                                ("Control Byte", sync_manager.getControlByte()),
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   125
                                ("Enable", sync_manager.getEnable())]:
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   126
                if value is None:
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   127
                    value =""
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   128
                sync_manager_infos[name] = value
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   129
            sync_managers.append(sync_manager_infos)
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   130
        return sync_managers
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   131
    setattr(cls, "GetSyncManagers", GetSyncManagers)
7c848efa21c6 Adding support for displaying slave sync managers and profile object dictionary and for arbitrarily mapping variable through variable location
laurent
parents: 2026
diff changeset
   132
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   133
def GroupItemCompare(x, y):
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   134
    if x["type"] == y["type"]:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   135
        if x["type"] == ETHERCAT_GROUP:
2031
c6f32810723e Fix some issues regarding arbitrary variable mapping
laurent
parents: 2030
diff changeset
   136
            return cmp(x["order"], y["order"])
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   137
        else:
2031
c6f32810723e Fix some issues regarding arbitrary variable mapping
laurent
parents: 2030
diff changeset
   138
            return cmp(x["name"], y["name"])
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   139
    elif x["type"] == ETHERCAT_GROUP:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   140
        return -1
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   141
    return 1
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   142
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   143
def SortGroupItems(group):
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   144
    for item in group["children"]:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   145
        if item["type"] == ETHERCAT_GROUP:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   146
            SortGroupItems(item)
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   147
    group["children"].sort(GroupItemCompare)
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   148
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   149
class ModulesLibrary:
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   150
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   151
    MODULES_EXTRA_PARAMS = [
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   152
        ("pdo_alignment", {
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   153
            "column_label": _("PDO alignment"), 
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   154
            "column_size": 150,
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   155
            "default": 8,
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   156
            "description": _(
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   157
"Minimal size in bits between 2 pdo entries")}),
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   158
        ("max_pdo_size", {
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   159
            "column_label": _("Max entries by PDO"),
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   160
            "column_size": 150,
2139
1565239349a8 Added support for module extra params in EthercatCFileGenerator
Laurent Bessard
parents: 2138
diff changeset
   161
            "default": 255,
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   162
            "description": _(
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   163
"""Maximal number of entries mapped in a PDO
2139
1565239349a8 Added support for module extra params in EthercatCFileGenerator
Laurent Bessard
parents: 2138
diff changeset
   164
including empty entries used for PDO alignment""")}),
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   165
        ("add_pdo", {
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   166
            "column_label": _("Creating new PDO"), 
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   167
            "column_size": 150,
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   168
            "default": 0,
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   169
            "description": _(
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   170
"""Adding a PDO not defined in default configuration
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   171
for mapping needed location variables
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   172
(1 if possible)""")})
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   173
    ]
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   174
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   175
    def __init__(self, path, parent_library=None):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   176
        self.Path = path
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   177
        if not os.path.exists(self.Path):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   178
            os.makedirs(self.Path)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   179
        self.ParentLibrary = parent_library
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   180
        
2098
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   181
        if parent_library is not None:
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   182
            self.LoadModules()
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   183
        else:
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   184
            self.Library = None
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   185
        self.LoadModulesExtraParams()
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   186
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   187
    def GetPath(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   188
        return self.Path
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   189
    
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   190
    def GetModulesExtraParamsFilePath(self):
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   191
        return os.path.join(self.Path, "modules_extra_params.cfg")
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   192
    
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   193
    groups_xpath = EtherCATInfo_XPath("Descriptions/Groups/Group")
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   194
    devices_xpath = EtherCATInfo_XPath("Descriptions/Devices/Device")
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   195
    def LoadModules(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   196
        self.Library = {}
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   197
        
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   198
        files = os.listdir(self.Path)
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   199
        for file in files:
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   200
            filepath = os.path.join(self.Path, file)
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   201
            if os.path.isfile(filepath) and os.path.splitext(filepath)[-1] == ".xml":
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   202
                self.modules_infos = None
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   203
                
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   204
                xmlfile = open(filepath, 'r')
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   205
                try:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   206
                    self.modules_infos = etree.fromstring(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   207
                        xmlfile.read(), EtherCATInfoParser)
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   208
                except:
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   209
                    pass
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   210
                xmlfile.close()
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   211
                
2152
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   212
                if self.modules_infos is not None:
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   213
                    vendor = self.modules_infos.getVendor()
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   214
                    
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   215
                    vendor_category = self.Library.setdefault(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   216
                        ExtractHexDecValue(vendor.getId()), 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   217
                        {"name": ExtractName(vendor.getName(), _("Miscellaneous")), 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   218
                         "groups": {}})
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   219
                    
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   220
                    for group in self.groups_xpath(self.modules_infos):
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   221
                        group_type = group.getType()
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   222
                        
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   223
                        vendor_category["groups"].setdefault(group_type, 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   224
                            {"name": ExtractName(group.getName(), group_type), 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   225
                             "parent": group.getParentGroup(),
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   226
                             "order": group.getSortOrder(), 
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   227
                             #"value": group.getcontent()["value"],
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   228
                             "devices": []})
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   229
                    
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   230
                    for device in self.devices_xpath(self.modules_infos):
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   231
                        device_group = device.getGroupType()
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   232
                        if not vendor_category["groups"].has_key(device_group):
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   233
                            raise ValueError, "Not such group \"%\"" % device_group
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   234
                        vendor_category["groups"][device_group]["devices"].append(
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   235
                            (device.getType().getcontent(), device))
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   236
2152
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   237
        return self.Library 
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   238
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   239
    def GetModulesLibrary(self, profile_filter=None):
2098
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   240
        if self.Library is None:
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   241
            self.LoadModules()
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   242
        library = []
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   243
        for vendor_id, vendor in self.Library.iteritems():
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   244
            groups = []
2073
d14ab97a452a Fix bug modules present in all groups with the same name even if they are defined by different vendors
Laurent Bessard
parents: 2069
diff changeset
   245
            children_dict = {}
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   246
            for group_type, group in vendor["groups"].iteritems():
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   247
                group_infos = {"name": group["name"],
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   248
                               "order": group["order"],
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   249
                               "type": ETHERCAT_GROUP,
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   250
                               "infos": None,
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   251
                               "children": children_dict.setdefault(group_type, [])}
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   252
                device_dict = {}
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   253
                for device_type, device in group["devices"]:
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   254
                    if profile_filter is None or profile_filter in device.GetProfileNumbers():
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   255
                        product_code = device.getType().getProductCode()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   256
                        revision_number = device.getType().getRevisionNo()
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   257
                        module_infos = {"device_type": device_type,
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   258
                                        "vendor": vendor_id,
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   259
                                        "product_code": product_code,
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   260
                                        "revision_number": revision_number}
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   261
                        module_infos.update(self.GetModuleExtraParams(vendor_id, product_code, revision_number))
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   262
                        device_infos = {"name": ExtractName(device.getName()),
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   263
                                        "type": ETHERCAT_DEVICE,
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   264
                                        "infos": module_infos,
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   265
                                        "children": []}
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   266
                        group_infos["children"].append(device_infos)
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   267
                        device_type_occurrences = device_dict.setdefault(device_type, [])
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   268
                        device_type_occurrences.append(device_infos)
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   269
                for device_type_occurrences in device_dict.itervalues():
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   270
                    if len(device_type_occurrences) > 1:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   271
                        for occurrence in device_type_occurrences:
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   272
                            occurrence["name"] += _(" (rev. %s)") % occurrence["infos"]["revision_number"]
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   273
                if len(group_infos["children"]) > 0:
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   274
                    if group["parent"] is not None:
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   275
                        parent_children = children_dict.setdefault(group["parent"], [])
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   276
                        parent_children.append(group_infos)
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   277
                    else:
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   278
                        groups.append(group_infos)
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   279
            if len(groups) > 0:
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   280
                library.append({"name": vendor["name"],
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   281
                                "type": ETHERCAT_VENDOR,
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   282
                                "infos": None,
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   283
                                "children": groups})
2031
c6f32810723e Fix some issues regarding arbitrary variable mapping
laurent
parents: 2030
diff changeset
   284
        library.sort(lambda x, y: cmp(x["name"], y["name"]))
2022
c2295d311402 First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff changeset
   285
        return library
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   286
2098
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   287
    def GetVendors(self):
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   288
        return [(vendor_id, vendor["name"]) for vendor_id, vendor in self.Library.items()]
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   289
    
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   290
    def GetModuleInfos(self, module_infos):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   291
        vendor = ExtractHexDecValue(module_infos["vendor"])
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   292
        vendor_infos = self.Library.get(vendor)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   293
        if vendor_infos is not None:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   294
            for group_name, group_infos in vendor_infos["groups"].iteritems():
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   295
                for device_type, device_infos in group_infos["devices"]:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   296
                    product_code = ExtractHexDecValue(device_infos.getType().getProductCode())
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   297
                    revision_number = ExtractHexDecValue(device_infos.getType().getRevisionNo())
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   298
                    if (product_code == ExtractHexDecValue(module_infos["product_code"]) and
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   299
                        revision_number == ExtractHexDecValue(module_infos["revision_number"])):
2152
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   300
                        self.cntdevice = device_infos 
e6946c298a42 Cherry-pick and re-commit to legitimate ancestor of commit 'Ethercat Management Function Refactoring Source by RTES Lab.' from youcu <youcu1022@gmail.com>
Edouard Tisserant
parents: 2149
diff changeset
   301
                        self.cntdeviceType = device_type  
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   302
                        return device_infos, self.GetModuleExtraParams(vendor, product_code, revision_number)
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   303
        return None, None
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   304
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   305
    def ImportModuleLibrary(self, filepath):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   306
        if os.path.isfile(filepath):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   307
            shutil.copy(filepath, self.Path)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   308
            self.LoadModules()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   309
            return True
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   310
        return False
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   311
    
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   312
    def LoadModulesExtraParams(self):
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   313
        self.ModulesExtraParams = {}
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   314
        
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   315
        csvfile_path = self.GetModulesExtraParamsFilePath()
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   316
        if os.path.exists(csvfile_path):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   317
            csvfile = open(csvfile_path, "rb")
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   318
            sample = csvfile.read(1024)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   319
            csvfile.seek(0)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   320
            dialect = csv.Sniffer().sniff(sample)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   321
            has_header = csv.Sniffer().has_header(sample)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   322
            reader = csv.reader(csvfile, dialect)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   323
            for row in reader:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   324
                if has_header:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   325
                    has_header = False
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   326
                else:
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   327
                    params_values = {}
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   328
                    for (param, param_infos), value in zip(
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   329
                        self.MODULES_EXTRA_PARAMS, row[3:]):
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   330
                        if value != "":
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   331
                            params_values[param] = int(value)
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   332
                    self.ModulesExtraParams[
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   333
                        tuple(map(int, row[:3]))] = params_values
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   334
            csvfile.close()
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   335
    
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   336
    def SaveModulesExtraParams(self):
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   337
        csvfile = open(self.GetModulesExtraParamsFilePath(), "wb")
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   338
        extra_params = [param for param, params_infos in self.MODULES_EXTRA_PARAMS]
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   339
        writer = csv.writer(csvfile, delimiter=';')
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   340
        writer.writerow(['Vendor', 'product_code', 'revision_number'] + extra_params)
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   341
        for (vendor, product_code, revision_number), module_extra_params in self.ModulesExtraParams.iteritems():
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   342
            writer.writerow([vendor, product_code, revision_number] + 
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   343
                            [module_extra_params.get(param, '') 
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   344
                             for param in extra_params])
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   345
        csvfile.close()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   346
    
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   347
    def SetModuleExtraParam(self, vendor, product_code, revision_number, param, value):
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   348
        vendor = ExtractHexDecValue(vendor)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   349
        product_code = ExtractHexDecValue(product_code)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   350
        revision_number = ExtractHexDecValue(revision_number)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   351
        
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   352
        module_infos = (vendor, product_code, revision_number)
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   353
        self.ModulesExtraParams.setdefault(module_infos, {})
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   354
        self.ModulesExtraParams[module_infos][param] = value
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   355
        
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   356
        self.SaveModulesExtraParams()
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   357
    
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   358
    def GetModuleExtraParams(self, vendor, product_code, revision_number):
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   359
        vendor = ExtractHexDecValue(vendor)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   360
        product_code = ExtractHexDecValue(product_code)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   361
        revision_number = ExtractHexDecValue(revision_number)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   362
        
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   363
        if self.ParentLibrary is not None:
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   364
            extra_params = self.ParentLibrary.GetModuleExtraParams(vendor, product_code, revision_number)
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   365
        else:
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   366
            extra_params = {}
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   367
        
2138
79dc2d15c580 Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2137
diff changeset
   368
        extra_params.update(self.ModulesExtraParams.get((vendor, product_code, revision_number), {}))
2137
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   369
        
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   370
        for param, param_infos in self.MODULES_EXTRA_PARAMS:
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   371
            extra_params.setdefault(param, param_infos["default"])
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   372
        
b65abacdbdf9 Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents: 2133
diff changeset
   373
        return extra_params
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   374
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   375
USERDATA_DIR = wx.StandardPaths.Get().GetUserDataDir()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   376
if wx.Platform != '__WXMSW__':
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   377
    USERDATA_DIR += '_files'
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   378
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   379
ModulesDatabase = ModulesLibrary(
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   380
    os.path.join(USERDATA_DIR, "ethercat_modules"))
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   381
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   382
class RootClass:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   383
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   384
    CTNChildrenTypes = [("EthercatNode",_EthercatCTN,"Ethercat Master")]
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   385
    EditorType = LibraryEditor
2157
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   386
       
a2385e535cf5 Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents: 2152
diff changeset
   387
    
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   388
    def __init__(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   389
        self.ModulesLibrary = None
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   390
        self.LoadModulesLibrary()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   391
    
2149
7f473761c932 Added icon for Ethercat extension root and Ethercat master node
Laurent Bessard
parents: 2139
diff changeset
   392
    def GetIconName(self):
7f473761c932 Added icon for Ethercat extension root and Ethercat master node
Laurent Bessard
parents: 2139
diff changeset
   393
        return "Ethercat"
7f473761c932 Added icon for Ethercat extension root and Ethercat master node
Laurent Bessard
parents: 2139
diff changeset
   394
    
2133
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   395
    def GetModulesLibraryPath(self, project_path=None):
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   396
        if project_path is None:
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   397
            project_path = self.CTNPath()
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   398
        return os.path.join(project_path, "modules") 
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   399
    
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   400
    def OnCTNSave(self, from_project_path=None):
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   401
        if from_project_path is not None:
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   402
            shutil.copytree(self.GetModulesLibraryPath(from_project_path),
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   403
                            self.GetModulesLibraryPath())
ba0b2ca7db26 Fixed Save As... function in Beremiz
Laurent Bessard
parents: 2111
diff changeset
   404
        return True
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   405
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   406
    def CTNGenerate_C(self, buildpath, locations):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   407
        return [],"",False
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   408
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   409
    def LoadModulesLibrary(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   410
        if self.ModulesLibrary is None:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   411
            self.ModulesLibrary = ModulesLibrary(self.GetModulesLibraryPath(), ModulesDatabase)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   412
        else:
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   413
            self.ModulesLibrary.LoadModulesLibrary()
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   414
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   415
    def GetModulesDatabaseInstance(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   416
        return ModulesDatabase
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   417
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   418
    def GetModulesLibraryInstance(self):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   419
        return self.ModulesLibrary
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   420
    
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   421
    def GetModulesLibrary(self, profile_filter=None):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   422
        return self.ModulesLibrary.GetModulesLibrary(profile_filter)
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   423
    
2098
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   424
    def GetVendors(self):
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   425
        return self.ModulesLibrary.GetVendors()
392791b5cc04 Improved Ethercat Network Configurator panels
Laurent Bessard
parents: 2097
diff changeset
   426
    
2097
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   427
    def GetModuleInfos(self, module_infos):
58d07e039896 Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents: 2096
diff changeset
   428
        return self.ModulesLibrary.GetModuleInfos(module_infos)
2041
ce3727171207 Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents: 2039
diff changeset
   429