author | Edouard Tisserant |
Fri, 23 Jul 2021 13:15:19 +0200 | |
branch | svghmi |
changeset 3288 | 8f3cb4b47cbb |
parent 2643 | b98d9e08231f |
child 3752 | 9f6f46dbe3ae |
permissions | -rw-r--r-- |
2165
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
1 |
#!/usr/bin/env python |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
3 |
|
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
4 |
# This file is part of Beremiz |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
5 |
# |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
6 |
# Copyright (C) 2011-2014: Laurent BESSARD, Edouard TISSERANT |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
7 |
# RTES Lab : CRKim, JBLee, youcu |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
8 |
# Higen Motor : Donggu Kang |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
9 |
# |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
10 |
# See COPYING file for copyrights details. |
02a2b5dee5e3
Merged GPL + LGPL v2 or later EtherCAT extension. Fixed headers and copyright notice.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2162
diff
changeset
|
11 |
|
2405
af050469fc5c
clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2397
diff
changeset
|
12 |
from __future__ import absolute_import |
2357
7c67286cddbe
cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2356
diff
changeset
|
13 |
import os |
7c67286cddbe
cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2356
diff
changeset
|
14 |
import shutil |
2390
81116c5db60f
clean etherlab: pylint, C0411 # (wrong-import-order) standard import "import x" comes before "import y"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2387
diff
changeset
|
15 |
import csv |
2434
07f48018b6f5
python3 support: pylint, W1612 # (unicode-builtin) unicode built-in referenced
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2425
diff
changeset
|
16 |
from builtins import str as text |
07f48018b6f5
python3 support: pylint, W1612 # (unicode-builtin) unicode built-in referenced
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2425
diff
changeset
|
17 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
18 |
from lxml import etree |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
19 |
import wx |
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 |
from xmlclass import * |
2111 | 22 |
|
2396
41adf1dfc7a7
clean etherlab: pylint, W0611 # (unused-import) Unused import X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2390
diff
changeset
|
23 |
from ConfigTreeNode import XSDSchemaErrorMessage |
2111 | 24 |
|
2405
af050469fc5c
clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2397
diff
changeset
|
25 |
from etherlab.EthercatSlave import ExtractHexDecValue, ExtractName |
af050469fc5c
clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2397
diff
changeset
|
26 |
from etherlab.EthercatMaster import _EthercatCTN |
af050469fc5c
clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2397
diff
changeset
|
27 |
from etherlab.ConfigEditor import LibraryEditor, ETHERCAT_VENDOR, ETHERCAT_GROUP, ETHERCAT_DEVICE |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
28 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
29 |
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
|
30 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
31 |
# -------------------------------------------------- |
2048
5726f2bbdace
reflected changes in beremiz extension mechanism
Edouard Tisserant
parents:
2047
diff
changeset
|
32 |
# Ethercat ConfNode |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
33 |
# -------------------------------------------------- |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
34 |
|
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
35 |
EtherCATInfoParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATInfo.xsd")) |
2376
47775c9367bd
clean etherlab: pep8, E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2370
diff
changeset
|
36 |
|
47775c9367bd
clean etherlab: pep8, E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2370
diff
changeset
|
37 |
|
47775c9367bd
clean etherlab: pep8, E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2370
diff
changeset
|
38 |
def EtherCATInfo_XPath(xpath): |
47775c9367bd
clean etherlab: pep8, E731 do not assign a lambda expression, use a def
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2370
diff
changeset
|
39 |
return etree.XPath(xpath) |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
40 |
|
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
41 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
42 |
EtherCATBaseParser = GenerateParserFromXSD(os.path.join(os.path.dirname(__file__), "EtherCATBase.xsd")) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
43 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
44 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
45 |
def EtherCATBase_XPath(xpath): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
46 |
return etree.XPath(xpath) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
47 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
48 |
|
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
49 |
def HexDecValue(context, *args): |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
50 |
return str(ExtractHexDecValue(args[0][0])) |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
51 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2359
diff
changeset
|
52 |
|
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
53 |
def EntryName(context, *args): |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
54 |
return ExtractName(args[0], args[1][0] if len(args) > 1 else None) |
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
55 |
|
2370
e40f3914e55f
cleanup etherlab: pep8, E305 expected 2 blank lines after class or function definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
56 |
|
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
57 |
ENTRY_INFOS_KEYS = [ |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
58 |
("Index", lambda x: "#x%4.4X" % int(x), "#x0000"), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
59 |
("SubIndex", str, "0"), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
60 |
("Name", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
61 |
("Type", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
62 |
("BitSize", int, 0), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
63 |
("Access", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
64 |
("PDOMapping", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
65 |
("PDO index", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
66 |
("PDO name", str, ""), |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
67 |
("PDO type", str, "")] |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
68 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
69 |
# Read DefaultValue from ESI file |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
70 |
# Add by jblee 151229 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
71 |
ENTRY_INFOS_KEYS_FOR_DV = [ |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
72 |
("Index", lambda x: "#x%4.4X" % int(x), "#x0000"), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
73 |
("SubIndex", str, "0"), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
74 |
("Name", str, ""), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
75 |
("Type", str, ""), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
76 |
("BitSize", int, 0), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
77 |
("Access", str, ""), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
78 |
("PDOMapping", str, ""), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
79 |
("DefaultValue", str, ""), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
80 |
("Sub_entry_flag", str, "0")] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
81 |
|
2397
25f16349644b
clean etherlab: pylint, C1001 # (old-style-class) Old-style class defined.
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2396
diff
changeset
|
82 |
class EntryListFactory(object): |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
83 |
|
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
84 |
def __init__(self, entries): |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
85 |
self.Entries = entries |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
86 |
|
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
87 |
def AddEntry(self, context, *args): |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
88 |
index, subindex = map(lambda x: int(x[0]), args[:2]) |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
89 |
if len(args) > 9: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
90 |
new_entry_infos = { |
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
91 |
key: translate(arg[0]) if len(arg) > 0 else default |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
92 |
for (key, translate, default), arg |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
93 |
in zip(ENTRY_INFOS_KEYS, args)} |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
94 |
else: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
95 |
new_entry_infos = { |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
96 |
key: translate(arg[0]) if len(arg) > 0 else default |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
97 |
for (key, translate, default), arg |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
98 |
in zip(ENTRY_INFOS_KEYS_FOR_DV, args)} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
99 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
100 |
if (index, subindex) != (0, 0): |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
101 |
entry_infos = self.Entries.get((index, subindex)) |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
102 |
if entry_infos is not None: |
2162
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
103 |
for param in ["PDO index", "PDO name", "PDO type"]: |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
104 |
value = new_entry_infos.get(param) |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
105 |
if value is not None: |
43ab74687f45
Fixed xslt stylesheet for extracting entries defined in module, rewiting xslt stylesheet to yslt
Laurent Bessard
parents:
2160
diff
changeset
|
106 |
entry_infos[param] = value |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
107 |
else: |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
108 |
self.Entries[(index, subindex)] = new_entry_infos |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
109 |
|
2370
e40f3914e55f
cleanup etherlab: pep8, E305 expected 2 blank lines after class or function definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
110 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
111 |
entries_list_xslt = etree.parse( |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
112 |
os.path.join(ScriptDirectory, "entries_list.xslt")) |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
113 |
|
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
114 |
cls = EtherCATInfoParser.GetElementClass("DeviceType") |
2074
bf2fa4cb62a9
Adding support for loading Profile dictionaries only if needed
Laurent Bessard
parents:
2073
diff
changeset
|
115 |
if cls: |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
116 |
cls.DataTypes = None |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
117 |
|
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
118 |
profile_numbers_xpath = EtherCATInfo_XPath("Profile/ProfileNo") |
2387
5cf1d70b5395
clean etherlab: pep8, E301 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2384
diff
changeset
|
119 |
|
2032
766078d83e22
Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents:
2031
diff
changeset
|
120 |
def GetProfileNumbers(self): |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
121 |
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
|
122 |
setattr(cls, "GetProfileNumbers", GetProfileNumbers) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
123 |
|
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
|
124 |
def getCoE(self): |
2032
766078d83e22
Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents:
2031
diff
changeset
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
setattr(cls, "getCoE", getCoE) |
2032
766078d83e22
Adding support for DS402 node subplugin (only simple state transition implemented)
laurent
parents:
2031
diff
changeset
|
130 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
131 |
# Modify by jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
132 |
def ExtractDataTypes(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
133 |
#self.DataTypes = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
134 |
#self.DT = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
135 |
DT = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
136 |
objects = [] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
137 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
138 |
# get Profile Field |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
139 |
for profile in self.getProfile(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
140 |
# get each (ProfileNo, Dictionary) Field as child |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
141 |
for child in profile.getchildren(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
142 |
# child.text is not None -> ProfileNo, is None -> Dictionary |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
143 |
if child.text is None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
144 |
# get each (DataTypes, Objects) Field |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
145 |
dataTypes = child.getDataTypes() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
146 |
objects = child.getObjects() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
147 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
148 |
for dataType in dataTypes.getDataType(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
149 |
#if dataType.getName() is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
150 |
# print dataType.getName(), dataType |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
151 |
DT[dataType.getName()] = dataType |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
152 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
153 |
return DT, objects |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
154 |
setattr(cls, "ExtractDataTypes", ExtractDataTypes) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
155 |
|
2098
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
156 |
def GetEntriesList(self, limits=None): |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
157 |
DataTypes, objects = self.ExtractDataTypes() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
158 |
|
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
|
159 |
entries = {} |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
160 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
161 |
# get each Object Field |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
162 |
for object in objects: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
163 |
# Object Field mendatory : Index, Name, Type, BitSize |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
164 |
# Frequently Use : Info, Flags |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
165 |
# Info Field -> DefaultData, SubItem |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
166 |
# Flags Field -> Access, Category, PdoMapping |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
167 |
object_index = object.getIndex().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
168 |
index = ExtractHexDecValue(object_index) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
169 |
if limits is None or limits[0] <= index <= limits[1]: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
170 |
object_type = object.getType() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
171 |
object_name = ExtractName(object.getName()) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
172 |
object_size = object.getBitSize() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
173 |
defaultData = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
174 |
object_access = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
175 |
object_PDOMapping_data = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
176 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
177 |
object_type_infos = DataTypes.get(object_type, None) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
178 |
subItem_infos = object_type_infos.getchildren() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
179 |
countSubIndex = 0 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
180 |
if len(subItem_infos) > 2: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
181 |
for subItem_info in subItem_infos: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
182 |
if subItem_info.tag == "SubItem" : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
183 |
subItemName = subItem_info.getName() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
184 |
subIdx = subItem_info.getSubIdx() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
185 |
if subIdx is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
186 |
object_subidx = ExtractHexDecValue(subIdx) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
187 |
else: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
188 |
object_subidx = ExtractHexDecValue(countSubIndex) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
189 |
subType = subItem_info.getType() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
190 |
subBitSize = subItem_info.getBitSize() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
191 |
subFlags = subItem_info.getFlags() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
192 |
subAccess = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
193 |
subPDOMapping_data = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
194 |
if subFlags is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
195 |
subAccess = subFlags.getAccess().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
196 |
subPDOMapping = subFlags.getPdoMapping() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
197 |
if subPDOMapping is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
198 |
subPDOMapping_data = subFlags.getPdoMapping().upper() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
199 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
200 |
entries[(index, object_subidx)] = { |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
201 |
"Index": object_index, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
202 |
"SubIndex": subIdx, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
203 |
"Name": "%s - %s" % |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
204 |
(object_name.decode("utf-8"), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
205 |
subItemName.decode("utf-8")), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
206 |
"Type": subType, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
207 |
"BitSize": subBitSize, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
208 |
"Access": subAccess, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
209 |
"PDOMapping": subPDOMapping_data} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
210 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
211 |
countSubIndex += 1 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
212 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
213 |
info = object.getInfo() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
214 |
# subItemTest : check subItem |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
215 |
countSubIndex = 0 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
216 |
if info is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
217 |
subItems = info.getchildren() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
218 |
if len(subItems) > 1: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
219 |
for subItem in subItems: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
220 |
defaultdata_subidx = ExtractHexDecValue(countSubIndex) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
221 |
defaultData = subItem.getchildren()[1].findtext("DefaultData") |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
222 |
entry = entries.get((index, defaultdata_subidx), None) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
223 |
if entry is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
224 |
entry["DefaultData"] = defaultData |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
225 |
countSubIndex += 1 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
226 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
227 |
else : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
228 |
info = object.getInfo() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
229 |
if info is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
230 |
subItems = info.getchildren() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
231 |
if len(subItems) <= 1: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
232 |
defaultData = subItems[0].text |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
233 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
234 |
object_flag = object.getFlags() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
235 |
object_access = object_flag.getAccess().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
236 |
object_PDOMapping = object_flag.getPdoMapping() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
237 |
if object_PDOMapping is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
238 |
object_PDOMapping_data = object_flag.getPdoMapping().upper() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
239 |
entries[(index, 0)] = { |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
240 |
"Index": object_index, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
241 |
"SubIndex": "0", |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
242 |
"Name": object_name, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
243 |
"Type": object_type, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
244 |
"BitSize": object_size, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
245 |
"DefaultData" : defaultData, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
246 |
"Access": object_access, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
247 |
"PDOMapping": object_PDOMapping_data} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
248 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
249 |
for TxPdo in self.getTxPdo(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
250 |
ExtractPdoInfos(TxPdo, "Transmit", entries, limits) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
251 |
for RxPdo in self.getRxPdo(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
252 |
ExtractPdoInfos(RxPdo, "Receive", entries, limits) |
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
|
253 |
|
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
|
254 |
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
|
255 |
setattr(cls, "GetEntriesList", GetEntriesList) |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
256 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
257 |
# def GetEntriesList(self, limits=None): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
258 |
# entries = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
259 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
260 |
# factory = EntryListFactory(entries) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
261 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
262 |
# entries_list_xslt_tree = etree.XSLT( |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
263 |
# entries_list_xslt, extensions = { |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
264 |
# ("entries_list_ns", "AddEntry"): factory.AddEntry, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
265 |
# ("entries_list_ns", "HexDecValue"): HexDecValue, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
266 |
# ("entries_list_ns", "EntryName"): EntryName}) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
267 |
# entries_list_xslt_tree(self, **dict(zip( |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
268 |
# ["min_index", "max_index"], |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
269 |
# map(lambda x: etree.XSLT.strparam(str(x)), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
270 |
# limits if limits is not None else [0x0000, 0xFFFF]) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
271 |
# ))) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
272 |
# |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
273 |
# return entries |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
274 |
# setattr(cls, "GetEntriesList", GetEntriesList) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
275 |
|
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
|
276 |
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
|
277 |
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
|
278 |
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
|
279 |
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
|
280 |
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
|
281 |
("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
|
282 |
("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
|
283 |
("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
|
284 |
("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
|
285 |
if value is None: |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
286 |
value = "" |
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
|
287 |
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
|
288 |
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
|
289 |
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
|
290 |
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
|
291 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
292 |
|
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
293 |
def GroupItemCompare(x, y): |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
294 |
if x["type"] == y["type"]: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
295 |
if x["type"] == ETHERCAT_GROUP: |
2031
c6f32810723e
Fix some issues regarding arbitrary variable mapping
laurent
parents:
2030
diff
changeset
|
296 |
return cmp(x["order"], y["order"]) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
297 |
else: |
2031
c6f32810723e
Fix some issues regarding arbitrary variable mapping
laurent
parents:
2030
diff
changeset
|
298 |
return cmp(x["name"], y["name"]) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
299 |
elif x["type"] == ETHERCAT_GROUP: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
300 |
return -1 |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
301 |
return 1 |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
302 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2359
diff
changeset
|
303 |
|
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
304 |
def SortGroupItems(group): |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
305 |
for item in group["children"]: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
306 |
if item["type"] == ETHERCAT_GROUP: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
307 |
SortGroupItems(item) |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
308 |
group["children"].sort(GroupItemCompare) |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
309 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
310 |
def ExtractPdoInfos(pdo, pdo_type, entries, limits=None): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
311 |
pdo_index = pdo.getIndex().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
312 |
pdo_name = ExtractName(pdo.getName()) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
313 |
exclude = pdo.getExclude() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
314 |
for pdo_entry in pdo.getEntry(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
315 |
entry_index = pdo_entry.getIndex().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
316 |
entry_subindex = pdo_entry.getSubIndex() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
317 |
index = ExtractHexDecValue(entry_index) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
318 |
subindex = ExtractHexDecValue(entry_subindex) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
319 |
object_size = pdo_entry.getBitLen() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
320 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
321 |
if limits is None or limits[0] <= index <= limits[1]: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
322 |
entry = entries.get((index, subindex), None) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
323 |
if entry is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
324 |
entry["PDO index"] = pdo_index |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
325 |
entry["PDO name"] = pdo_name |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
326 |
entry["PDO type"] = pdo_type |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
327 |
else: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
328 |
entry_type = pdo_entry.getDataType() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
329 |
if entry_type is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
330 |
if pdo_type == "Transmit": |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
331 |
access = "ro" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
332 |
pdomapping = "T" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
333 |
else: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
334 |
access = "wo" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
335 |
pdomapping = "R" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
336 |
entries[(index, subindex)] = { |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
337 |
"Index": entry_index, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
338 |
"SubIndex": entry_subindex, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
339 |
"Name": ExtractName(pdo_entry.getName()), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
340 |
"Type": entry_type.getcontent(), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
341 |
"BitSize": object_size, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
342 |
"Access": access, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
343 |
"PDOMapping": pdomapping} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
344 |
|
2397
25f16349644b
clean etherlab: pylint, C1001 # (old-style-class) Old-style class defined.
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2396
diff
changeset
|
345 |
class ModulesLibrary(object): |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
346 |
|
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
347 |
MODULES_EXTRA_PARAMS = [ |
2384
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
348 |
( |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
349 |
"pdo_alignment", |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
350 |
{ |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
351 |
"column_label": _("PDO alignment"), |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
352 |
"column_size": 150, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
353 |
"default": 8, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
354 |
"description": _("Minimal size in bits between 2 pdo entries") |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
355 |
} |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
356 |
), |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
357 |
( |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
358 |
"max_pdo_size", |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
359 |
{ |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
360 |
"column_label": _("Max entries by PDO"), |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
361 |
"column_size": 150, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
362 |
"default": 255, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
363 |
"description": _("""Maximal number of entries mapped in a PDO |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
364 |
including empty entries used for PDO alignment""") |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
365 |
} |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
366 |
), |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
367 |
( |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
368 |
"add_pdo", |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
369 |
{ |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
370 |
"column_label": _("Creating new PDO"), |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
371 |
"column_size": 150, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
372 |
"default": 0, |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
373 |
"description": _("""Adding a PDO not defined in default configuration |
2138
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
374 |
for mapping needed location variables |
2384
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
375 |
(1 if possible)""") |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
376 |
} |
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2381
diff
changeset
|
377 |
) |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
378 |
] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
379 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
380 |
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
|
381 |
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
|
382 |
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
|
383 |
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
|
384 |
self.ParentLibrary = parent_library |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
385 |
|
2098
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
386 |
if parent_library is not None: |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
387 |
self.LoadModules() |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
388 |
else: |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
389 |
self.Library = None |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
390 |
self.LoadModulesExtraParams() |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
391 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
392 |
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
|
393 |
return self.Path |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
394 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
395 |
def GetModulesExtraParamsFilePath(self): |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
396 |
return os.path.join(self.Path, "modules_extra_params.cfg") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
397 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
398 |
groups_xpath = EtherCATInfo_XPath("Descriptions/Groups/Group") |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
399 |
devices_xpath = EtherCATInfo_XPath("Descriptions/Devices/Device") |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
400 |
module_xpath = EtherCATBase_XPath("Descriptions/Modules/Module") |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
401 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
402 |
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
|
403 |
self.Library = {} |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
404 |
# add by jblee for Modular Device Profile |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
405 |
self.MDPList = [] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
406 |
self.ModuleList = [] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
407 |
self.MDPEntryList = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
408 |
dtDic = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
409 |
self.idxIncrement = 0 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
410 |
self.slotIncrement = 0 |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
411 |
# add by jblee for PDO Mapping |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
412 |
self.DataTypes = {} |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
413 |
self.ObjectDictionary = {} |
2097
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 |
files = os.listdir(self.Path) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
416 |
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
|
417 |
filepath = os.path.join(self.Path, file) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
418 |
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
|
419 |
self.modules_infos = None |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
420 |
|
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
421 |
xmlfile = open(filepath, 'r') |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
422 |
try: |
2160
75349c51a34b
Added support for loading XML file even if not following XSD schema (but still following XML syntax), warning user of errors in XML file
Laurent Bessard
parents:
2159
diff
changeset
|
423 |
self.modules_infos, error = EtherCATInfoParser.LoadXMLString(xmlfile.read()) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
424 |
# if error is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
425 |
# self.GetCTRoot().logger.write_warning( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
426 |
# XSDSchemaErrorMessage % (filepath + error)) |
2418
5587c490a070
Use python 3 compatible exception syntax everywhere
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2412
diff
changeset
|
427 |
except Exception as exc: |
2434
07f48018b6f5
python3 support: pylint, W1612 # (unicode-builtin) unicode built-in referenced
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2425
diff
changeset
|
428 |
self.modules_infos, error = None, text(exc) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
429 |
xmlfile.close() |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
430 |
|
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
|
431 |
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
|
432 |
vendor = self.modules_infos.getVendor() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
433 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
434 |
vendor_category = self.Library.setdefault( |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
435 |
ExtractHexDecValue(vendor.getId()), |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
436 |
{"name": ExtractName(vendor.getName(), _("Miscellaneous")), |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
437 |
"groups": {}}) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
438 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
439 |
for group in self.groups_xpath(self.modules_infos): |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
440 |
group_type = group.getType() |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
441 |
# add for XmlToEeprom Func by jblee. |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
442 |
self.LcId_data = group.getchildren()[1] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
443 |
self.Image16x14_data = group.getchildren()[2] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
444 |
|
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
445 |
vendor_category["groups"].setdefault( |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
446 |
group_type, |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
447 |
{ |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
448 |
"name": ExtractName(group.getName(), group_type), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
449 |
"parent": group.getParentGroup(), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
450 |
"order": group.getSortOrder(), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
451 |
"devices": [], |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
452 |
# add jblee for support Moduler Device Profile (MDP) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
453 |
"modules": []}) |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
454 |
}) |
2359
e945fcb54cd4
cleanup etherlab: pep8, W293 blank line contains whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2357
diff
changeset
|
455 |
|
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
456 |
for device in self.devices_xpath(self.modules_infos): |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
457 |
device_group = device.getGroupType() |
2377
88a9d64560d3
clean etherlab: pep8, W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2376
diff
changeset
|
458 |
if device_group not in vendor_category["groups"]: |
2412
22b1879a3c15
cleanup: pylint, E1300 # (bad-format-character) Unsupported format character '"' (0x22) at index 17
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2406
diff
changeset
|
459 |
raise ValueError("Not such group \"%s\"" % device_group) |
2157
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
460 |
vendor_category["groups"][device_group]["devices"].append( |
a2385e535cf5
Fixed controllers for working with latest version of xmlclass
Laurent Bessard
parents:
2152
diff
changeset
|
461 |
(device.getType().getcontent(), device)) |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
462 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
463 |
# ------------------ Test Section --------------------# |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
464 |
slots = device.getSlots() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
465 |
if slots is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
466 |
for slot in slots.getSlot(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
467 |
self.idxIncrement = slot.getSlotIndexIncrement() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
468 |
self.slotIncrement = slot.getSlotPdoIncrement() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
469 |
for child in slot.getchildren(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
470 |
if child.tag == "ModuleClass": |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
471 |
child_class = child.getClass() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
472 |
child_name = child.getName() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
473 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
474 |
# -------------------- Test Section ----------------------------------# |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
475 |
LocalMDPList = [] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
476 |
for module in self.module_xpath(self.modules_infos): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
477 |
module_type = module.getType().getModuleClass() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
478 |
module_name = module.getName() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
479 |
LocalMDPData = ExtractName(module_name) + " (" + module_type + ")" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
480 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
481 |
self.ModuleList.append(module) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
482 |
try : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
483 |
module_pdos = module.getTxPdo() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
484 |
module_pdos += module.getRxPdo() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
485 |
for module_pdo in module_pdos: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
486 |
device_name = ExtractName(module_name) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
487 |
pdo_index = module_pdo.getIndex().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
488 |
pdo_name = ExtractName(module_pdo.getName()) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
489 |
pdo_entry = module_pdo.getEntry() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
490 |
if module_pdo.tag == "TxPdo": |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
491 |
mapping_type = "T" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
492 |
else : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
493 |
mapping_type = "R" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
494 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
495 |
LocalMDPEntry = [] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
496 |
for entry in pdo_entry: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
497 |
entry_index = entry.getIndex().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
498 |
entry_subidx = entry.getSubIndex() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
499 |
entry_name = ExtractName(entry.getName()) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
500 |
entry_bitsize = entry.getBitLen() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
501 |
try : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
502 |
entry_type = entry.getDataType().getcontent() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
503 |
except : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
504 |
entry_type = "" |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
505 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
506 |
LocalMDPEntry.append({ |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
507 |
"Index": entry_index, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
508 |
"SubIndex": entry_subidx, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
509 |
"Name": "%s - %s" % (pdo_name, entry_name), |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
510 |
"Type": entry_type, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
511 |
"BitSize": entry_bitsize, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
512 |
"Access": "", |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
513 |
"PDOMapping": mapping_type}) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
514 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
515 |
self.MDPEntryList[device_name] = LocalMDPEntry |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
516 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
517 |
LocalMDPList.append([LocalMDPData, module, LocalMDPEntry]) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
518 |
except : |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
519 |
LocalMDPList.append([LocalMDPData, module, []]) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
520 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
521 |
if LocalMDPList: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
522 |
vendor_category["groups"][device_group]["modules"].append( |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
523 |
(device.getType().getcontent(), LocalMDPList, self.idxIncrement, self.slotIncrement)) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
524 |
#self.MDPList.append([device.getType().getcontent(), LocalMDPList, |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
525 |
# self.idxIncrement, self.slotIncrement]) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
526 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
527 |
# --------------------------------------------------------------------- # |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
528 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
529 |
# else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
530 |
# self.GetCTRoot().logger.write_error( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
531 |
# _("Couldn't load {a1} XML file:\n{a2}").format(a1=filepath, a2=error)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
532 |
|
2160
75349c51a34b
Added support for loading XML file even if not following XSD schema (but still following XML syntax), warning user of errors in XML file
Laurent Bessard
parents:
2159
diff
changeset
|
533 |
return self.Library |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
534 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
535 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
536 |
def GetMDPList(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
537 |
return self.MDPList |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
538 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
539 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
540 |
def GetSelectModule(self, idx): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
541 |
return self.ModuleList[idx] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
542 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
543 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
544 |
def GetModuleEntryList(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
545 |
return self.MDPEntryList |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
546 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
547 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
548 |
def GetModuleIncrement(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
549 |
return (self.idxIncrement, self.slotIncrement) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
550 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
551 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
552 |
#def GetEntriesList(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
553 |
# return self.ObjectDictionary |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
554 |
|
2041
ce3727171207
Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents:
2039
diff
changeset
|
555 |
def GetModulesLibrary(self, profile_filter=None): |
2098
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
556 |
if self.Library is None: |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
557 |
self.LoadModules() |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
558 |
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
|
559 |
for vendor_id, vendor in self.Library.iteritems(): |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
560 |
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
|
561 |
children_dict = {} |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
562 |
for group_type, group in vendor["groups"].iteritems(): |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
563 |
group_infos = {"name": group["name"], |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
564 |
"order": group["order"], |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
565 |
"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
|
566 |
"infos": None, |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
567 |
"children": children_dict.setdefault(group_type, [])} |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
568 |
device_dict = {} |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
569 |
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
|
570 |
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
|
571 |
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
|
572 |
revision_number = device.getType().getRevisionNo() |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
573 |
module_infos = {"device_type": device_type, |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
574 |
"vendor": vendor_id, |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
575 |
"product_code": product_code, |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
576 |
"revision_number": revision_number} |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
577 |
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
|
578 |
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
|
579 |
"type": ETHERCAT_DEVICE, |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
580 |
"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
|
581 |
"children": []} |
ce3727171207
Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents:
2039
diff
changeset
|
582 |
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
|
583 |
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
|
584 |
device_type_occurrences.append(device_infos) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
585 |
for device_type_occurrences in device_dict.itervalues(): |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
586 |
if len(device_type_occurrences) > 1: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
587 |
for occurrence in device_type_occurrences: |
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
588 |
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
|
589 |
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
|
590 |
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
|
591 |
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
|
592 |
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
|
593 |
else: |
ce3727171207
Defining all slaves as Etherlab master subplugin instead of editing them in an editor with vertical notebook
laurent
parents:
2039
diff
changeset
|
594 |
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
|
595 |
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
|
596 |
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
|
597 |
"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
|
598 |
"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
|
599 |
"children": groups}) |
2031
c6f32810723e
Fix some issues regarding arbitrary variable mapping
laurent
parents:
2030
diff
changeset
|
600 |
library.sort(lambda x, y: cmp(x["name"], y["name"])) |
2022
c2295d311402
First working implementation of Beremiz plugin for etherlab
laurent
parents:
diff
changeset
|
601 |
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
|
602 |
|
2098
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
603 |
def GetVendors(self): |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
604 |
return [(vendor_id, vendor["name"]) for vendor_id, vendor in self.Library.items()] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
605 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
606 |
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
|
607 |
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
|
608 |
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
|
609 |
if vendor_infos is not None: |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
610 |
for _group_name, group_infos in vendor_infos["groups"].iteritems(): |
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
611 |
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
|
612 |
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
|
613 |
revision_number = ExtractHexDecValue(device_infos.getType().getRevisionNo()) |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2378
diff
changeset
|
614 |
if product_code == ExtractHexDecValue(module_infos["product_code"]) and \ |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2378
diff
changeset
|
615 |
revision_number == ExtractHexDecValue(module_infos["revision_number"]): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
616 |
self.cntdevice = device_infos |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
617 |
self.cntdeviceType = device_type |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
618 |
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
|
619 |
return None, None |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
620 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
621 |
# add jblee for MDP |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
622 |
def GetMDPInfos(self, module_infos): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
623 |
vendor = ExtractHexDecValue(module_infos["vendor"]) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
624 |
vendor_infos = self.Library.get(vendor) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
625 |
if vendor_infos is not None: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
626 |
for group_name, group_infos in vendor_infos["groups"].iteritems(): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
627 |
return group_infos["modules"] |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
628 |
#for device_type, module_list, idx_inc, slot_inc in group_infos["modules"]: |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
629 |
# return module_list, idx_inc, slot_inc |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
630 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
631 |
#return None, None, None |
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
632 |
|
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
633 |
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
|
634 |
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
|
635 |
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
|
636 |
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
|
637 |
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
|
638 |
return False |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
639 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
640 |
def LoadModulesExtraParams(self): |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
641 |
self.ModulesExtraParams = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
642 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
643 |
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
|
644 |
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
|
645 |
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
|
646 |
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
|
647 |
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
|
648 |
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
|
649 |
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
|
650 |
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
|
651 |
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
|
652 |
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
|
653 |
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
|
654 |
else: |
2138
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
655 |
params_values = {} |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
656 |
for (param, _param_infos), value in zip( |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2378
diff
changeset
|
657 |
self.MODULES_EXTRA_PARAMS, row[3:]): |
2138
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
658 |
if value != "": |
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
659 |
params_values[param] = int(value) |
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
660 |
self.ModulesExtraParams[ |
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
661 |
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
|
662 |
csvfile.close() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
663 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
664 |
def SaveModulesExtraParams(self): |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
665 |
csvfile = open(self.GetModulesExtraParamsFilePath(), "wb") |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
666 |
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
|
667 |
writer = csv.writer(csvfile, delimiter=';') |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
668 |
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
|
669 |
for (vendor, product_code, revision_number), module_extra_params in self.ModulesExtraParams.iteritems(): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
670 |
writer.writerow([vendor, product_code, revision_number] + |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
671 |
[module_extra_params.get(param, '') |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
672 |
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
|
673 |
csvfile.close() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
674 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
675 |
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
|
676 |
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
|
677 |
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
|
678 |
revision_number = ExtractHexDecValue(revision_number) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
679 |
|
2138
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
680 |
module_infos = (vendor, product_code, revision_number) |
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
681 |
self.ModulesExtraParams.setdefault(module_infos, {}) |
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
682 |
self.ModulesExtraParams[module_infos][param] = value |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
683 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
684 |
self.SaveModulesExtraParams() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
685 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
686 |
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
|
687 |
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
|
688 |
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
|
689 |
revision_number = ExtractHexDecValue(revision_number) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
690 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
691 |
if self.ParentLibrary is not None: |
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
692 |
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
|
693 |
else: |
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
694 |
extra_params = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
695 |
|
2138
79dc2d15c580
Fixed support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2137
diff
changeset
|
696 |
extra_params.update(self.ModulesExtraParams.get((vendor, product_code, revision_number), {})) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
697 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
698 |
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
|
699 |
extra_params.setdefault(param, param_infos["default"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
700 |
|
2137
b65abacdbdf9
Added support for multiple module extra params in ModulesLibrary
Laurent Bessard
parents:
2133
diff
changeset
|
701 |
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
|
702 |
|
2370
e40f3914e55f
cleanup etherlab: pep8, E305 expected 2 blank lines after class or function definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
703 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
704 |
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
|
705 |
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
|
706 |
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
|
707 |
|
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
708 |
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
|
709 |
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
|
710 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2359
diff
changeset
|
711 |
|
2397
25f16349644b
clean etherlab: pylint, C1001 # (old-style-class) Old-style class defined.
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2396
diff
changeset
|
712 |
class RootClass(object): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
713 |
|
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
714 |
CTNChildrenTypes = [("EthercatNode", _EthercatCTN, "Ethercat Master")] |
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
715 |
EditorType = LibraryEditor |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
716 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
717 |
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
|
718 |
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
|
719 |
self.LoadModulesLibrary() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
720 |
|
2149
7f473761c932
Added icon for Ethercat extension root and Ethercat master node
Laurent Bessard
parents:
2139
diff
changeset
|
721 |
def GetIconName(self): |
7f473761c932
Added icon for Ethercat extension root and Ethercat master node
Laurent Bessard
parents:
2139
diff
changeset
|
722 |
return "Ethercat" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
723 |
|
2133 | 724 |
def GetModulesLibraryPath(self, project_path=None): |
725 |
if project_path is None: |
|
726 |
project_path = self.CTNPath() |
|
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
727 |
return os.path.join(project_path, "modules") |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
728 |
|
2133 | 729 |
def OnCTNSave(self, from_project_path=None): |
730 |
if from_project_path is not None: |
|
731 |
shutil.copytree(self.GetModulesLibraryPath(from_project_path), |
|
732 |
self.GetModulesLibraryPath()) |
|
733 |
return True |
|
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
734 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
735 |
def CTNGenerate_C(self, buildpath, locations): |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
736 |
return [], "", False |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
737 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
738 |
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
|
739 |
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
|
740 |
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
|
741 |
else: |
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
742 |
self.ModulesLibrary.LoadModulesLibrary() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
743 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
744 |
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
|
745 |
return ModulesDatabase |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
746 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
747 |
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
|
748 |
return self.ModulesLibrary |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
749 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
750 |
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
|
751 |
return self.ModulesLibrary.GetModulesLibrary(profile_filter) |
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
752 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
753 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
754 |
def GetMDPList(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
755 |
return self.ModulesLibrary.GetMDPList() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
756 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
757 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
758 |
def GetSelectModule(self, idx): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
759 |
return self.ModulesLibrary.GetSelectModule(idx) |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
760 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
761 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
762 |
def GetModuleEntryList(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
763 |
return self.ModulesLibrary.GetModuleEntryList() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
764 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
765 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
766 |
def GetModuleIncrement(self): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
767 |
return self.ModulesLibrary.GetModuleIncrement() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
768 |
|
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
769 |
# add jblee |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
770 |
#def GetEntriesList(self, limits = None): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
771 |
# return self.ModulesLibrary.GetEntriesList() |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
772 |
|
2098
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
773 |
def GetVendors(self): |
392791b5cc04
Improved Ethercat Network Configurator panels
Laurent Bessard
parents:
2097
diff
changeset
|
774 |
return self.ModulesLibrary.GetVendors() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2165
diff
changeset
|
775 |
|
2097
58d07e039896
Added panel for managing ESI files from project and from database including module PDO alignment setting
Laurent Bessard
parents:
2096
diff
changeset
|
776 |
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
|
777 |
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
|
778 |
|
2641
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
779 |
def GetMDPInfos(self, module_infos): |
c9deff128c37
EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2165
diff
changeset
|
780 |
return self.ModulesLibrary.GetMDPInfos(module_infos) |