author | usveticic |
Wed, 05 Aug 2020 15:04:53 +0200 | |
branch | svghmi |
changeset 3009 | 7c6960f09881 |
parent 2643 | b98d9e08231f |
child 3303 | 0ffb41625592 |
permissions | -rw-r--r-- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1 |
#!/usr/bin/env python |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
3 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
4 |
# This file is part of Beremiz |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
5 |
# |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
6 |
# Copyright (C) 2013: Real-Time & Embedded Systems (RTES) Lab., University of Seoul |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
7 |
# |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
8 |
# See COPYING file for copyrights details. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
9 |
|
2405
af050469fc5c
clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2390
diff
changeset
|
10 |
from __future__ import absolute_import |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2423
diff
changeset
|
11 |
from __future__ import division |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
12 |
import os |
2390
81116c5db60f
clean etherlab: pylint, C0411 # (wrong-import-order) standard import "import x" comes before "import y"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2389
diff
changeset
|
13 |
import string |
81116c5db60f
clean etherlab: pylint, C0411 # (wrong-import-order) standard import "import x" comes before "import y"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2389
diff
changeset
|
14 |
from xml.dom import minidom |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
15 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
16 |
import wx |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
17 |
import wx.grid |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
18 |
import wx.gizmos |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
19 |
import wx.lib.buttons |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
20 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
21 |
# -------------------------------------------------------------------- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
22 |
from controls import CustomGrid, CustomTable |
2416
1ca207782dde
Use predefined constants for PlcStatus instead of string literals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2407
diff
changeset
|
23 |
from runtime import PlcStatus |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
24 |
# -------------------------------------------------------------------- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
25 |
|
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
26 |
# ------------ for register management --------------- |
2390
81116c5db60f
clean etherlab: pylint, C0411 # (wrong-import-order) standard import "import x" comes before "import y"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2389
diff
changeset
|
27 |
|
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
28 |
from util.TranslationCatalogs import NoTranslate |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
29 |
# ------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
30 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
31 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
32 |
# ----------------------------- For Sync Manager Table ----------------------------------- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
33 |
def GetSyncManagersTableColnames(): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
34 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
35 |
Returns column names of SyncManager Table in Slave state panel. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
36 |
""" |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
37 |
_ = NoTranslate |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
38 |
return ["#", _("Name"), _("Start Address"), _("Default Size"), _("Control Byte"), _("Enable")] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
39 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
40 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
41 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
42 |
# Sync Managers Table |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
43 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
44 |
class SyncManagersTable(CustomTable): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
45 |
def GetValue(self, row, col): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
46 |
if row < self.GetNumberRows(): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
47 |
if col == 0: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
48 |
return row |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
49 |
return self.data[row].get(self.GetColLabelValue(col, False), "") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
50 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
51 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
52 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
53 |
# EtherCAT Management Treebook |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
54 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
55 |
class EtherCATManagementTreebook(wx.Treebook): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
56 |
def __init__(self, parent, controler, node_editor): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
57 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
58 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
59 |
@param parent: Reference to the parent wx.ScrolledWindow object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
60 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
61 |
@param node_editor: Reference to Beremiz frame |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
62 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
63 |
wx.Treebook.__init__(self, parent, -1, size=wx.DefaultSize, style=wx.BK_DEFAULT) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
64 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
65 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
66 |
self.NodeEditor = node_editor |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
67 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
68 |
self.EtherCATManagementClassObject = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
69 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
70 |
# fill EtherCAT Management Treebook |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
71 |
panels = [ |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
72 |
("Slave State", SlaveStatePanelClass, []), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
73 |
("SDO Management", SDOPanelClass, []), |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
74 |
("PDO Mapping", PDOPanelClass, [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
75 |
("Rx PDO", RxPDOPanelClass), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
76 |
("Tx PDO", TxPDOPanelClass)]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
77 |
("MDP Setting", MDPPanel, []), |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
78 |
("ESC Management", EEPROMAccessPanel, [ |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
79 |
("Smart View", SlaveSiiSmartView), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
80 |
("Hex View", HexView)]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
81 |
("Register Access", RegisterAccessPanel, []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
82 |
("DC Configuration", DCConfigPanel, []) |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
83 |
] |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
84 |
for pname, pclass, subs in panels: |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
85 |
self.AddPage(pclass(self, self.Controler), pname) |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
86 |
for spname, spclass in subs: |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
87 |
self.AddSubPage(spclass(self, self.Controler), spname) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
88 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
89 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
90 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
91 |
# For SlaveState Panel |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
92 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
93 |
class SlaveStatePanelClass(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
94 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
95 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
96 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
97 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
98 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
99 |
""" |
2366
d635680e4c2c
cleanup etherlab: pep8, E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2365
diff
changeset
|
100 |
wx.Panel.__init__(self, parent, -1, (0, 0), size=wx.DefaultSize, style=wx.SUNKEN_BORDER) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
101 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
102 |
self.parent = parent |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
103 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
104 |
# initialize SlaveStatePanel UI dictionaries |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
105 |
self.StaticBoxDic = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
106 |
self.StaticTextDic = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
107 |
self.TextCtrlDic = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
108 |
self.ButtonDic = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
109 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
110 |
# iniitalize BoxSizer and FlexGridSizer |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
111 |
self.SizerDic = { |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
112 |
"SlaveState_main_sizer": wx.BoxSizer(wx.VERTICAL), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
113 |
"SlaveState_inner_main_sizer": wx.FlexGridSizer(cols=1, hgap=50, rows=3, vgap=10), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
114 |
"SlaveInfosDetailsInnerSizer": wx.FlexGridSizer(cols=4, hgap=10, rows=2, vgap=10), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
115 |
"SyncManagerInnerSizer": wx.FlexGridSizer(cols=1, hgap=5, rows=1, vgap=5), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
116 |
"SlaveState_sizer": wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=10), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
117 |
"SlaveState_up_sizer": wx.FlexGridSizer(cols=4, hgap=10, rows=2, vgap=10), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
118 |
"SlaveState_down_sizer": wx.FlexGridSizer(cols=2, hgap=10, rows=1, vgap=10)} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
119 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
120 |
# initialize StaticBox and StaticBoxSizer |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
121 |
for box_name, box_label in [ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
122 |
("SlaveInfosDetailsBox", "Slave Informations"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
123 |
("SyncManagerBox", "Sync Manager"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
124 |
("SlaveStateBox", "Slave State Transition && Monitoring")]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
125 |
self.StaticBoxDic[box_name] = wx.StaticBox(self, label=_(box_label)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
126 |
self.SizerDic[box_name] = wx.StaticBoxSizer(self.StaticBoxDic[box_name]) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
127 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
128 |
for statictext_name, statictext_label, textctrl_name in [ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
129 |
("VendorLabel", "Vendor:", "vendor"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
130 |
("ProductcodeLabel", "Product code:", "product_code"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
131 |
("RevisionnumberLabel", "Slave Count:", "revision_number"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
132 |
("PhysicsLabel", "Physics:", "physics")]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
133 |
self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
134 |
self.TextCtrlDic[textctrl_name] = wx.TextCtrl(self, size=wx.Size(130, 24), style=wx.TE_READONLY) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
135 |
self.SizerDic["SlaveInfosDetailsInnerSizer"].AddMany([self.StaticTextDic[statictext_name], |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
136 |
self.TextCtrlDic[textctrl_name]]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
137 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
138 |
self.SizerDic["SlaveInfosDetailsBox"].AddSizer(self.SizerDic["SlaveInfosDetailsInnerSizer"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
139 |
|
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
140 |
self.SyncManagersGrid = CustomGrid(self, size=wx.Size(605, 155), style=wx.VSCROLL) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
141 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
142 |
self.SizerDic["SyncManagerInnerSizer"].Add(self.SyncManagersGrid) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
143 |
self.SizerDic["SyncManagerBox"].Add(self.SizerDic["SyncManagerInnerSizer"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
144 |
|
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
145 |
buttons = [ |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
146 |
("InitButton", 0, "INIT", "State Transition to \"Init\" State", self.OnButtonClick, []), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
147 |
("PreOPButton", 1, "PREOP", "State Transition to \"PreOP\" State", self.OnButtonClick, [ |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
148 |
("TargetStateLabel", "Target State:", "TargetState")]), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
149 |
("SafeOPButton", 2, "SAFEOP", "State Transition to \"SafeOP\" State", self.OnButtonClick, []), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
150 |
("OPButton", 3, "OP", "State Transition to \"OP\" State", self.OnButtonClick, [ |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
151 |
("CurrentStateLabel", "Current State:", "CurrentState")]) |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
152 |
] |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
153 |
for button_name, button_id, button_label, button_tooltipstring, event_method, sub_item in buttons: |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
154 |
self.ButtonDic[button_name] = wx.Button(self, id=button_id, label=_(button_label)) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
155 |
self.ButtonDic[button_name].Bind(wx.EVT_BUTTON, event_method) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
156 |
self.ButtonDic[button_name].SetToolTipString(button_tooltipstring) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
157 |
self.SizerDic["SlaveState_up_sizer"].Add(self.ButtonDic[button_name]) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
158 |
for statictext_name, statictext_label, textctrl_name in sub_item: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
159 |
self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
160 |
self.TextCtrlDic[textctrl_name] = wx.TextCtrl(self, size=wx.DefaultSize, style=wx.TE_READONLY) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
161 |
self.SizerDic["SlaveState_up_sizer"].AddMany([self.StaticTextDic[statictext_name], |
2380
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
162 |
self.TextCtrlDic[textctrl_name]]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
163 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
164 |
for button_name, button_label, button_tooltipstring, event_method in [ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
165 |
("StartTimerButton", "Start State Monitoring", "Slave State Update Restart", self.StartTimer), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
166 |
("StopTimerButton", "Stop State Monitoring", "Slave State Update Stop", self.CurrentStateThreadStop)]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
167 |
self.ButtonDic[button_name] = wx.Button(self, label=_(button_label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
168 |
self.ButtonDic[button_name].Bind(wx.EVT_BUTTON, event_method) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
169 |
self.ButtonDic[button_name].SetToolTipString(button_tooltipstring) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
170 |
self.SizerDic["SlaveState_down_sizer"].Add(self.ButtonDic[button_name]) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
171 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
172 |
self.SizerDic["SlaveState_sizer"].AddMany([self.SizerDic["SlaveState_up_sizer"], |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
173 |
self.SizerDic["SlaveState_down_sizer"]]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
174 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
175 |
self.SizerDic["SlaveStateBox"].Add(self.SizerDic["SlaveState_sizer"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
176 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
177 |
self.SizerDic["SlaveState_inner_main_sizer"].AddMany([ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
178 |
self.SizerDic["SlaveInfosDetailsBox"], self.SizerDic["SyncManagerBox"], |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
179 |
self.SizerDic["SlaveStateBox"]]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
180 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
181 |
self.SizerDic["SlaveState_main_sizer"].Add(self.SizerDic["SlaveState_inner_main_sizer"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
182 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
183 |
self.SetSizer(self.SizerDic["SlaveState_main_sizer"]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
184 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
185 |
# register a timer for periodic exectuion of slave state update (period: 1000 ms) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
186 |
self.Bind(wx.EVT_TIMER, self.GetCurrentState) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
187 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
188 |
self.CreateSyncManagerTable() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
189 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
190 |
self.Centre() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
191 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
192 |
def CreateSyncManagerTable(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
193 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
194 |
Create grid for "SyncManager" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
195 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
196 |
# declare Table object |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
197 |
self.SyncManagersTable = SyncManagersTable(self, [], GetSyncManagersTableColnames()) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
198 |
self.SyncManagersGrid.SetTable(self.SyncManagersTable) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
199 |
# set grid alignment attr. (CENTER) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
200 |
self.SyncManagersGridColAlignements = [wx.ALIGN_CENTRE, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE, |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
201 |
wx.ALIGN_CENTRE, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
202 |
# set grid size |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
203 |
self.SyncManagersGridColSizes = [40, 150, 100, 100, 100, 100] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
204 |
self.SyncManagersGrid.SetRowLabelSize(0) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
205 |
for col in range(self.SyncManagersTable.GetNumberCols()): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
206 |
attr = wx.grid.GridCellAttr() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
207 |
attr.SetAlignment(self.SyncManagersGridColAlignements[col], wx.ALIGN_CENTRE) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
208 |
self.SyncManagersGrid.SetColAttr(col, attr) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
209 |
self.SyncManagersGrid.SetColMinimalWidth(col, self.SyncManagersGridColSizes[col]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
210 |
self.SyncManagersGrid.AutoSizeColumn(col, False) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
211 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
212 |
self.RefreshSlaveInfos() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
213 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
214 |
def RefreshSlaveInfos(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
215 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
216 |
Fill data in "Slave Information" and "SyncManager" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
217 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
218 |
slave_infos = self.Controler.GetSlaveInfos() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
219 |
sync_manager_section = ["vendor", "product_code", "revision_number", "physics"] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
220 |
if slave_infos is not None: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
221 |
# this method is same as "TextCtrl.SetValue" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
222 |
for textctrl_name in sync_manager_section: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
223 |
self.TextCtrlDic[textctrl_name].SetValue(slave_infos[textctrl_name]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
224 |
self.SyncManagersTable.SetData(slave_infos["sync_managers"]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
225 |
self.SyncManagersTable.ResetView(self.SyncManagersGrid) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
226 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
227 |
for textctrl_name in sync_manager_section: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
228 |
self.TextCtrlDic[textctrl_name].SetValue("") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
229 |
self.SyncManagersTable.SetData([]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
230 |
self.SyncManagersTable.ResetView(self.SyncManagersGrid) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
231 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
232 |
def OnButtonClick(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
233 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
234 |
Event handler for slave state transition button click (Init, PreOP, SafeOP, OP button) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
235 |
@param event : wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
236 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
237 |
# Check whether beremiz connected or not. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
238 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
239 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
240 |
if check_connect_flag: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
241 |
state_dic = ["INIT", "PREOP", "SAFEOP", "OP"] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
242 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
243 |
# If target state is one of {INIT, PREOP, SAFEOP}, request slave state transition immediately. |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
244 |
if event.GetId() < 3: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
245 |
self.Controler.CommonMethod.RequestSlaveState(state_dic[event.GetId()]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
246 |
self.TextCtrlDic["TargetState"].SetValue(state_dic[event.GetId()]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
247 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
248 |
# If target state is OP, first check "PLC status". |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
249 |
# (1) If current PLC status is "Started", then request slave state transition |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
250 |
# (2) Otherwise, show error message and return |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
251 |
else: |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
252 |
status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
2416
1ca207782dde
Use predefined constants for PlcStatus instead of string literals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2407
diff
changeset
|
253 |
if status == PlcStatus.Started: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
254 |
self.Controler.CommonMethod.RequestSlaveState("OP") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
255 |
self.TextCtrlDic["TargetState"].SetValue("OP") |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
256 |
else: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
257 |
self.Controler.CommonMethod.CreateErrorDialog(_("PLC is Not Started")) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
258 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
259 |
def GetCurrentState(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
260 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
261 |
Timer event handler for periodic slave state monitoring (Default period: 1 sec = 1000 msec). |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
262 |
@param event : wx.TIMER object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
263 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
264 |
if self.IsShownOnScreen() is False: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
265 |
return |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
266 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
267 |
# Check whether beremiz connected or not. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
268 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
269 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = True) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
270 |
if check_connect_flag: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
271 |
returnVal = self.Controler.CommonMethod.GetSlaveStateFromSlave() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
272 |
line = returnVal.split("\n") |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
273 |
try: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
274 |
self.SetCurrentState(line[self.Controler.GetSlavePos()]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
275 |
except Exception: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
276 |
pass |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
277 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
278 |
def SetCurrentState(self, line): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
279 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
280 |
Show current slave state using the executiob result of "ethercat slaves" command. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
281 |
@param line : result of "ethercat slaves" command |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
282 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
283 |
state_array = ["INIT", "PREOP", "SAFEOP", "OP"] |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
284 |
try: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
285 |
# parse the execution result of "ethercat slaves" command |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
286 |
# Result example : 0 0:0 PREOP + EL9800 (V4.30) (PIC24, SPI, ET1100) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
287 |
token = line.split(" ") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
288 |
if token[2] in state_array: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
289 |
self.TextCtrlDic["CurrentState"].SetValue(token[2]) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
290 |
except Exception: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
291 |
pass |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
292 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
293 |
def StartTimer(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
294 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
295 |
Event handler for "Start State Monitoring" button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
296 |
- start slave state monitoring thread |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
297 |
@param event : wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
298 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
299 |
# Check whether beremiz connected or not. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
300 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
301 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
302 |
if check_connect_flag: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
303 |
self.SlaveStateThread = wx.Timer(self) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
304 |
# set timer period (2000 ms) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
305 |
self.SlaveStateThread.Start(2000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
306 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
307 |
pass |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
308 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
309 |
def CurrentStateThreadStop(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
310 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
311 |
Event handler for "Stop State Monitoring" button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
312 |
- stop slave state monitoring thread |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
313 |
@param event : wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
314 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
315 |
try: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
316 |
self.SlaveStateThread.Stop() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
317 |
except Exception: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
318 |
pass |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
319 |
|
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
320 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
321 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
322 |
# For SDO Management Panel |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
323 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
324 |
class SDOPanelClass(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
325 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
326 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
327 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
328 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
329 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
330 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
331 |
wx.Panel.__init__(self, parent, -1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
332 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
333 |
self.DatatypeDescription, self.CommunicationObject, self.ManufacturerSpecific, \ |
2384
d7d9f0e60bc9
clean etherlab: pep8, E122 continuation line missing indentation or outdented
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2383
diff
changeset
|
334 |
self.ProfileSpecific, self.Reserved, self.AllSDOData = range(6) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
335 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
336 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
337 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
338 |
self.SDOMonitorEntries = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
339 |
#----------------------------- SDO Monitor -------------------------------# |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
340 |
self.RBList = ["ON","OFF"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
341 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
342 |
self.SDOMonitorRB = wx.RadioBox(self, label=_("monitoring"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
343 |
choices=self.RBList, majorDimension=2) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
344 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
345 |
self.SDOMonitorRB.SetSelection(1) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
346 |
self.Bind(wx.EVT_RADIOBOX, self.OnRadioBox, self.SDOMonitorRB) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
347 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
348 |
self.SDOMonitorGrid = wx.grid.Grid(self,size=wx.Size(850,150),style=wx.EXPAND |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
349 |
|wx.ALIGN_CENTER_HORIZONTAL |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
350 |
|wx.ALIGN_CENTER_VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
351 |
self.SDOMonitorGrid.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
352 |
self.onMonitorGridDoubleClick) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
353 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
354 |
#----------------------------- SDO Entries ----------------------------# |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
355 |
self.SDOUpdateBtn = wx.Button(self, label=_("update")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
356 |
self.SDOUpdateBtn.Bind(wx.EVT_BUTTON, self.OnSDOUpdate) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
357 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
358 |
self.SDOTraceThread = None |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
359 |
self.SDOMonitoringFlag = False |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
360 |
self.SDOValuesList = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
361 |
# Default SDO Page Number |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
362 |
self.SDOPageNum = 2 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
363 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
364 |
#----------------------------- Sizer --------------------------------------# |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
365 |
self.SDOManagementMainSizer = wx.BoxSizer(wx.VERTICAL) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
366 |
self.SDOInfoBox = wx.StaticBox(self, label=_("SDO Entries")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
367 |
self.SDOMonitorBox = wx.StaticBox(self, label=_("SDO Monitor")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
368 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
369 |
self.SDONoteBook = SDONoteBook(self, controler=self.Controler) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
370 |
self.SDOInfoBoxSizer = wx.StaticBoxSizer(self.SDOInfoBox, orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
371 |
self.SDOMonitorBoxSizer = wx.StaticBoxSizer(self.SDOMonitorBox, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
372 |
orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
373 |
self.SDOInfoBoxSizer.Add(self.SDOUpdateBtn) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
374 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
375 |
self.SDOInfoBoxSizer.Add(self.SDONoteBook, wx.ALL|wx.EXPAND) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
376 |
self.SDOMonitorBoxSizer.Add(self.SDOMonitorRB) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
377 |
self.SDOMonitorBoxSizer.Add(self.SDOMonitorGrid) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
378 |
self.SDOManagementMainSizer.AddMany([self.SDOInfoBoxSizer, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
379 |
self.SDOMonitorBoxSizer]) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
380 |
self.SetSizer(self.SDOManagementMainSizer) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
381 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
382 |
#----------------------------- fill the contents --------------------------# |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
383 |
#self.entries = self.Controler.CTNParent.CTNParent.GetEntriesList() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
384 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
385 |
slave = self.Controler.CTNParent.GetSlave(self.Controler.GetSlavePos()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
386 |
type_infos = slave.getType() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
387 |
device, alignment = self.Controler.CTNParent.GetModuleInfos(type_infos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
388 |
self.entries = device.GetEntriesList() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
389 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
390 |
self.Controler.CommonMethod.SDOVariables = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
391 |
self.Controler.CommonMethod.SDOSubEntryData = [] |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
392 |
self.Controler.CommonMethod.ClearSDODataSet() |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
393 |
self.SDOParserXML(self.entries) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
394 |
self.SDONoteBook.CreateNoteBook() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
395 |
self.CreateSDOMonitorGrid() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
396 |
self.Refresh() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
397 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
398 |
def OnSDOUpdate(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
399 |
SlavePos = self.Controler.GetSlavePos() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
400 |
num = self.SDOPageNum - 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
401 |
if num < 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
402 |
for i in range(len(self.Controler.CommonMethod.SDOVariables)): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
403 |
data = self.Controler.GetCTRoot()._connector.GetSDOEntriesData( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
404 |
self.Controler.CommonMethod.SDOVariables[i], SlavePos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
405 |
self.Controler.CommonMethod.SDOVariables[i] = data |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
406 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
407 |
SDOUploadEntries = self.Controler.CommonMethod.SDOVariables[num] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
408 |
data = self.Controler.GetCTRoot()._connector.GetSDOEntriesData(SDOUploadEntries, SlavePos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
409 |
self.Controler.CommonMethod.SDOVariables[num] = data |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
410 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
411 |
self.SDONoteBook.CreateNoteBook() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
412 |
self.Refresh() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
413 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
414 |
def OnRadioBox(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
415 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
416 |
There are two selections that are on and off. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
417 |
If the on is selected, the monitor thread begins to run. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
418 |
If the off is selected, the monitor thread gets off. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
419 |
@param event: wx.EVT_RADIOBOX object |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
420 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
421 |
on, off = range(2) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
422 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
423 |
if event.GetInt() == on: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
424 |
CheckThreadFlag = self.SDOMonitoringThreadOn() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
425 |
if not CheckThreadFlag: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
426 |
self.SDOMonitorRB.SetSelection(off) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
427 |
elif event.GetInt() == off: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
428 |
self.SDOMonitoringThreadOff() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
429 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
430 |
def SDOMonitoringThreadOn(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
431 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
432 |
if check_connect_flag: |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
433 |
self.SetSDOTraceValues(self.SDOMonitorEntries) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
434 |
self.Controler.GetCTRoot()._connector.GetSDOData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
435 |
self.SDOTraceThread = Thread(target=self.SDOMonitorThreadProc) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
436 |
self.SDOMonitoringFlag = True |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
437 |
self.SDOTraceThread.start() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
438 |
return check_connect_flag |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
439 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
440 |
def SDOMonitoringThreadOff(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
441 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
442 |
if check_connect_flag: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
443 |
self.SDOMonitoringFlag = False |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
444 |
if self.SDOTraceThread is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
445 |
self.SDOTraceThread.join() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
446 |
self.SDOTraceThread = None |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
447 |
self.Controler.GetCTRoot()._connector.StopSDOThread() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
448 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
449 |
def SetSDOTraceValues(self, SDOMonitorEntries): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
450 |
SlavePos = self.Controler.GetSlavePos() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
451 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
452 |
if check_connect_flag: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
453 |
self.Controler.GetCTRoot()._connector.SetSDOTraceValues(SDOMonitorEntries, SlavePos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
454 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
455 |
def SDOMonitorThreadProc(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
456 |
while self.SDOMonitoringFlag and self.Controler.GetCTRoot()._connector.PLCStatus != "Started": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
457 |
self.SDOValuesList = self.Controler.GetCTRoot()._connector.GetSDOData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
458 |
LocalData = self.SDOValuesList[0].items() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
459 |
LocalData.sort() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
460 |
if self.SDOValuesList[1] != self.Controler.GetSlavePos(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
461 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
462 |
row = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
463 |
for (idx, subidx), data in LocalData: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
464 |
self.SDOMonitorGrid.SetCellValue(row, 6, str(data["value"])) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
465 |
row += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
466 |
time.sleep(0.5) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
467 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
468 |
def CreateSDOMonitorGrid(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
469 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
470 |
It creates SDO Monitor table and specifies cell size and labels. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
471 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
472 |
self.SDOMonitorGrid.CreateGrid(0,7) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
473 |
SDOCellSize = [(0, 65), (1, 65), (2, 50), (3, 70), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
474 |
(4, 40), (5, 450), (6, 85)] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
475 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
476 |
for (index, size) in SDOCellSize: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
477 |
self.SDOMonitorGrid.SetColSize(index, size) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
478 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
479 |
self.SDOMonitorGrid.SetRowLabelSize(0) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
480 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
481 |
SDOTableLabel = [(0, "Index"), (1, "Subindex"), (2, "Access"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
482 |
(3, "Type"), (4, "Size"), (5, "Name"), (6, "Value")] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
483 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
484 |
for (index, label) in SDOTableLabel: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
485 |
self.SDOMonitorGrid.SetColLabelValue(index, label) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
486 |
self.SDOMonitorGrid.SetColLabelAlignment(index, wx.ALIGN_CENTER) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
487 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
488 |
def onMonitorGridDoubleClick(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
489 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
490 |
Event Handler for double click on the SDO entries table. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
491 |
It adds the entry into the SDO monitor table. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
492 |
If the entry is already in the SDO monitor table, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
493 |
then it's removed from the SDO monitor table. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
494 |
@pram event: gridlib.EVT_GRID_CELL_LEFT_DCLICK object |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
495 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
496 |
row = event.GetRow() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
497 |
idx = self.SDOMonitorGrid.GetCellValue(row, 0) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
498 |
subIdx = self.SDOMonitorGrid.GetCellValue(row, 1) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
499 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
500 |
del self.SDOMonitorEntries[(idx, subIdx)] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
501 |
self.SDOMonitorGrid.DeleteRows(row, 1) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
502 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
503 |
self.SetSDOTraceValues(self.SDOMonitorEntries) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
504 |
self.SDOMonitorGrid.Refresh() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
505 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
506 |
def SDOParserXML(self, entries): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
507 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
508 |
Parse SDO data set that obtain "ESI file" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
509 |
@param entries: SDO entry list |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
510 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
511 |
entries_list = entries.items() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
512 |
entries_list.sort() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
513 |
self.ForDefaultValueFlag = False |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
514 |
self.CompareValue = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
515 |
self.sub_entry_value_list = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
516 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
517 |
for (index, subidx), entry in entries_list: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
518 |
# exclude entry that isn't in the objects |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
519 |
check_mapping = entry["PDOMapping"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
520 |
if check_mapping is "T" or check_mapping is "R": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
521 |
if "PDO index" not in entry.keys(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
522 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
523 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
524 |
idx = "0" + entry["Index"].strip("#") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
525 |
#subidx = hex(int(entry["SubIndex"], 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
526 |
try : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
527 |
subidx = "0x" + entry["SubIndex"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
528 |
except : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
529 |
subidx = "0x0" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
530 |
datatype = entry["Type"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
531 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
532 |
try : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
533 |
default_value = entry["DefaultData"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
534 |
except : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
535 |
default_value = " --- " |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
536 |
# Result of SlaveSDO data parsing. (data type : dictionary) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
537 |
self.Data = {'idx':idx, 'subIdx':subidx, 'access':entry["Access"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
538 |
'type':datatype, 'size': str(entry["BitSize"]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
539 |
'name':entry["Name"], 'value':default_value} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
540 |
category_divide_value = [0x1000, 0x2000, 0x6000, 0xa000, 0xffff] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
541 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
542 |
for count in range(len(category_divide_value)) : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
543 |
if int(idx, 0) < category_divide_value[count]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
544 |
self.Controler.CommonMethod.SDOVariables[count].append(self.Data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
545 |
break |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
546 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
547 |
self.Controler.CommonMethod.SDOSubEntryData = self.sub_entry_value_list |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
548 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
549 |
#------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
550 |
# For SDO Notebook (divide category) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
551 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
552 |
class SDONoteBook(wx.Notebook): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
553 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
554 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
555 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
556 |
@param parent: Reference to the parent SDOPanelClass class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
557 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
558 |
""" |
2366
d635680e4c2c
cleanup etherlab: pep8, E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2365
diff
changeset
|
559 |
wx.Notebook.__init__(self, parent, id=-1, size=(850, 500)) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
560 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
561 |
self.parent = parent |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
562 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
563 |
self.CreateNoteBook() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
564 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
565 |
def CreateNoteBook(self): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
566 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
567 |
Create each NoteBook page, divided SDO index |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
568 |
According to EtherCAT Communication(03/2011), 158p |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
569 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
570 |
self.Data = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
571 |
count = 1 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
572 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
573 |
page_texts = [("all", self.parent.AllSDOData), |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
574 |
("0x0000 - 0x0ff", self.parent.DatatypeDescription), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
575 |
("0x1000 - 0x1fff", self.parent.CommunicationObject), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
576 |
("0x2000 - 0x5fff", self.parent.ManufacturerSpecific), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
577 |
("0x6000 - 0x9fff", self.parent.ProfileSpecific), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
578 |
("0xa000 - 0xffff", self.parent.Reserved)] |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
579 |
|
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
580 |
# page_tooltip_string = ["SDO Index 0x0000 - 0x0fff : Data Type Description", |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
581 |
# "SDO Index 0x1000 - 0x1fff : Communication object", |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
582 |
# "SDO Index 0x2000 - 0x5fff : Manufacturer specific", |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
583 |
# "SDO Index 0x6000 - 0x9fff : Profile specific", |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
584 |
# "SDO Index 0xa000 - 0xffff : Reserved", |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
585 |
# "All SDO Object"] |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
586 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
587 |
self.DeleteAllPages() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
588 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
589 |
self.Controler.CommonMethod.SDOVariables[5] = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
590 |
for i in range(4): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
591 |
self.Controler.CommonMethod.SDOVariables[5] += self.Controler.CommonMethod.SDOVariables[i] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
592 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
593 |
for txt, count in page_texts: |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
594 |
self.Data = self.Controler.CommonMethod.SDOVariables[count] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
595 |
self.SubEntryData = self.Controler.CommonMethod.SDOSubEntryData |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
596 |
self.Win = SlaveSDOTable(self, self.Data, self.SubEntryData) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
597 |
self.AddPage(self.Win, txt) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
598 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
599 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
600 |
def OnPageChanged(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
601 |
old = event.GetOldSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
602 |
new = event.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
603 |
sel = self.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
604 |
self.parent.SDOPageNum = new |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
605 |
event.Skip() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
606 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
607 |
def OnPageChanging(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
608 |
old = event.GetOldSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
609 |
new = event.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
610 |
sel = self.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
611 |
event.Skip() |
2360
2a3d022a7dac
cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2358
diff
changeset
|
612 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
613 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
614 |
# For SDO Grid (fill index, subindex, etc...) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
615 |
# ------------------------------------------------------------------------------- |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
616 |
class SlaveSDOTable(wx.grid.Grid): |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
617 |
def __init__(self, parent, data, fixed_value): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
618 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
619 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
620 |
@param parent: Reference to the parent SDOPanelClass class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
621 |
@param data: SDO data after parsing "SDOParser" method |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
622 |
""" |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
623 |
wx.grid.Grid.__init__(self, parent, -1, size=(830, 490), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
624 |
style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
625 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
626 |
self.Controler = parent.Controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
627 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
628 |
self.SDOFlag = True |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
629 |
if data is None: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
630 |
self.SDOs = [] |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
631 |
self.sub_entry_value = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
632 |
else : |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
633 |
self.SDOs = data |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
634 |
self.sub_entry_value = fixed_value |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
635 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
636 |
self.CreateGrid(len(self.SDOs), 7) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
637 |
SDOCellSize = [(0, 65), (1, 65), (2, 50), (3, 70), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
638 |
(4, 40), (5, 400), (6, 135)] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
639 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
640 |
for (index, size) in SDOCellSize: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
641 |
self.SetColSize(index, size) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
642 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
643 |
self.SetRowLabelSize(0) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
644 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
645 |
SDOTableLabel = [(0, "Index"), (1, "Subindex"), (2, "Access"), |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
646 |
(3, "Type"), (4, "Size"), (5, "Name"), (6, "Value")] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
647 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
648 |
for (index, label) in SDOTableLabel: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
649 |
self.SetColLabelValue(index, label) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
650 |
self.SetColLabelAlignment(index, wx.ALIGN_CENTER) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
651 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
652 |
attr = wx.grid.GridCellAttr() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
653 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
654 |
# for SDO download and monitoring |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
655 |
self.Bind(gridlib.EVT_GRID_CELL_LEFT_DCLICK, self.onGridDoubleClick) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
656 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
657 |
for i in range(7): |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
658 |
self.SetColAttr(i, attr) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
659 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
660 |
self.SetColLabelAlignment(wx.ALIGN_CENTER, wx.ALIGN_CENTER) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
661 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
662 |
self.SetTableValue() |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
663 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
664 |
def SetTableValue(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
665 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
666 |
Cell is filled by new parsing data |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
667 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
668 |
sdo_list = ['idx', 'subIdx', 'access', 'type', 'size', 'name', 'value'] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
669 |
count = 0 |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
670 |
for row_idx in range(len(self.SDOs)): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
671 |
for col_idx in range(len(self.SDOs[row_idx])): |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
672 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
673 |
# the top entries that have sub index is shaded. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
674 |
if int(self.SDOs[row_idx]['subIdx'], 16) == 0x00: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
675 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
676 |
if int(self.SDOs[row_idx + 1]['subIdx'], 16) is not 0x00: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
677 |
self.SetCellBackgroundColour(row_idx, col_idx, \ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
678 |
wx.LIGHT_GREY) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
679 |
except: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
680 |
pass |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
681 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
682 |
if self.SDOs[row_idx][sdo_list[col_idx]] == "modifying": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
683 |
if len(self.sub_entry_value) == count: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
684 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
685 |
self.SetCellValue(row_idx, col_idx, self.sub_entry_value[count]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
686 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
687 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
688 |
self.SetCellValue(row_idx, col_idx, \ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
689 |
self.SDOs[row_idx][sdo_list[col_idx]]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
690 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
691 |
self.SetReadOnly(row_idx, col_idx, True) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
692 |
if col_idx < 5: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
693 |
self.SetCellAlignment(row_idx, col_idx, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
694 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
695 |
def CheckSDODataAccess(self, row): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
696 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
697 |
check that access field has "rw" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
698 |
@param row : Selected cell by user |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
699 |
@return Write_flag : If data has "w", flag is true |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
700 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
701 |
check = self.SDOs[row]['access'] |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
702 |
if check == "rw": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
703 |
return True |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
704 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
705 |
return False |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
706 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
707 |
def ClearStateFlag(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
708 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
709 |
Initialize StateFlag |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
710 |
StateFlag is notice SDOData access each slave state |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
711 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
712 |
self.Controler.CommonMethod.Check_PREOP = False |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
713 |
self.Controler.CommonMethod.Check_SAFEOP = False |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
714 |
self.Controler.CommonMethod.Check_OP = False |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
715 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
716 |
def onGridDoubleClick (self, event): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
717 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
718 |
Create dialog for SDO value modify |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
719 |
if user enter data, perform command "ethercat download" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
720 |
@param event : gridlib.EVT_GRID_CELL_LEFT_DCLICK object |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
721 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
722 |
self.ClearStateFlag() |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
723 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
724 |
# CheckSDODataAccess is checking that OD(Object Dictionary) has "w" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
725 |
if event.GetCol() == 6 and self.CheckSDODataAccess(event.GetRow()) : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
726 |
dlg = wx.TextEntryDialog (self, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
727 |
"Enter hex or dec value (if enter dec value, " \ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
728 |
+ "it automatically conversed hex value)", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
729 |
"SDOModifyDialog", style = wx.OK | wx.CANCEL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
730 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
731 |
start_value = self.GetCellValue(event.GetRow(), event.GetCol()) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
732 |
dlg.SetValue(start_value) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
733 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
734 |
if dlg.ShowModal() == wx.ID_OK: |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
735 |
# Check whether beremiz connected or not. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
736 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
737 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
738 |
if check_connect_flag: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
739 |
try : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
740 |
input_val = hex(int(dlg.GetValue(), 0)) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
741 |
# Request "SDODownload" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
742 |
return_val = self.Controler.CommonMethod.SDODownload( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
743 |
self.SDOs[event.GetRow()]["type"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
744 |
self.SDOs[event.GetRow()]["idx"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
745 |
self.SDOs[event.GetRow()]["subIdx"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
746 |
dlg.GetValue()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
747 |
if return_val is "": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
748 |
SDOUploadEntry = {"idx" : self.SDOs[event.GetRow()]["idx"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
749 |
"subIdx" : self.SDOs[event.GetRow()]["subIdx"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
750 |
"size" : self.SDOs[event.GetRow()]["size"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
751 |
} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
752 |
data = self.Controler.GetCTRoot()._connector.GetSDOEntryData( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
753 |
SDOUploadEntry, self.Controler.GetSlavePos()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
754 |
hex_val = hex(data)[:-1] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
755 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
756 |
# download data check |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
757 |
if input_val == hex_val: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
758 |
display_val = "%s(%d)" % (hex_val, data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
759 |
self.SetCellValue(event.GetRow(), event.GetCol(), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
760 |
display_val) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
761 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
762 |
self.Controler.CommonMethod.CreateErrorDialog(\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
763 |
'SDO Value not completely download, please try again') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
764 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
765 |
self.Controler.GetCTRoot().logger.write_error(return_val) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
766 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
767 |
# Error occured process of "int(variable)" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
768 |
# User input is not hex, dec value |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
769 |
except ValueError: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
770 |
self.Controler.CommonMethod.CreateErrorDialog(\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
771 |
'You can input only hex, dec value') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
772 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
773 |
SDOPanel = self.parent.parent |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
774 |
row = event.GetRow() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
775 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
776 |
idx = self.SDOs[row]["idx"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
777 |
subIdx = self.SDOs[row]["subIdx"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
778 |
SDOPanel.SDOMonitorEntries[(idx, subIdx)] = { |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
779 |
"access": self.SDOs[row]["access"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
780 |
"type": self.SDOs[row]["type"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
781 |
"size": self.SDOs[row]["size"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
782 |
"name": self.SDOs[row]["name"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
783 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
784 |
"value": ""} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
785 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
786 |
del_rows = SDOPanel.SDOMonitorGrid.GetNumberRows() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
787 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
788 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
789 |
SDOPanel.SDOMonitorGrid.DeleteRows(0, del_rows) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
790 |
except: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
791 |
pass |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
792 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
793 |
SDOPanel.SDOMonitorGrid.AppendRows(len(SDOPanel.SDOMonitorEntries)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
794 |
SDOPanel.SetSDOTraceValues(SDOPanel.SDOMonitorEntries) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
795 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
796 |
SME_list = SDOPanel.SDOMonitorEntries.items() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
797 |
SME_list.sort() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
798 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
799 |
gridRow = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
800 |
for (idx, subIdx), entry in SME_list: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
801 |
SDOPanel.SDOMonitorGrid.SetCellValue(gridRow, 0, str(idx)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
802 |
SDOPanel.SDOMonitorGrid.SetCellValue(gridRow, 1, str(subIdx)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
803 |
for col, key in [(2, "access"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
804 |
(3, "type"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
805 |
(4, "size"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
806 |
(5, "name")]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
807 |
SDOPanel.SDOMonitorGrid.SetCellValue(gridRow, col, entry[key]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
808 |
for col in range(7): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
809 |
SDOPanel.SDOMonitorGrid.SetReadOnly(gridRow, col, True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
810 |
if col < 5 : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
811 |
SDOPanel.SDOMonitorGrid.SetCellAlignment(\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
812 |
gridRow, col, wx.ALIGN_CENTER, wx.ALIGN_CENTER) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
813 |
gridRow += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
814 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
815 |
SDOPanel.SDOMonitorGrid.Refresh() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
816 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
817 |
#------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
818 |
# For PDO Mapping Panel |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
819 |
# PDO Class UI : Panel -> Choicebook (RxPDO, TxPDO) -> |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
820 |
# Notebook (PDO Index) -> Grid (PDO entry) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
821 |
#------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
822 |
class PDOPanelClass(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
823 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
824 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
825 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
826 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
827 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
828 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
829 |
wx.Panel.__init__(self, parent, -1) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
830 |
self.Controler = controler |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
831 |
sizer = wx.FlexGridSizer(cols=1, hgap=20,rows=3, vgap=20) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
832 |
line = wx.StaticText(self, -1, "\n In order to control Ethercat device, user must select proper PDO set.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
833 |
\n Each PDO sets describe operation modes (CSP, CSV, CST) supported by Ethercat devices.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
834 |
\n\n PDOs have two types, RxPDO and TxPDO.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
835 |
\n - RxPDO refers to the Receive Process Data Object. It means the control parameters which sent from controller to the EtherCAT Slave device.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
836 |
\n In general, ControlWord (0x6040), Modes of Operations (0x6060), and TargetPosition (0x607A) are regarded as RxPDO.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
837 |
\n - TxPDO refers to the Transmit Process Data Object. It used to report status of EtherCAT Slave device to the controller in order to calibrate their next actuation.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
838 |
\n StatusWord (0x6041), Modes of Operation Display (0x6061), and ActualPosition (0x607A) include in TxPDO.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
839 |
\n\n PDO Mapping feature provides available RxPDO and TxPDO sets which defined in Ethercat slave description XML.\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
840 |
\n If there is no selection of PDO set, first set (0x1600, 0x1A00) will be chosen as default configuration.") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
841 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
842 |
sizer.Add(line) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
843 |
self.SetSizer(sizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
844 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
845 |
class RxPDOPanelClass(wx.Panel): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
846 |
def __init__(self, parent, controler): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
847 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
848 |
Constructor |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
849 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
850 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
851 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
852 |
wx.Panel.__init__(self, parent, -1) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
853 |
self.Controler = controler |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
854 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
855 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
856 |
#self.PDOIndexList = ["RxPDO"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
857 |
self.PDOIndexList = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
858 |
self.LoadPDOSelectData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
859 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
860 |
#HSAHN ADD. 2015.7.26 PDO Select Function ADD |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
861 |
self.Controler.CommonMethod.RequestPDOInfo() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
862 |
self.PDOcheckBox = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
863 |
self.rx_pdo_entries = self.Controler.CommonMethod.GetRxPDOCategory() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
864 |
if len(self.rx_pdo_entries): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
865 |
for i in range(len(self.rx_pdo_entries)): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
866 |
self.PDOcheckBox.append(wx.CheckBox(self, label=str(hex(self.rx_pdo_entries[i]['pdo_index'])), size=(120,15))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
867 |
if not self.Controler.SelectedRxPDOIndex and self.rx_pdo_entries[i]['sm'] is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
868 |
self.PDOcheckBox[-1].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
869 |
self.Controler.SelectedRxPDOIndex.append(int(self.PDOcheckBox[-1].GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
870 |
self.InitSavePDO() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
871 |
elif self.rx_pdo_entries[i]['pdo_index'] in self.Controler.SelectedRxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
872 |
self.PDOIndexList.append(str(hex(self.rx_pdo_entries[i]['pdo_index']))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
873 |
self.PDOcheckBox[-1].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
874 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
875 |
for cb in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
876 |
self.Bind(wx.EVT_CHECKBOX, self.PDOSelectCheck, cb) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
877 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
878 |
self.PDOListBox = wx.StaticBox(self, label=_("PDO Mapping Select")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
879 |
self.PDOListBoxSizer = wx.StaticBoxSizer(self.PDOListBox, orient=wx.HORIZONTAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
880 |
self.RxPDOListBox = wx.StaticBox(self, label=_("RxPDO")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
881 |
self.RxPDOListBoxSizer = wx.StaticBoxSizer(self.RxPDOListBox, orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
882 |
self.RxPDOListBoxInnerSizer = wx.FlexGridSizer(cols=3, hgap=5, rows=10, vgap=5) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
883 |
self.RxPDOListBoxInnerSizer.AddMany(self.PDOcheckBox[0:len(self.rx_pdo_entries)]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
884 |
self.RxPDOListBoxSizer.Add(self.RxPDOListBoxInnerSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
885 |
self.PDOListBoxSizer.Add(self.RxPDOListBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
886 |
self.PDOWarningText = wx.StaticText(self, -1, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
887 |
" *Warning*\n\n By default configuration, \n\n first mapping set is selected. \n\n Choose the PDO mapping!", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
888 |
size=(220, -1)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
889 |
self.PDOListBoxSizer.Add(self.PDOWarningText) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
890 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
891 |
self.PDOMonitoringEditorMainSizer = wx.BoxSizer(wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
892 |
self.PDOMonitoringEditorInnerMainSizer = wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=10) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
893 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
894 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
895 |
self.CallPDOChoicebook = PDONoteBook(self, controler=self.Controler, name="Rx") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
896 |
self.PDOMonitoringEditorInnerMainSizer.Add(self.CallPDOChoicebook, wx.ALL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
897 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
898 |
self.PDOInformationBox = wx.StaticBox(self, label=_("RxPDO Mapping List")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
899 |
self.PDOInformationBoxSizer = wx.StaticBoxSizer(self.PDOInformationBox, orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
900 |
self.PDOInformationBoxSizer.Add(self.PDOMonitoringEditorInnerMainSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
901 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
902 |
self.PDOMonitoringEditorMainSizer.Add(self.PDOListBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
903 |
self.PDOMonitoringEditorMainSizer.Add(self.PDOInformationBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
904 |
self.SetSizer(self.PDOMonitoringEditorMainSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
905 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
906 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
907 |
self.PDOExcludeCheck() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
908 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
909 |
sizer = wx.FlexGridSizer(cols=1, hgap=20,rows=3, vgap=20) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
910 |
line = wx.StaticText(self, -1, "\n This device does not support RxPDO.") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
911 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
912 |
sizer.Add(line) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
913 |
self.SetSizer(sizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
914 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
915 |
def LoadPDOSelectData(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
916 |
RxPDOData = self.Controler.BaseParams.getRxPDO() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
917 |
RxPDOs = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
918 |
if RxPDOData != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
919 |
RxPDOs = RxPDOData.split() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
920 |
if RxPDOs : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
921 |
for RxPDO in RxPDOs : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
922 |
self.Controler.SelectedRxPDOIndex.append(int(RxPDO, 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
923 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
924 |
def PDOSelectCheck(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
925 |
# add jblee for Save User Select |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
926 |
cb = event.GetEventObject() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
927 |
# prevent duplicated check |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
928 |
if cb.GetValue() and int(cb.GetLabel(), 0) not in self.Controler.SelectedRxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
929 |
self.Controler.SelectedRxPDOIndex.append(int(cb.GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
930 |
self.PDOIndexList.append(cb.GetLabel()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
931 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
932 |
self.Controler.SelectedRxPDOIndex.remove(int(cb.GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
933 |
self.PDOIndexList.remove(cb.GetLabel()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
934 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
935 |
data = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
936 |
for PDOIndex in self.PDOIndexList: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
937 |
data = data + " " + PDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
938 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
939 |
self.Controler.BaseParams.setRxPDO(data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
940 |
self.Controler.GetCTRoot().CTNRequestSave() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
941 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
942 |
self.PDOExcludeCheck() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
943 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
944 |
def InitSavePDO(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
945 |
for PDOIndex in self.Controler.SelectedRxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
946 |
self.PDOIndexList.append(str(hex(PDOIndex))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
947 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
948 |
data = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
949 |
for PDOIndex in self.PDOIndexList: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
950 |
data = data + " " + PDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
951 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
952 |
self.Controler.BaseParams.setRxPDO(data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
953 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
954 |
# 2016.06.21 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
955 |
# add jblee for check exclude pdo list |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
956 |
def PDOExcludeCheck(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
957 |
#files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
958 |
#filepath = os.path.join(self.Controler.CTNPath(), "DataForPDO.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
959 |
CurIndexs = self.Controler.SelectedRxPDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
960 |
for CB in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
961 |
if len(CB.GetLabel().split()) > 1: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
962 |
CB.Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
963 |
CB.SetLabel(CB.GetLabel().split()[0]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
964 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
965 |
for pdo in self.rx_pdo_entries: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
966 |
for CurIndex in CurIndexs: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
967 |
if pdo["pdo_index"] == CurIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
968 |
ex_list = pdo["exclude_list"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
969 |
for ex_item in ex_list: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
970 |
for CB in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
971 |
if CB.GetLabel() == hex(ex_item): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
972 |
CB.SetLabel(CB.GetLabel() + " (Excluded)") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
973 |
CB.Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
974 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
975 |
def RefreshPDOInfo(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
976 |
pass |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
977 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
978 |
def PDOInfoUpdate(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
979 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
980 |
Call RequestPDOInfo method and create Choicebook |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
981 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
982 |
self.Controler.CommonMethod.RequestPDOInfo() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
983 |
self.CallPDOChoicebook.Destroy() |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
984 |
self.CallPDOChoicebook = PDOChoicebook(self, controler=self.Controler, name="Rx") |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
985 |
self.Refresh() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
986 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
987 |
class TxPDOPanelClass(wx.Panel): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
988 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
989 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
990 |
Constructor |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
991 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
992 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
993 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
994 |
wx.Panel.__init__(self, parent, -1) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
995 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
996 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
997 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
998 |
self.PDOIndexList = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
999 |
self.LoadPDOSelectData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1000 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1001 |
#HSAHN ADD. 2015.7.26 PDO Select Function ADD |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1002 |
self.Controler.CommonMethod.RequestPDOInfo() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1003 |
self.PDOcheckBox = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1004 |
self.tx_pdo_entries = self.Controler.CommonMethod.GetTxPDOCategory() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1005 |
if len(self.tx_pdo_entries): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1006 |
for i in range(len(self.tx_pdo_entries)): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1007 |
self.PDOcheckBox.append(wx.CheckBox(self, label=str(hex(self.tx_pdo_entries[i]['pdo_index'])), size=(120,15))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1008 |
if not self.Controler.SelectedTxPDOIndex and self.tx_pdo_entries[i]['sm'] is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1009 |
self.PDOcheckBox[-1].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1010 |
self.Controler.SelectedTxPDOIndex.append(int(self.PDOcheckBox[-1].GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1011 |
self.InitSavePDO() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1012 |
elif self.tx_pdo_entries[i]['pdo_index'] in self.Controler.SelectedTxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1013 |
self.PDOIndexList.append(str(hex(self.tx_pdo_entries[i]['pdo_index']))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1014 |
self.PDOcheckBox[-1].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1015 |
for cb in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1016 |
self.Bind(wx.EVT_CHECKBOX, self.PDOSelectCheck, cb) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1017 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1018 |
self.PDOListBox = wx.StaticBox(self, label=_("PDO Mapping Select")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1019 |
self.PDOListBoxSizer = wx.StaticBoxSizer(self.PDOListBox, orient=wx.HORIZONTAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1020 |
self.TxPDOListBox = wx.StaticBox(self, label=_("TxPDO")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1021 |
self.TxPDOListBoxSizer = wx.StaticBoxSizer(self.TxPDOListBox, orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1022 |
self.TxPDOListBoxInnerSizer = wx.FlexGridSizer(cols=3, hgap=5, rows=10, vgap=5) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1023 |
self.TxPDOListBoxInnerSizer.AddMany(self.PDOcheckBox[0:len(self.tx_pdo_entries)]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1024 |
self.TxPDOListBoxSizer.Add(self.TxPDOListBoxInnerSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1025 |
self.PDOListBoxSizer.Add(self.TxPDOListBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1026 |
self.PDOWarningText = wx.StaticText(self, -1, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1027 |
" *Warning*\n\n By default configuration, \n\n first mapping set is selected. \n\n Choose the PDO mapping!", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1028 |
size=(220, -1)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1029 |
self.PDOListBoxSizer.Add(self.PDOWarningText) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1030 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1031 |
self.PDOMonitoringEditorMainSizer = wx.BoxSizer(wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1032 |
self.PDOMonitoringEditorInnerMainSizer = wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=10) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1033 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1034 |
self.CallPDOChoicebook = PDONoteBook(self, controler=self.Controler, name="Tx") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1035 |
self.PDOMonitoringEditorInnerMainSizer.Add(self.CallPDOChoicebook, wx.ALL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1036 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1037 |
self.PDOInformationBox = wx.StaticBox(self, label=_("TxPDO Mapping List")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1038 |
self.PDOInformationBoxSizer = wx.StaticBoxSizer(self.PDOInformationBox, orient=wx.VERTICAL) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1039 |
self.PDOInformationBoxSizer.Add(self.PDOMonitoringEditorInnerMainSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1040 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1041 |
self.PDOMonitoringEditorMainSizer.Add(self.PDOListBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1042 |
self.PDOMonitoringEditorMainSizer.Add(self.PDOInformationBoxSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1043 |
self.SetSizer(self.PDOMonitoringEditorMainSizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1044 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1045 |
# add jblee |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1046 |
self.PDOExcludeCheck() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1047 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1048 |
sizer = wx.FlexGridSizer(cols=1, hgap=20,rows=3, vgap=20) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1049 |
line = wx.StaticText(self, -1, "\n This device does not support TxPDO.") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1050 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1051 |
sizer.Add(line) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1052 |
self.SetSizer(sizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1053 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1054 |
def LoadPDOSelectData(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1055 |
TxPDOData = self.Controler.BaseParams.getTxPDO() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1056 |
TxPDOs = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1057 |
if TxPDOData != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1058 |
TxPDOs = TxPDOData.split() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1059 |
if TxPDOs : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1060 |
for TxPDO in TxPDOs : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1061 |
self.Controler.SelectedTxPDOIndex.append(int(TxPDO, 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1062 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1063 |
def PDOSelectCheck(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1064 |
# add jblee for Save User Select |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1065 |
cb = event.GetEventObject() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1066 |
# prevent duplicated check |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1067 |
if cb.GetValue() and int(cb.GetLabel(), 0) not in self.Controler.SelectedTxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1068 |
self.Controler.SelectedTxPDOIndex.append(int(cb.GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1069 |
self.PDOIndexList.append(cb.GetLabel()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1070 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1071 |
self.Controler.SelectedTxPDOIndex.remove(int(cb.GetLabel(), 0)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1072 |
self.PDOIndexList.remove(cb.GetLabel()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1073 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1074 |
data = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1075 |
for PDOIndex in self.PDOIndexList: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1076 |
data = data + " " + PDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1077 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1078 |
self.Controler.BaseParams.setTxPDO(data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1079 |
self.Controler.GetCTRoot().CTNRequestSave() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1080 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1081 |
self.PDOExcludeCheck() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1082 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1083 |
def InitSavePDO(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1084 |
for PDOIndex in self.Controler.SelectedTxPDOIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1085 |
self.PDOIndexList.append(str(hex(PDOIndex))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1086 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1087 |
data = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1088 |
for PDOIndex in self.PDOIndexList: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1089 |
data = data + " " + PDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1090 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1091 |
self.Controler.BaseParams.setTxPDO(data) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1092 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1093 |
# 2016.06.21 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1094 |
# add jblee for check exclude pdo list |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1095 |
def PDOExcludeCheck(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1096 |
CurIndexs = self.Controler.SelectedTxPDOIndex |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1097 |
for CB in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1098 |
if len(CB.GetLabel().split()) > 1: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1099 |
CB.Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1100 |
CB.SetLabel(CB.GetLabel().split()[0]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1101 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1102 |
for pdo in self.tx_pdo_entries: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1103 |
for CurIndex in CurIndexs: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1104 |
if pdo["pdo_index"] == CurIndex: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1105 |
ex_list = pdo["exclude_list"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1106 |
for ex_item in ex_list: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1107 |
for CB in self.PDOcheckBox: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1108 |
if CB.GetLabel() == hex(ex_item): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1109 |
CB.SetLabel(CB.GetLabel() + " (Excluded)") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1110 |
CB.Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1111 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1112 |
def PDOInfoUpdate(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1113 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1114 |
Call RequestPDOInfo method and create Choicebook |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1115 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1116 |
self.Controler.CommonMethod.RequestPDOInfo() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1117 |
self.CallPDOChoicebook.Destroy() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1118 |
self.CallPDOChoicebook = PDOChoicebook(self, controler=self.Controler, name="Tx") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1119 |
self.Refresh() |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1120 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1121 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1122 |
# For PDO Notebook (divide PDO index) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1123 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1124 |
class PDONoteBook(wx.Notebook): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1125 |
def __init__(self, parent, name, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1126 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1127 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1128 |
@param parent: Reference to the parent PDOChoicebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1129 |
@param name: identifier whether RxPDO or TxPDO |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1130 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1131 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1132 |
wx.Notebook.__init__(self, parent, id=-1, size=(600, 400)) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1133 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1134 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1135 |
count = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1136 |
page_texts = [] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1137 |
|
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1138 |
if name == "Tx": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1139 |
# obtain pdo_info and pdo_entry |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1140 |
# pdo_info include (PDO index, name, number of entry) |
2373
73d35ba8f982
clean etherlab: pep8, E222 multiple spaces after operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2369
diff
changeset
|
1141 |
pdo_info = self.Controler.CommonMethod.GetTxPDOCategory() |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1142 |
pdo_entry = self.Controler.CommonMethod.GetTxPDOInfo() |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1143 |
for tmp in pdo_info: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1144 |
title = str(hex(tmp['pdo_index'])) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1145 |
page_texts.append(title) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1146 |
# RX PDO case |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1147 |
else: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1148 |
pdo_info = self.Controler.CommonMethod.GetRxPDOCategory() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1149 |
pdo_entry = self.Controler.CommonMethod.GetRxPDOInfo() |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1150 |
for tmp in pdo_info: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1151 |
title = str(hex(tmp['pdo_index'])) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1152 |
page_texts.append(title) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1153 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1154 |
# Add page depending on the number of pdo_info |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1155 |
for txt in page_texts: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1156 |
win = PDOEntryTable(self, pdo_info, pdo_entry, count) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1157 |
self.AddPage(win, txt) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1158 |
count += 1 |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1159 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1160 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1161 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1162 |
# For PDO Grid (fill entry index, subindex etc...) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1163 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1164 |
class PDOEntryTable(wx.grid.Grid): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1165 |
def __init__(self, parent, info, entry, count): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1166 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1167 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1168 |
@param parent: Reference to the parent PDONoteBook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1169 |
@param info : data structure including entry index, sub index, name, length, type |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1170 |
@param entry : data structure including index, name, entry number |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1171 |
@param count : page number |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1172 |
""" |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1173 |
wx.grid.Grid.__init__(self, parent, -1, size=(500, 400), pos=wx.Point(0, 0), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
1174 |
style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1175 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1176 |
self.Controler = parent.Controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1177 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1178 |
self.PDOInfo = info |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1179 |
self.PDOEntry = entry |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1180 |
self.Count = count |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1181 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1182 |
self.CreateGrid(self.PDOInfo[self.Count]['number_of_entry'], 5) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1183 |
self.SetColLabelSize(25) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1184 |
self.SetRowLabelSize(0) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1185 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1186 |
PDOTableLabel = [(0, "Index"), (1, "Subindex"), (2, "Length"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1187 |
(3, "Type"), (4, "Name")] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1188 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1189 |
for (index, label) in PDOTableLabel: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1190 |
self.SetColLabelValue(index, label) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1191 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1192 |
PDOCellSize = [(0, 45), (1, 65), (2, 55), (3, 40), (4, 300)] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1193 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1194 |
for (index, size) in PDOCellSize: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1195 |
self.SetColSize(index, size) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1196 |
self.SetColLabelAlignment(index, wx.ALIGN_LEFT) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1197 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1198 |
attr = wx.grid.GridCellAttr() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1199 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1200 |
for i in range(5): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1201 |
self.SetColAttr(i, attr) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1202 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1203 |
self.SetTableValue() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1204 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1205 |
def SetTableValue(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1206 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1207 |
Cell is filled by new parsing data in XML |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1208 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1209 |
list_index = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1210 |
# number of entry |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1211 |
for i in range(self.Count + 1): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1212 |
list_index += self.PDOInfo[i]['number_of_entry'] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1213 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1214 |
start_value = list_index - self.PDOInfo[self.Count]['number_of_entry'] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1215 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1216 |
pdo_list = ['entry_index', 'subindex', 'bitlen', 'type', 'name'] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1217 |
for row_idx in range(self.PDOInfo[self.Count]['number_of_entry']): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1218 |
for col_idx in range(len(self.PDOEntry[row_idx])): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1219 |
# entry index is converted hex value. |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1220 |
if col_idx == 0: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1221 |
self.SetCellValue(row_idx, col_idx, hex(self.PDOEntry[start_value][pdo_list[col_idx]])) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1222 |
else: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1223 |
self.SetCellValue(row_idx, col_idx, str(self.PDOEntry[start_value][pdo_list[col_idx]])) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1224 |
if col_idx != 4: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1225 |
self.SetCellAlignment(row_idx, col_idx, wx.ALIGN_CENTRE, wx.ALIGN_CENTRE) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1226 |
else: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1227 |
self.SetCellAlignment(row_idx, col_idx, wx.ALIGN_LEFT, wx.ALIGN_CENTRE) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1228 |
self.SetReadOnly(row_idx, col_idx, True) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1229 |
self.SetRowSize(row_idx, 25) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1230 |
start_value += 1 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1231 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1232 |
#------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1233 |
# For MDP Main Panel |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1234 |
#------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1235 |
class MDPPanel(wx.Panel): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1236 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1237 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1238 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1239 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1240 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1241 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1242 |
wx.Panel.__init__(self, parent, -1) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1243 |
self.parent = parent |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1244 |
self.Controler = controler |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1245 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1246 |
sizer = wx.FlexGridSizer(cols=3, hgap=20, rows=1, vgap=20) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1247 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1248 |
# Include Module ListBox |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1249 |
leftInnerSizer = wx.FlexGridSizer(cols=1, hgap=10,rows=2, vgap=10) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1250 |
# Include Add, Delete Button |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1251 |
middleInnerSizer = wx.FlexGridSizer(cols=1, hgap=10,rows=2, vgap=10) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1252 |
# Include Slot ListBox |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1253 |
rightInnerSizer = wx.FlexGridSizer(cols=1, hgap=10,rows=2, vgap=10) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1254 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1255 |
# Get Module Name as Array |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1256 |
# MDPArray = {SlaveName, [data0, data1, ...], SlotIndexIncrement, SlotPdoIncrement} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1257 |
# data = [ModuleName, ModuleInfo, [PDOInfo1, PDOInfo2, ...]] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1258 |
# PDOInfo = {Index, Name, BitSize, Access, PDOMapping, SubIndex, Type} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1259 |
slave = self.Controler.CTNParent.GetSlave(self.Controler.GetSlavePos()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1260 |
type_infos = slave.getType() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1261 |
MDPArray = self.Controler.CTNParent.CTNParent.GetMDPInfos(type_infos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1262 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1263 |
NameSet = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1264 |
if MDPArray: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1265 |
for info in MDPArray[0][1]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1266 |
NameSet.append(info[0]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1267 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1268 |
# Module ListBox |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1269 |
self.ModuleLabel = wx.StaticText(self, -1, "Module") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1270 |
self.ModuleListBox = wx.ListBox(self, size = (150, 200), choices = NameSet) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1271 |
#self.ModuleListBox = wx.ListBox(self, size = (150, 200), choices = []) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1272 |
self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnModuleListBoxDCClick, self.ModuleListBox) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1273 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1274 |
# Button |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1275 |
self.AddButton = wx.Button(self, label=_(" Add Module ")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1276 |
self.DeleteButton = wx.Button(self, label=_("Delete Module")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1277 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1278 |
# Button Event Mapping |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1279 |
self.AddButton.Bind(wx.EVT_BUTTON, self.OnAddButton) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1280 |
self.DeleteButton.Bind(wx.EVT_BUTTON, self.OnDeleteButton) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1281 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1282 |
# Slot ListBox |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1283 |
self.SlotLabel = wx.StaticText(self, -1, "Slot") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1284 |
self.SlotListBox = wx.ListBox(self, size = (150, 200)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1285 |
self.Bind(wx.EVT_LISTBOX_DCLICK, self.OnSlotListBoxDCClick, self.SlotListBox) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1286 |
self.SelectModule = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1287 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1288 |
# Add Object Each Sizer |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1289 |
leftInnerSizer.AddMany([self.ModuleLabel, self.ModuleListBox]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1290 |
middleInnerSizer.Add(self.AddButton, 0, wx.TOP, 100) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1291 |
middleInnerSizer.Add(self.DeleteButton, 0, wx.BOTTOM, 120) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1292 |
rightInnerSizer.AddMany([self.SlotLabel, self.SlotListBox]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1293 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1294 |
sizer.AddMany([leftInnerSizer, middleInnerSizer, rightInnerSizer]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1295 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1296 |
self.SetSizer(sizer) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1297 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1298 |
self.InitMDPSet() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1299 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1300 |
def InitMDPSet(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1301 |
files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1302 |
filepath = os.path.join(self.Controler.CTNPath(), "DataForMDP.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1303 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1304 |
moduleDataFile = open(filepath, 'r') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1305 |
lines = moduleDataFile.readlines() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1306 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1307 |
for line in lines: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1308 |
if line == "\n": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1309 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1310 |
module_pos = line.split()[-1] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1311 |
name_len_limit = len(line) - len(module_pos) - 2 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1312 |
module_name = line[0:name_len_limit] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1313 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1314 |
self.SelectModule.append((module_name, int(module_pos))) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1315 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1316 |
localModuleInfo = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1317 |
count = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1318 |
for (item, pos) in self.SelectModule: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1319 |
slotString = "Slot %d %s : " % (count, item.split()[1]) + item.split()[0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1320 |
localModuleInfo.append(slotString) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1321 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1322 |
self.SlotListBox.SetItems(localModuleInfo) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1323 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1324 |
except: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1325 |
moduleDataFile = open(filepath, 'w') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1326 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1327 |
moduleDataFile.close() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1328 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1329 |
def OnAddButton(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1330 |
files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1331 |
filepath = os.path.join(self.Controler.CTNPath(), "DataForMDP.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1332 |
moduleDataFile = open(filepath, 'w') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1333 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1334 |
selectNum = self.ModuleListBox.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1335 |
if selectNum >= 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1336 |
selectStr = self.ModuleListBox.GetString(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1337 |
self.SelectModule.append((selectStr, selectNum)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1338 |
localModuleInfo = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1339 |
count = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1340 |
for (item, pos) in self.SelectModule: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1341 |
slotString = "Slot %d %s : " % (count, item.split()[1]) + item.split()[0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1342 |
localModuleInfo.append(slotString) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1343 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1344 |
self.SlotListBox.SetItems(localModuleInfo) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1345 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1346 |
moduleDataFile.close() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1347 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1348 |
def OnDeleteButton(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1349 |
files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1350 |
filepath = os.path.join(self.Controler.CTNPath(), "DataForMDP.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1351 |
moduleDataFile = open(filepath, 'w') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1352 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1353 |
selectNum = self.SlotListBox.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1354 |
if selectNum >= 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1355 |
selectStr = self.SlotListBox.GetString(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1356 |
self.SelectModule.pop(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1357 |
localModuleInfo = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1358 |
count = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1359 |
for (item, pos) in self.SelectModule: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1360 |
moduleDataFile.write(item + " " + str(pos) + "\n") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1361 |
slotString = "Slot %d %s : " % (count, item.split()[1]) + item.split()[0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1362 |
localModuleInfo.append(slotString) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1363 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1364 |
self.SlotListBox.SetItems(localModuleInfo) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1365 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1366 |
moduleDataFile.close() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1367 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1368 |
def OnModuleListBoxDCClick(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1369 |
files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1370 |
filepath = os.path.join(self.Controler.CTNPath(), "DataForMDP.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1371 |
moduleDataFile = open(filepath, 'w') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1372 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1373 |
selectNum = self.ModuleListBox.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1374 |
if selectNum >= 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1375 |
selectStr = self.ModuleListBox.GetString(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1376 |
self.SelectModule.append((selectStr, selectNum)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1377 |
localModuleInfo = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1378 |
count = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1379 |
for (item, pos) in self.SelectModule: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1380 |
moduleDataFile.write(item + " " + str(pos) + "\n") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1381 |
slotString = "Slot %d %s : " % (count, item.split()[1]) + item.split()[0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1382 |
localModuleInfo.append(slotString) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1383 |
module = self.Controler.CTNParent.CTNParent.GetSelectModule(pos) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1384 |
self.Controler.CommonMethod.SavePDOData(module) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1385 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1386 |
self.SlotListBox.SetItems(localModuleInfo) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1387 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1388 |
moduleDataFile.close() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1389 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1390 |
def OnSlotListBoxDCClick(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1391 |
files = os.listdir(self.Controler.CTNPath()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1392 |
filepath = os.path.join(self.Controler.CTNPath(), "DataForMDP.txt") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1393 |
moduleDataFile = open(filepath, 'w') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1394 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1395 |
selectNum = self.SlotListBox.GetSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1396 |
if selectNum >= 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1397 |
selectStr = self.SlotListBox.GetString(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1398 |
self.SelectModule.pop(selectNum) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1399 |
localModuleInfo = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1400 |
count = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1401 |
for (item, pos) in self.SelectModule: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1402 |
moduleDataFile.write(item + " " + str(pos) + "\n") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1403 |
slotString = "Slot %d %s : " % (count, item.split()[1]) + item.split()[0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1404 |
localModuleInfo.append(slotString) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1405 |
count += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1406 |
self.SlotListBox.SetItems(localModuleInfo) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1407 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1408 |
moduleDataFile.close() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1409 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1410 |
# ------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1411 |
# For EEPROM Access Main Panel |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1412 |
# (This class explain EEPROM Access) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1413 |
# ------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1414 |
class EEPROMAccessPanel(wx.Panel): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1415 |
def __init__(self, parent, controler): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1416 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1417 |
Constructor |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1418 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1419 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1420 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1421 |
wx.Panel.__init__(self, parent, -1) |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1422 |
sizer = wx.FlexGridSizer(cols=1, hgap=20, rows=3, vgap=20) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1423 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1424 |
line = wx.StaticText(self, -1, "\n EEPROM Access is composed to SmartView and HexView. \ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1425 |
\n\n - SmartView shows Config Data, Device Identity, Mailbox settings, etc. \ |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1426 |
\n\n - HexView shows EEPROM's contents.") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1427 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1428 |
sizer.Add(line) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1429 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1430 |
self.SetSizer(sizer) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1431 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1432 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1433 |
# ------------------------------------------------------------------------------- |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1434 |
# For Smart View Panel |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1435 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1436 |
class SlaveSiiSmartView(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1437 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1438 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1439 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1440 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1441 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1442 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1443 |
wx.Panel.__init__(self, parent, -1) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1444 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1445 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1446 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1447 |
# PDI Type 1, 13 unknown Type, Fix Future |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1448 |
self.PDIType = {0 :['none', '00000000'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1449 |
1 :['unknown', '00000000'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1450 |
4 :['Digital I/O', '00000100'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1451 |
5 :['SPI Slave', '00000101'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1452 |
7 :['EtherCAT Bridge (port3)', '00000111'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1453 |
8 :['uC async. 16bit', '00001000'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1454 |
9 :['uC async. 8bit', '00001001'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1455 |
10 :['uC sync. 16bit', '00001010'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1456 |
11 :['uC sync. 8bit', '00001011'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1457 |
13 :['unknown', '00000000'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1458 |
16 :['32 Digtal Input and 0 Digital Output', '00010000'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1459 |
17 :['24 Digtal Input and 8 Digital Output', '00010001'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1460 |
18 :['16 Digtal Input and 16 Digital Output','00010010'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1461 |
19 :['8 Digtal Input and 24 Digital Output', '00010011'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1462 |
20 :['0 Digtal Input and 32 Digital Output', '00010100'], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1463 |
128:['On-chip bus', '11111111'] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1464 |
} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1465 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1466 |
sizer = wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1467 |
button_sizer = wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1468 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1469 |
for button, mapping_method in [("Write EEPROM", self.WriteToEEPROM), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1470 |
("Read EEPROM", self.ReadFromEEPROM)]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1471 |
btn = wx.Button(self, -1, button, size=(150, 40)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1472 |
button_sizer.Add(btn, border=10, flag=wx.ALL) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1473 |
btn.Bind(wx.EVT_BUTTON, mapping_method) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1474 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1475 |
self.TreeListCtrl = SmartViewTreeListCtrl(self, self.Controler) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1476 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1477 |
sizer.Add(button_sizer, border=10, flag=wx.ALL) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1478 |
sizer.Add(self.TreeListCtrl, border=10, flag=wx.ALL) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1479 |
self.SetSizer(sizer) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1480 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1481 |
self.Create_SmartView() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1482 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1483 |
def Create_SmartView(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1484 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1485 |
SmartView shows information based on XML as initial value. |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1486 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1487 |
self.Controler.CommonMethod.SmartViewInfosFromXML = self.Controler.CommonMethod.GetSmartViewInfos() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1488 |
self.SetXMLData() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1489 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1490 |
def WriteToEEPROM(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1491 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1492 |
Open binary file (user select) and write the selected binary data to EEPROM |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1493 |
@param event : wx.EVT_BUTTON object |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1494 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1495 |
# Check whether beremiz connected or not, and whether status is "Started" or not. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1496 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(False) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1497 |
if check_connect_flag: |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
1498 |
status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
2416
1ca207782dde
Use predefined constants for PlcStatus instead of string literals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2407
diff
changeset
|
1499 |
if status is not PlcStatus.Started: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1500 |
dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", _("bin files (*.bin)|*.bin"), wx.OPEN) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1501 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1502 |
if dialog.ShowModal() == wx.ID_OK: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1503 |
filepath = dialog.GetPath() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1504 |
try: |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1505 |
binfile = open(filepath, "rb") |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1506 |
self.SiiBinary = binfile.read() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1507 |
dialog.Destroy() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1508 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1509 |
self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1510 |
# refresh data structure kept by master |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1511 |
self.Controler.CommonMethod.Rescan() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1512 |
# save binary data as inner global data of beremiz |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1513 |
# for fast loading when slave plugin node is reopened. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1514 |
self.Controler.CommonMethod.SiiData = self.SiiBinary |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1515 |
self.SetEEPROMData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1516 |
except Exception: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
1517 |
self.Controler.CommonMethod.CreateErrorDialog(_('The file does not exist!')) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1518 |
dialog.Destroy() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1519 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1520 |
def ReadFromEEPROM(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1521 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1522 |
Refresh displayed data based on slave EEPROM and save binary file through dialog |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1523 |
@param event : wx.EVT_BUTTON object |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1524 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1525 |
# Check whether beremiz connected or not. |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1526 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1527 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1528 |
if check_connect_flag: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1529 |
self.SiiBinary = self.Controler.CommonMethod.LoadData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1530 |
self.SetEEPROMData() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1531 |
dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1532 |
"slave0.bin", _("bin files (*.bin)|*.bin|All files|*.*"), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
1533 |
wx.SAVE | wx.OVERWRITE_PROMPT) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1534 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1535 |
if dialog.ShowModal() == wx.ID_OK: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1536 |
filepath = dialog.GetPath() |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1537 |
binfile = open(filepath, "wb") |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1538 |
binfile.write(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1539 |
binfile.close() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1540 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1541 |
dialog.Destroy() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1542 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1543 |
def SetXMLData(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1544 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1545 |
Set data based on XML initially |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1546 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1547 |
# Config Data: EEPROM Size, PDI Type, Device Emulation |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1548 |
# Find PDI Type in pdiType dictionary |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1549 |
cnt_pdi_type = self.Controler.CommonMethod.SmartViewInfosFromXML["pdi_type"] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1550 |
for i in self.PDIType.keys(): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1551 |
if cnt_pdi_type == i: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1552 |
cnt_pdi_type = self.PDIType[i][0] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1553 |
break |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1554 |
# Set Config Data |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1555 |
for treelist, data in [("EEPROM Size (Bytes)", |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1556 |
str(self.Controler.CommonMethod.SmartViewInfosFromXML["eeprom_size"])), |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1557 |
("PDI Type", |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1558 |
cnt_pdi_type), |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1559 |
("Device Emulation", |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1560 |
self.Controler.CommonMethod.SmartViewInfosFromXML["device_emulation"])]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1561 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.ConfigData[treelist], data, 1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1562 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1563 |
# Device Identity: Vendor ID, Product Code, Revision No., Serial No. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1564 |
# Set Device Identity |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1565 |
for treelist, data in [("Vendor ID", self.Controler.CommonMethod.SmartViewInfosFromXML["vendor_id"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1566 |
("Product Code", self.Controler.CommonMethod.SmartViewInfosFromXML["product_code"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1567 |
("Revision No.", self.Controler.CommonMethod.SmartViewInfosFromXML["revision_no"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1568 |
("Serial No.", self.Controler.CommonMethod.SmartViewInfosFromXML["serial_no"])]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1569 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.DeviceIdentity[treelist], data, 1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1570 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1571 |
# Mailbox: Supported Mailbox, Bootstrap Configuration, Standard Configuration |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1572 |
# Set Mailbox |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1573 |
for treelist, data in [("Supported Mailbox", self.Controler.CommonMethod.SmartViewInfosFromXML["supported_mailbox"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1574 |
("Bootstrap Configuration", ""), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1575 |
("Standard Configuration", "")]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1576 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.Mailbox[treelist], data, 1) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1577 |
# Set Bootstrap Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1578 |
for treelist, data in [("Receive Offset", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_bootstrapconf_outstart"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1579 |
("Receive Size", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_bootstrapconf_outlength"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1580 |
("Send Offset", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_bootstrapconf_instart"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1581 |
("Send Size", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_bootstrapconf_inlength"])]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1582 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.BootstrapConfig[treelist], data, 1) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1583 |
# Set Standard Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1584 |
for treelist, data in [("Receive Offset", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_standardconf_outstart"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1585 |
("Receive Size", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_standardconf_outlength"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1586 |
("Send Offset", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_standardconf_instart"]), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1587 |
("Send Size", self.Controler.CommonMethod.SmartViewInfosFromXML["mailbox_standardconf_inlength"])]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1588 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.StandardConfig[treelist], data, 1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1589 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1590 |
def SetEEPROMData(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1591 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1592 |
Set data based on slave EEPROM. |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1593 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1594 |
# sii_dict = { Parameter : (WordAddress, WordSize) } |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
1595 |
sii_dict = { |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1596 |
'PDIControl': ('0', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1597 |
'PDIConfiguration': ('1', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1598 |
'PulseLengthOfSYNCSignals': ('2', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1599 |
'ExtendedPDIConfiguration': ('3', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1600 |
'ConfiguredStationAlias': ('4', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1601 |
'Checksum': ('7', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1602 |
'VendorID': ('8', 2), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1603 |
'ProductCode': ('a', 2), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1604 |
'RevisionNumber': ('c', 2), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1605 |
'SerialNumber': ('e', 2), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1606 |
'Execution Delay': ('10', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1607 |
'Port0Delay': ('11', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1608 |
'Port1Delay': ('12', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1609 |
'BootstrapReceiveMailboxOffset': ('14', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1610 |
'BootstrapReceiveMailboxSize': ('15', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1611 |
'BootstrapSendMailboxOffset': ('16', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1612 |
'BootstrapSendMailboxSize': ('17', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1613 |
'StandardReceiveMailboxOffset': ('18', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1614 |
'StandardReceiveMailboxSize': ('19', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1615 |
'StandardSendMailboxOffset': ('1a', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1616 |
'StandardSendMailboxSize': ('1b', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1617 |
'MailboxProtocol': ('1c', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1618 |
'Size': ('3e', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1619 |
'Version': ('3f', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1620 |
'First Category Type/Vendor Specific': ('40', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1621 |
'Following Category Word Size': ('41', 1), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1622 |
'Category Data': ('42', 1), |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
1623 |
} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1624 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1625 |
# Config Data: EEPROM Size, PDI Type, Device Emulation |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1626 |
# EEPROM's data in address '0x003f' is Size of EEPROM in KBit-1 |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2423
diff
changeset
|
1627 |
eeprom_size = str((int(self.GetWordAddressData(sii_dict.get('Size'), 10))+1)//8*1024) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1628 |
# Find PDI Type in pdiType dictionary |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1629 |
cnt_pdi_type = int(self.GetWordAddressData(sii_dict.get('PDIControl'), 16).split('x')[1][2:4], 16) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1630 |
for i in self.PDIType.keys(): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1631 |
if cnt_pdi_type == i: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1632 |
cnt_pdi_type = self.PDIType[i][0] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1633 |
break |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1634 |
# Get Device Emulation |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1635 |
device_emulation = str(bool(int("{:0>16b}".format(int(self.GetWordAddressData(sii_dict.get('PDIControl'), 16), 16))[7]))) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1636 |
# Set Config Data |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1637 |
for treelist, data in [("EEPROM Size (Bytes)", eeprom_size), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1638 |
("PDI Type", cnt_pdi_type), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1639 |
("Device Emulation", device_emulation)]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1640 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.ConfigData[treelist], data, 1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1641 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1642 |
# Device Identity: Vendor ID, Product Code, Revision No., Serial No. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1643 |
# Set Device Identity |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1644 |
for treelist, data in [ |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1645 |
("Vendor ID", self.GetWordAddressData(sii_dict.get('VendorID'), 16)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1646 |
("Product Code", self.GetWordAddressData(sii_dict.get('ProductCode'), 16)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1647 |
("Revision No.", self.GetWordAddressData(sii_dict.get('RevisionNumber'), 16)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1648 |
("Serial No.", self.GetWordAddressData(sii_dict.get('SerialNumber'), 16))]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1649 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.DeviceIdentity[treelist], data, 1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1650 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1651 |
# Mailbox |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1652 |
# EEORPOM's word address '1c' indicates supported mailbox protocol. |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1653 |
# each value of mailbox protocol : |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1654 |
# VoE(0x0020), SoE(0x0010), FoE(0x0008), CoE(0x0004), EoE(0x0002), AoE(0x0001) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1655 |
supported_mailbox = "" |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
1656 |
mailbox_protocol = ["VoE, ", "SoE, ", "FoE, ", "CoE, ", "EoE, ", "AoE, "] |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1657 |
mailbox_data = "{:0>8b}".format(int(self.GetWordAddressData(sii_dict.get('MailboxProtocol'), 16), 16)) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1658 |
for protocol in range(6): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1659 |
if mailbox_data[protocol+2] == '1': |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1660 |
supported_mailbox += mailbox_protocol[protocol] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1661 |
supported_mailbox = supported_mailbox.strip(", ") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1662 |
# Set Mailbox |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1663 |
for treelist, data in [("Supported Mailbox", supported_mailbox), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1664 |
("Bootstrap Configuration", ""), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1665 |
("Standard Configuration", "")]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1666 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.Mailbox[treelist], data, 1) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1667 |
# Set Bootstrap Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1668 |
for treelist, data in [ |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1669 |
("Receive Offset", self.GetWordAddressData(sii_dict.get('BootstrapReceiveMailboxOffset'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1670 |
("Receive Size", self.GetWordAddressData(sii_dict.get('BootstrapReceiveMailboxSize'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1671 |
("Send Offset", self.GetWordAddressData(sii_dict.get('BootstrapSendMailboxOffset'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1672 |
("Send Size", self.GetWordAddressData(sii_dict.get('BootstrapSendMailboxSize'), 10))]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1673 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.BootstrapConfig[treelist], data, 1) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1674 |
# Set Standard Configuration: Receive Offset, Receive Size, Send Offset, Send Size |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1675 |
for treelist, data in [ |
2369
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1676 |
("Receive Offset", self.GetWordAddressData(sii_dict.get('StandardReceiveMailboxOffset'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1677 |
("Receive Size", self.GetWordAddressData(sii_dict.get('StandardReceiveMailboxSize'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1678 |
("Send Offset", self.GetWordAddressData(sii_dict.get('StandardSendMailboxOffset'), 10)), |
24db1e592e20
cleanup etherlab: pep8, E201 whitespace after '('
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2368
diff
changeset
|
1679 |
("Send Size", self.GetWordAddressData(sii_dict.get('StandardSendMailboxSize'), 10))]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1680 |
self.TreeListCtrl.Tree.SetItemText(self.TreeListCtrl.StandardConfig[treelist], data, 1) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1681 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1682 |
def MakeStaticBoxSizer(self, boxlabel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1683 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1684 |
Make StaticBoxSizer |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1685 |
@param boxlabel : label of box sizer |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1686 |
@return sizer : the StaticBoxSizer labeled 'boxlabel' |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1687 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1688 |
box = wx.StaticBox(self, -1, boxlabel) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1689 |
sizer = wx.StaticBoxSizer(box, wx.VERTICAL) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1690 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1691 |
return sizer |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1692 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1693 |
def GetWordAddressData(self, dict_tuple, format): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1694 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1695 |
This method converts word address data from EEPROM binary. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1696 |
@param dict_tuple : element of 'sii_dict' dictionary in SetEEPROMData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1697 |
@param format : format of data. It can be 16(hex), 10(decimal) and 2(binary). |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1698 |
@return formatted value |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1699 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1700 |
offset = int(str(dict_tuple[0]), 16) * 2 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1701 |
length = int(str(dict_tuple[1]), 16) * 2 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1702 |
list = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1703 |
data = '' |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1704 |
for index in range(length): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1705 |
hexdata = hex(ord(self.SiiBinary[offset + index]))[2:] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1706 |
list.append(hexdata.zfill(2)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1707 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1708 |
list.reverse() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1709 |
data = list[0:length] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1710 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1711 |
if format == 16: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1712 |
return '0x' + ''.join(data) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1713 |
elif format == 10: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1714 |
return str(int(str(''.join(data)), 16)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1715 |
elif format == 2: |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1716 |
''.join(data) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1717 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1718 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1719 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1720 |
# For Smart View TreeListCtrl |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1721 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1722 |
class SmartViewTreeListCtrl(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1723 |
def __init__(self, parent, Controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1724 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1725 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1726 |
@param parent: Reference to the parent SlaveSiiSmartView class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1727 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1728 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1729 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1730 |
wx.Panel.__init__(self, parent, -1, size=(350, 500)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1731 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1732 |
self.Tree = wx.gizmos.TreeListCtrl(self, -1, size=(350, 500), |
2386
d00f1430d57a
clean etherlab: pep8, W503 line break before binary operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2385
diff
changeset
|
1733 |
style=(wx.TR_DEFAULT_STYLE | |
d00f1430d57a
clean etherlab: pep8, W503 line break before binary operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2385
diff
changeset
|
1734 |
wx.TR_FULL_ROW_HIGHLIGHT | |
d00f1430d57a
clean etherlab: pep8, W503 line break before binary operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2385
diff
changeset
|
1735 |
wx.TR_HIDE_ROOT | |
d00f1430d57a
clean etherlab: pep8, W503 line break before binary operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2385
diff
changeset
|
1736 |
wx.TR_COLUMN_LINES | |
d00f1430d57a
clean etherlab: pep8, W503 line break before binary operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2385
diff
changeset
|
1737 |
wx.TR_ROW_LINES)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1738 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1739 |
self.Tree.AddColumn("Description", width=200) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1740 |
self.Tree.AddColumn("Value", width=140) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1741 |
self.Tree.SetMainColumn(0) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1742 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1743 |
self.Root = self.Tree.AddRoot("") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1744 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1745 |
# Add item |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1746 |
# Level 1 nodes |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1747 |
self.Level1Nodes = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1748 |
for lv1 in ["Config Data", "Device Identity", "Mailbox"]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1749 |
self.Level1Nodes[lv1] = self.Tree.AppendItem(self.Root, lv1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1750 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1751 |
# Level 2 nodes |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1752 |
# Config Data |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1753 |
self.ConfigData = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1754 |
for lv2 in ["EEPROM Size (Bytes)", "PDI Type", "Device Emulation"]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1755 |
self.ConfigData[lv2] = self.Tree.AppendItem(self.Level1Nodes["Config Data"], lv2) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1756 |
# Device Identity |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1757 |
self.DeviceIdentity = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1758 |
for lv2 in ["Vendor ID", "Product Code", "Revision No.", "Serial No."]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1759 |
self.DeviceIdentity[lv2] = self.Tree.AppendItem(self.Level1Nodes["Device Identity"], lv2) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1760 |
# Mailbox |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1761 |
self.Mailbox = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1762 |
for lv2 in ["Supported Mailbox", "Bootstrap Configuration", "Standard Configuration"]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1763 |
self.Mailbox[lv2] = self.Tree.AppendItem(self.Level1Nodes["Mailbox"], lv2) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1764 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1765 |
# Level 3 nodes |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1766 |
# Children of Bootstrap Configuration |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1767 |
self.BootstrapConfig = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1768 |
for lv3 in ["Receive Offset", "Receive Size", "Send Offset", "Send Size"]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1769 |
self.BootstrapConfig[lv3] = self.Tree.AppendItem(self.Mailbox["Bootstrap Configuration"], lv3) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1770 |
# Children of Standard Configuration |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1771 |
self.StandardConfig = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1772 |
for lv3 in ["Receive Offset", "Receive Size", "Send Offset", "Send Size"]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1773 |
self.StandardConfig[lv3] = self.Tree.AppendItem(self.Mailbox["Standard Configuration"], lv3) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1774 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1775 |
# Expand Tree |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1776 |
for tree in [self.Root, |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1777 |
self.Level1Nodes["Config Data"], |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1778 |
self.Level1Nodes["Device Identity"], |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1779 |
self.Level1Nodes["Mailbox"], |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1780 |
self.Mailbox["Bootstrap Configuration"], |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1781 |
self.Mailbox["Standard Configuration"]]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1782 |
self.Tree.Expand(tree) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1783 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1784 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1785 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1786 |
# For Hex View Panel |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1787 |
# shows EEPROM binary as hex data and characters. |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1788 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1789 |
class HexView(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1790 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1791 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1792 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1793 |
@param parent: Reference to the parent EtherCATManagementTreebook class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1794 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1795 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1796 |
wx.Panel.__init__(self, parent, -1) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1797 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1798 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1799 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1800 |
self.HexRow = 8 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1801 |
self.HexCol = 17 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1802 |
|
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1803 |
self.HexViewSizer = {"view": wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=10), |
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
1804 |
"siiButton": wx.BoxSizer()} |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1805 |
self.HexViewButton = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1806 |
|
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1807 |
for key, evt_handler in [ |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1808 |
("Sii Upload", self.OnButtonSiiUpload), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1809 |
("Sii Download", self.OnButtonSiiDownload), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1810 |
("Write to File", self.OnButtonWriteToBinFile), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1811 |
("Read from File", self.OnButtonReadFromBinFile), |
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
1812 |
("XML to EEPROM Image", self.OnButtonXmlToEEPROMImg)]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1813 |
self.HexViewButton[key] = wx.Button(self, -1, key) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1814 |
self.HexViewButton[key].Bind(wx.EVT_BUTTON, evt_handler) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1815 |
self.HexViewSizer["siiButton"].Add(self.HexViewButton[key]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1816 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1817 |
self.SiiBinary = self.Controler.CommonMethod.XmlToEeprom() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1818 |
self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1819 |
self.SiiGrid = SiiGridTable(self, self.Controler, self.HexRow, self.HexCol) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1820 |
self.HexViewSizer["view"].AddMany([self.HexViewSizer["siiButton"], self.SiiGrid]) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1821 |
self.SiiGrid.CreateGrid(self.HexRow, self.HexCol) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1822 |
self.SetSizer(self.HexViewSizer["view"]) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1823 |
self.HexViewSizer["view"].FitInside(self.parent.parent) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1824 |
self.parent.parent.FitInside() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1825 |
self.SiiGrid.SetValue(self.HexCode) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1826 |
self.SiiGrid.Update() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1827 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1828 |
def UpdateSiiGridTable(self, row, col): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1829 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1830 |
Destroy existing grid and recreate |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1831 |
@param row, col : Hex View grid size |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1832 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1833 |
self.HexViewSizer["view"].Detach(self.SiiGrid) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1834 |
self.SiiGrid.Destroy() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1835 |
self.SiiGrid = SiiGridTable(self, self.Controler, row, col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1836 |
self.HexViewSizer["view"].Add(self.SiiGrid) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1837 |
self.SiiGrid.CreateGrid(row, col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1838 |
self.SetSizer(self.HexViewSizer["view"]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1839 |
self.HexViewSizer["view"].FitInside(self.parent.parent) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1840 |
self.parent.parent.FitInside() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1841 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1842 |
def OnButtonSiiUpload(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1843 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1844 |
Load EEPROM data from slave and refresh Hex View grid |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1845 |
Binded to 'Sii Upload' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1846 |
@param event : wx.EVT_BUTTON object |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1847 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1848 |
# Check whether beremiz connected or not. |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1849 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1850 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1851 |
if check_connect_flag: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1852 |
# load from EEPROM data and parsing |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1853 |
self.SiiBinary = self.Controler.CommonMethod.LoadData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1854 |
self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1855 |
self.UpdateSiiGridTable(self.HexRow, self.HexCol) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1856 |
self.SiiGrid.SetValue(self.HexCode) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1857 |
self.SiiGrid.Update() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1858 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1859 |
def OnButtonSiiDownload(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1860 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1861 |
Write current EEPROM data to slave and refresh data structure kept by master |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1862 |
Binded to 'Sii Download' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1863 |
@param event : wx.EVT_BUTTON object |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1864 |
""" |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1865 |
# Check whether beremiz connected or not, |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1866 |
# and whether status is "Started" or not. |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1867 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
1868 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1869 |
if check_connect_flag: |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
1870 |
status, _log_count = self.Controler.GetCTRoot()._connector.GetPLCstatus() |
2416
1ca207782dde
Use predefined constants for PlcStatus instead of string literals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2407
diff
changeset
|
1871 |
if status is not PlcStatus.Started: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1872 |
self.Controler.CommonMethod.SiiWrite(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1873 |
self.Controler.CommonMethod.Rescan() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1874 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1875 |
def OnButtonWriteToBinFile(self, event): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1876 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1877 |
Save current EEPROM data to binary file through FileDialog |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1878 |
Binded to 'Write to File' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1879 |
@param event : wx.EVT_BUTTON object |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1880 |
""" |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1881 |
dialog = wx.FileDialog(self, _("Save as..."), os.getcwd(), "slave0.bin", |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
1882 |
_("bin files (*.bin)|*.bin|All files|*.*"), wx.SAVE | wx.OVERWRITE_PROMPT) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1883 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1884 |
if dialog.ShowModal() == wx.ID_OK: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1885 |
filepath = dialog.GetPath() |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1886 |
binfile = open(filepath, "wb") |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1887 |
binfile.write(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1888 |
binfile.close() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1889 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1890 |
dialog.Destroy() |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1891 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1892 |
def OnButtonReadFromBinFile(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1893 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1894 |
Load binary file through FileDialog |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1895 |
Binded to 'Read from File' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1896 |
@param event : wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1897 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1898 |
dialog = wx.FileDialog(self, _("Choose a binary file"), os.getcwd(), "", |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1899 |
_("bin files (*.bin)|*.bin"), wx.OPEN) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1900 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1901 |
if dialog.ShowModal() == wx.ID_OK: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1902 |
filepath = dialog.GetPath() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1903 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1904 |
try: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1905 |
binfile = open(filepath, "rb") |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1906 |
self.SiiBinary = binfile.read() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1907 |
self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1908 |
self.UpdateSiiGridTable(self.HexRow, self.HexCol) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1909 |
self.SiiGrid.SetValue(self.HexCode) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1910 |
self.SiiGrid.Update() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1911 |
except Exception: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
1912 |
self.Controler.CommonMethod.CreateErrorDialog(_('The file does not exist!')) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1913 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1914 |
dialog.Destroy() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1915 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1916 |
def OnButtonXmlToEEPROMImg(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1917 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1918 |
Create EEPROM data based XML data that current imported |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1919 |
Binded to 'XML to EEPROM' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1920 |
@param event : wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1921 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1922 |
self.SiiBinary = self.Controler.CommonMethod.XmlToEeprom() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1923 |
self.HexCode, self.HexRow, self.HexCol = self.Controler.CommonMethod.HexRead(self.SiiBinary) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1924 |
self.UpdateSiiGridTable(self.HexRow, self.HexCol) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1925 |
self.SiiGrid.SetValue(self.HexCode) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1926 |
self.SiiGrid.Update() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1927 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1928 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1929 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1930 |
# For Hex View grid (fill hex data) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1931 |
# ------------------------------------------------------------------------------- |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1932 |
class SiiGridTable(wx.grid.Grid): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1933 |
def __init__(self, parent, controler, row, col): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1934 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1935 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1936 |
@param parent: Reference to the parent HexView class |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1937 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1938 |
@param row, col: Hex View grid size |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1939 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1940 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1941 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1942 |
self.Row = row |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1943 |
self.Col = col |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1944 |
|
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
1945 |
wx.grid.Grid.__init__(self, parent, -1, size=(830, 450), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
1946 |
style=wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1947 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1948 |
def SetValue(self, value): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1949 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1950 |
Set data in the table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1951 |
@param value: EEPROM data list of which element is 1 Byte hex data |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1952 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1953 |
# set label name and size |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1954 |
self.SetRowLabelSize(100) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1955 |
for col in range(self.Col): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1956 |
if col == 16: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1957 |
self.SetColLabelValue(16, "Text View") |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2423
diff
changeset
|
1958 |
self.SetColSize(16, (self.GetSize().x-120)*4//20) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1959 |
else: |
2358
8e5a9830867e
cleanup etherlab: pep8, E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2356
diff
changeset
|
1960 |
self.SetColLabelValue(col, '%s' % col) |
2437
105c20fdeb19
python3 support: pylint, W1619 #(old-division) division w/o __future__ statement
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2423
diff
changeset
|
1961 |
self.SetColSize(col, (self.GetSize().x-120)//20) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1962 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1963 |
# set data into table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1964 |
row = col = 0 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1965 |
for row_idx in value: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1966 |
col = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1967 |
self.SetRowLabelValue(row, "0x"+"{:0>4x}".format(row*(self.Col-1))) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1968 |
for hex in row_idx: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1969 |
self.SetCellValue(row, col, hex) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1970 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1971 |
if col == 16: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1972 |
self.SetCellAlignment(row, col, wx.ALIGN_LEFT, wx.ALIGN_CENTER) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1973 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1974 |
self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1975 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1976 |
self.SetReadOnly(row, col, True) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1977 |
col = col + 1 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1978 |
row = row + 1 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1979 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1980 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1981 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1982 |
# For Register Access Panel |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
1983 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1984 |
class RegisterAccessPanel(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1985 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1986 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
1987 |
Constructor |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
1988 |
@param parent: EEPROMAccessPanel object |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
1989 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
1990 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1991 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1992 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1993 |
self.__init_data() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1994 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1995 |
wx.Panel.__init__(self, parent, -1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1996 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1997 |
sizer = wx.FlexGridSizer(cols=1, hgap=20, rows=2, vgap=5) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
1998 |
button_sizer = wx.FlexGridSizer(cols=2, hgap=10, rows=1, vgap=10) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
1999 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2000 |
self.ReloadButton = wx.Button(self, -1, "Reload") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2001 |
self.CompactViewCheckbox = wx.CheckBox(self, -1, "Compact View") |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2002 |
self.RegisterNotebook = RegisterNotebook(self, self.Controler) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2003 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2004 |
button_sizer.AddMany([self.ReloadButton, self.CompactViewCheckbox]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2005 |
sizer.AddMany([button_sizer, self.RegisterNotebook]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2006 |
self.SetSizer(sizer) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2007 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2008 |
self.ReloadButton.Bind(wx.EVT_BUTTON, self.OnReloadButton) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2009 |
self.CompactViewCheckbox.Bind(wx.EVT_CHECKBOX, self.ToggleCompactViewCheckbox) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2010 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2011 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2012 |
self.RegisterNotebook.RegPage[index].MainTable.CreateGrid(self.MainRow[index], self.MainCol) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2013 |
self.RegisterNotebook.RegPage[index].MainTable.SetValue(self, 0, index*512, (index+1)*512) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2014 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2015 |
# data default setting |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2016 |
if self.Controler.CommonMethod.RegData == "": |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2017 |
self.CompactViewCheckbox.Disable() |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2018 |
for index in range(4): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2019 |
self.RegisterNotebook.RegPage[index].MainTable.SetValue(self, 0, index*512, (index+1)*512) |
2361
5d6ce74f7835
cleanup etherlab: pep8, E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
2020 |
else: # If data was saved, |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2021 |
self.BasicSetData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2022 |
self.ParseData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2023 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2024 |
self.RegisterNotebook.RegPage[index].MainTable.SetValue(self, self.RegMonitorData, index*512, (index+1)*512) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2025 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2026 |
def __init_data(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2027 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2028 |
Declare initial data. |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2029 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2030 |
# flag for compact view |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2031 |
self.CompactFlag = False |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2032 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2033 |
# main grid rows and cols |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2034 |
self.MainRow = [512, 512, 512, 512] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2035 |
self.MainCol = 4 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2036 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2037 |
# main grids' data range |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2038 |
self.PageRange = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2039 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2040 |
self.PageRange.append([512*index, 512*(index+1)]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2041 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2042 |
# Previous value of register data for register description configuration |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2043 |
self.PreRegSpec = {"ESCType": "", |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2044 |
"FMMUNumber": "", |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2045 |
"SMNumber": "", |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2046 |
"PDIType": ""} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2047 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2048 |
def LoadData(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2049 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2050 |
Get data from the register. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2051 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2052 |
self.Controler.CommonMethod.RegData = "" |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2053 |
# ethercat reg_read |
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2054 |
# ex : ethercat reg_read -p 0 0x0000 0x0001 |
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2055 |
# return value : 0x11 |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2056 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2057 |
self.Controler.CommonMethod.RegData = self.Controler.CommonMethod.RegData + " " + self.Controler.CommonMethod.RegRead("0x"+"{:0>4x}".format(index*1024), "0x0400") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2058 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2059 |
# store previous value |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2060 |
# (ESC type, port number of FMMU, port number of SM, and PDI type)) |
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
2061 |
for reg_spec in ["ESCType", "FMMUNumber", "SMNumber", "PDIType"]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2062 |
self.PreRegSpec[reg_spec] = self.Controler.CommonMethod.CrtRegSpec[reg_spec] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2063 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2064 |
# update registers' description |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2065 |
# (ESC type, port number of FMMU, port number of SM, and PDI type) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2066 |
for reg_spec, address in [("ESCType", "0x0000"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2067 |
("FMMUNumber", "0x0004"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2068 |
("SMNumber", "0x0005"), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2069 |
("PDIType", "0x0140")]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2070 |
self.Controler.CommonMethod.CrtRegSpec[reg_spec] = self.Controler.CommonMethod.RegRead(address, "0x0001") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2071 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2072 |
# Enable compactView checkbox |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2073 |
self.CompactViewCheckbox.Enable() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2074 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2075 |
def BasicSetData(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2076 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2077 |
Get and save the description of registers. |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2078 |
It's done by parsing register_information.xml. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2079 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2080 |
# parse the above register's value |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2081 |
# If the value is 0x12, the result is 12 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2082 |
self.ESCType = self.Controler.CommonMethod.CrtRegSpec["ESCType"].split('x')[1] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2083 |
self.PDIType = self.Controler.CommonMethod.CrtRegSpec["PDIType"].split('x')[1] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2084 |
# If the value is 0x12, the result is 18 (It's converted to decimal value) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2085 |
self.FMMUNumber = int(self.Controler.CommonMethod.CrtRegSpec["FMMUNumber"], 16) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2086 |
self.SMNumber = int(self.Controler.CommonMethod.CrtRegSpec["SMNumber"], 16) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2087 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2088 |
# initialize description dictionary of register main table and register sub table. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2089 |
self.RegisterDescriptionDict = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2090 |
self.RegisterSubGridDict = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2091 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2092 |
# ./EthercatMaster/register_information.xml contains register description. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2093 |
if wx.Platform == '__WXMSW__': |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2094 |
reg_info_file = open("../../EthercatMaster/register_information.xml", 'r') |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2095 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2096 |
reg_info_file = open("./EthercatMaster/register_information.xml", 'r') |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2097 |
reg_info_tree = minidom.parse(reg_info_file) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2098 |
reg_info_file.close() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2099 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2100 |
# parse register description |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2101 |
for register_info in reg_info_tree.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2102 |
for register in register_info.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2103 |
if register.nodeType == reg_info_tree.ELEMENT_NODE and register.nodeName == "Register": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2104 |
# If it depends on the property(ESC type, PDI type, FMMU number, SM number) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2105 |
for property, type, value in [("esc", "type", self.ESCType), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2106 |
("pdi", "type", self.PDIType), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2107 |
("fmmu", "number", self.FMMUNumber), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2108 |
("sm", "number", self.SMNumber)]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2109 |
if property in register.attributes.keys(): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2110 |
if type == "type": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2111 |
if register.attributes[property].value == value: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2112 |
self.GetRegisterInfo(reg_info_tree, register) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2113 |
break |
2361
5d6ce74f7835
cleanup etherlab: pep8, E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
2114 |
else: # type == "number" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2115 |
if register.attributes[property].value < value: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2116 |
self.GetRegisterInfo(reg_info_tree, register) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2117 |
break |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2118 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2119 |
self.GetRegisterInfo(reg_info_tree, register) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2120 |
break |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2121 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2122 |
def GetRegisterInfo(self, reg_info_tree, register): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2123 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2124 |
Save the register's description into the dictionary. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2125 |
reg_info_tree is based on the register_information.xml. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2126 |
@param reg_info_tree: XML tree |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2127 |
@param register: register which you want to get the description |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2128 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2129 |
# temporary variables for register main table idescription dictionary |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2130 |
reg_index = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2131 |
reg_main_description = "" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2132 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2133 |
for data in register.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2134 |
if data.nodeType == reg_info_tree.ELEMENT_NODE and data.nodeName == "Index": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2135 |
for index in data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2136 |
reg_index = index.nodeValue |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2137 |
if data.nodeType == reg_info_tree.ELEMENT_NODE and data.nodeName == "Description": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2138 |
for description in data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2139 |
reg_main_description = description.nodeValue |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2140 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2141 |
# Add description for register main table |
2417
316ee9fff395
cleanup: pylint, R0123 # (literal-comparison) Comparison to literal
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2416
diff
changeset
|
2142 |
if reg_index != "" and reg_main_description != "": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2143 |
self.RegisterDescriptionDict[reg_index] = reg_main_description |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2144 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2145 |
if data.nodeType == reg_info_tree.ELEMENT_NODE and data.nodeName == "Details": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2146 |
# declare register sub table description dictionary about this index |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2147 |
self.RegisterSubGridDict[reg_index] = [] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2148 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2149 |
for detail in data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2150 |
if detail.nodeType == reg_info_tree.ELEMENT_NODE and detail.nodeName == "Detail": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2151 |
# If it depends on the property(ESC type, PDI type, FMMU number, SM number) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2152 |
for property, type, value in [("esc", "type", self.ESCType), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2153 |
("pdi", "type", self.PDIType), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2154 |
("fmmu", "number", self.FMMUNumber), |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2155 |
("sm", "number", self.SMNumber)]: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2156 |
if property in detail.attributes.keys(): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2157 |
if type == "type": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2158 |
if detail.attributes[property].value == value: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2159 |
self.GetRegisterDetailInfo(reg_info_tree, reg_index, detail) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2160 |
break |
2361
5d6ce74f7835
cleanup etherlab: pep8, E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
2161 |
else: # type == "number" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2162 |
if detail.attributes[property].value < value: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2163 |
self.GetRegisterDetailInfo(reg_info_tree, reg_index, detail) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2164 |
break |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2165 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2166 |
self.GetRegisterDetailInfo(reg_info_tree, reg_index, detail) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2167 |
break |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2168 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2169 |
def GetRegisterDetailInfo(self, reg_info_tree, reg_index, detail): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2170 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2171 |
Get the resgister's detailed description(for sub table) from the reg_info_tree. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2172 |
@param reg_info_tree: XML tree (register_information.xml) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2173 |
@param reg_index: index of the register |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2174 |
@param detail: description of the register |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2175 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2176 |
# temporary variables for register sub table description dictionary |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2177 |
# - It is initialized in every sub description |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2178 |
reg_bit_range = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2179 |
reg_sub_description = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2180 |
reg_enum_dictionary = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2181 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2182 |
for detail_data in detail.childNodes: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2183 |
if detail_data.nodeType == reg_info_tree.ELEMENT_NODE and detail_data.nodeName == "Range": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2184 |
for range in detail_data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2185 |
reg_bit_range = range.nodeValue |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2186 |
if detail_data.nodeType == reg_info_tree.ELEMENT_NODE and detail_data.nodeName == "Description": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2187 |
for description in detail_data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2188 |
reg_sub_description = description.nodeValue |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2189 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2190 |
if detail_data.nodeType == reg_info_tree.ELEMENT_NODE and detail_data.nodeName == "Enum": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2191 |
for enum in detail_data.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2192 |
if enum.nodeType == reg_info_tree.ELEMENT_NODE and enum.nodeName == "item": |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2193 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2194 |
# temporary variables for a description of each value |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2195 |
# For example, if the bit is 1, it is 'enabled'('On', 'True', etc.), |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2196 |
# otherwise 'disabled'('Off', 'False', etc.). |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2197 |
reg_sub_value = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2198 |
reg_sub_value_description = "" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2199 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2200 |
for item in enum.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2201 |
if item.nodeType == reg_info_tree.ELEMENT_NODE and item.nodeName == "value": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2202 |
for value in item.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2203 |
reg_sub_value = value.nodeValue |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2204 |
if item.nodeType == reg_info_tree.ELEMENT_NODE and item.nodeName == "Description": |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2205 |
for description in item.childNodes: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2206 |
reg_sub_value_description = description.nodeValue |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2207 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2208 |
# Add a description of each value to register enum dictionary |
2417
316ee9fff395
cleanup: pylint, R0123 # (literal-comparison) Comparison to literal
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2416
diff
changeset
|
2209 |
if reg_sub_value != "" and reg_sub_value_description != "": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2210 |
reg_enum_dictionary[reg_sub_value] = reg_sub_value_description |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2211 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2212 |
# add a description to register sub table description dictionary |
2417
316ee9fff395
cleanup: pylint, R0123 # (literal-comparison) Comparison to literal
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2416
diff
changeset
|
2213 |
if reg_bit_range != "" and reg_sub_description != "": |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2214 |
self.RegisterSubGridDict[reg_index].append([reg_bit_range, |
2380
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2215 |
reg_sub_description, |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2216 |
reg_enum_dictionary]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2217 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2218 |
def ParseData(self): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2219 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2220 |
Transform the data into dec, hex, string, and description |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2221 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2222 |
row_data = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2223 |
self.RegMonitorData = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2224 |
reg_word = "" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2225 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2226 |
reg_data = self.Controler.CommonMethod.RegData.split() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2227 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2228 |
# loop for register(0x0000:0x0fff) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2229 |
for address in range(0x1000): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2230 |
# arrange 2 Bytes of register data |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2231 |
reg_word = reg_data[address].split('x')[1] + reg_word |
2358
8e5a9830867e
cleanup etherlab: pep8, E228 missing whitespace around modulo operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2356
diff
changeset
|
2232 |
if (address % 2) == 1: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2233 |
# append address |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2234 |
hex_address = "{:0>4x}".format(address-1) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2235 |
row_data.append(hex_address) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2236 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2237 |
# append description |
2377
88a9d64560d3
clean etherlab: pep8, W601 .has_key() is deprecated, use 'in'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2375
diff
changeset
|
2238 |
if hex_address in self.RegisterDescriptionDict: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2239 |
row_data.append(self.RegisterDescriptionDict[hex_address]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2240 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2241 |
row_data.append("") |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2242 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2243 |
# append Decimal value |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2244 |
row_data.append(str(int(reg_word, 16))) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2245 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2246 |
# append Hex value |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2247 |
row_data.append('0x'+reg_word) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2248 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2249 |
# append ASCII value |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2250 |
char_data = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2251 |
for iter in range(2): |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
2252 |
if int(reg_word[iter*2:iter*2+2], 16) >= 32 and int(reg_word[iter*2:iter*2+2], 16) <= 126: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2253 |
char_data = char_data + chr(int(reg_word[iter*2:iter*2+2], 16)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2254 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2255 |
char_data = char_data + "." |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2256 |
row_data.append(char_data) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2257 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2258 |
self.RegMonitorData.append(row_data) |
2361
5d6ce74f7835
cleanup etherlab: pep8, E261 at least two spaces before inline comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2360
diff
changeset
|
2259 |
reg_word = "" # initialize regWord |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2260 |
row_data = [] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2261 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2262 |
def OnReloadButton(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2263 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2264 |
Handle the click event of the 'Reload' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2265 |
Get the data from registers again, and update the table. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2266 |
@param event: wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2267 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2268 |
# Check whether beremiz connected or not. |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2269 |
# If this method is called cyclically, set the cyclic flag true |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2270 |
check_connect_flag = self.Controler.CommonMethod.CheckConnect(cyclic_flag = False) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2271 |
if check_connect_flag: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2272 |
self.LoadData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2273 |
self.BasicSetData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2274 |
self.ParseData() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2275 |
# set data into UI |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2276 |
if self.CompactFlag: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2277 |
self.ToggleCompactViewCheckbox(True) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
2278 |
else: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2279 |
for index in range(4): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2280 |
self.RegisterNotebook.RegPage[index].UpdateMainTable(self.MainRow[index], self.MainCol, |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2281 |
self.PageRange[index][0], self.PageRange[index][1], |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2282 |
self.RegMonitorData) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2283 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2284 |
def ToggleCompactViewCheckbox(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2285 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2286 |
Handles the event of the 'Compact view' check box. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2287 |
If it's checked, show only the registers that have a description. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2288 |
If not, show all the registers. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2289 |
@param event: wx.EVT_CHECKBOX object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2290 |
""" |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2291 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2292 |
# If "Compact View" Checkbox is True |
2385
f2a53fa6e5d7
clean etherlab: pep8, E266 too many leading '#' for block comment
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2384
diff
changeset
|
2293 |
# 'event' is argument of this method or event of checkbox. |
2374
aed3ca79a10a
clean etherlab: pep8, E712 comparison to True should be 'if cond is True:' or 'if cond:'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2373
diff
changeset
|
2294 |
if event is True or event.GetEventObject().GetValue(): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2295 |
self.CompactFlag = True |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2296 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2297 |
reg_compact_data = [] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2298 |
page_row = [0, 0, 0, 0] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2299 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2300 |
self.PageRange[index] = [0, 0] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2301 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2302 |
for reg_row_data in self.RegMonitorData: |
2417
316ee9fff395
cleanup: pylint, R0123 # (literal-comparison) Comparison to literal
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2416
diff
changeset
|
2303 |
if reg_row_data[1] != "": |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2304 |
# data structure for "compact view" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2305 |
reg_compact_data.append(reg_row_data) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2306 |
# count for each register notebooks' row |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2307 |
# It compare with register's address. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2308 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2309 |
if int('0x'+reg_row_data[0], 16) < (index+1)*1024: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2310 |
page_row[index] += 1 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2311 |
break |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2312 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2313 |
# Setting tables' rows and cols, range for compact view |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2314 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2315 |
self.MainRow[index] = page_row[index] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2316 |
self.PageRange[index][1] = page_row[index] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2317 |
for iter in range(index): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2318 |
self.PageRange[index][0] += page_row[iter] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2319 |
self.PageRange[index][1] += page_row[iter] |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2320 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2321 |
# Update table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2322 |
for index in range(4): |
2380
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2323 |
self.RegisterNotebook.RegPage[index].UpdateMainTable( |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2324 |
self.MainRow[index], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2325 |
self.MainCol, |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2326 |
self.PageRange[index][0], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2327 |
self.PageRange[index][1], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2328 |
reg_compact_data) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2329 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2330 |
# Compact View Checkbox is False |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2331 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2332 |
self.CompactFlag = False |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2333 |
# Setting original rows, cols and range |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2334 |
self.MainRow = [512, 512, 512, 512] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2335 |
self.PageRange = [] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2336 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2337 |
for index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2338 |
self.PageRange.append([512*index, 512*(index+1)]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2339 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2340 |
# Update table |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2341 |
for index in range(4): |
2380
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2342 |
self.RegisterNotebook.RegPage[index].UpdateMainTable( |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2343 |
self.MainRow[index], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2344 |
self.MainCol, |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2345 |
self.PageRange[index][0], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2346 |
self.PageRange[index][1], |
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2347 |
self.RegMonitorData) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2348 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2349 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2350 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2351 |
# For Register Access Notebook (divide index range) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2352 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2353 |
class RegisterNotebook(wx.Notebook): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2354 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2355 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2356 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2357 |
@param parent: RegisterAccessPanel object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2358 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2359 |
""" |
2366
d635680e4c2c
cleanup etherlab: pep8, E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2365
diff
changeset
|
2360 |
wx.Notebook.__init__(self, parent, id=-1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2361 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2362 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2363 |
self.Controler = controler |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2364 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2365 |
# Initialize pages |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2366 |
self.RegPage = [] |
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
2367 |
pages = 4 |
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
2368 |
for dummy in range(pages): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2369 |
self.RegPage.append(None) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2370 |
|
2406
ffd091b51cd0
clean etherlab: pylint, W0612 # (unused-variable) Unused variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2405
diff
changeset
|
2371 |
for index in range(pages): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2372 |
self.RegPage[index] = RegisterNotebookPanel(self, self.Controler, |
2381
1c40e3976cc2
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2380
diff
changeset
|
2373 |
parent.MainRow[index], parent.MainCol) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2374 |
self.AddPage(self.RegPage[index], |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2375 |
"0x"+"{:0>4x}".format(index*1024)+" - 0x"+"{:0>4x}".format((index+1)*1024-1)) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2376 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2377 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2378 |
# ------------------------------------------------------------------------------- |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2379 |
# For Register Access Notebook Panel |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2380 |
# (Main UI : including main, sub table) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2381 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2382 |
class RegisterNotebookPanel(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2383 |
def __init__(self, parent, controler, row, col): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2384 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2385 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2386 |
@param parent: RegisterAccessPanel object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2387 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2388 |
@param row, col: size of the table |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2389 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2390 |
wx.Panel.__init__(self, parent, -1) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2391 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2392 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2393 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2394 |
self.Row = row |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2395 |
self.Col = col |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2396 |
sub_row = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2397 |
sub_col = 4 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2398 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2399 |
self.Sizer = wx.FlexGridSizer(cols=1, hgap=10, rows=2, vgap=30) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2400 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2401 |
self.MainTable = RegisterMainTable(self, self.Row, self.Col, self.Controler) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2402 |
self.SubTable = RegisterSubTable(self, sub_row, sub_col) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2403 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2404 |
self.SubTable.CreateGrid(sub_row, sub_col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2405 |
self.SubTable.SetValue(self, []) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2406 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2407 |
self.Sizer.AddMany([self.MainTable, self.SubTable]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2408 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2409 |
self.SetSizer(self.Sizer) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2410 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2411 |
def UpdateMainTable(self, row, col, low_index, high_index, data): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2412 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2413 |
Updates main table. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2414 |
It's done by deleting the main table and creating it again. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2415 |
@param row, col: size of the table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2416 |
@param low_index: the lowest index of the page |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2417 |
@param high_index: the highest index of the page |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2418 |
@param data: data |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2419 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2420 |
self.MainTable.Destroy() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2421 |
self.MainTable = RegisterMainTable(self, row, col, self.Controler) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2422 |
self.Sizer.Detach(self.SubTable) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2423 |
self.Sizer.AddMany([self.MainTable, self.SubTable]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2424 |
self.SetSizer(self.Sizer) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2425 |
self.MainTable.CreateGrid(row, col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2426 |
self.MainTable.SetValue(self, data, low_index, high_index) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2427 |
self.MainTable.Update() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2428 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2429 |
def UpdateSubTable(self, row, col, data): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2430 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2431 |
Updates sub table. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2432 |
It's done by deleting the sub table and creating it again. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2433 |
@param row, col: size of the table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2434 |
@param data: data |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2435 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2436 |
self.SubTable.Destroy() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2437 |
self.SubTable = RegisterSubTable(self, row, col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2438 |
self.Sizer.Detach(self.MainTable) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2439 |
self.Sizer.AddMany([self.MainTable, self.SubTable]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2440 |
self.Sizer.Layout() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2441 |
self.SetSizer(self.Sizer) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2442 |
self.SubTable.CreateGrid(row, col) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2443 |
self.SubTable.SetValue(self, data) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2444 |
self.SubTable.Update() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2445 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2446 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2447 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2448 |
# For Register Access Notebook Panel (Main Table) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2449 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2450 |
class RegisterMainTable(wx.grid.Grid): |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2451 |
def __init__(self, parent, row, col, controler): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2452 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2453 |
Constructor |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2454 |
@param parent: RegisterNotebook object |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2455 |
@param row, col: size of the table |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2456 |
@param controler: _EthercatSlaveCTN class in EthercatSlave.py |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2457 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2458 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2459 |
self.Data = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2460 |
self.Row = row |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2461 |
self.Col = col |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2462 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2463 |
self.RegisterAccessPanel = self.parent.parent.parent |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2464 |
|
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
2465 |
wx.grid.Grid.__init__(self, parent, -1, size=(820, 300), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
2466 |
style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2467 |
|
2389
f86eefc8d378
clean etherlab: pylint, W0404 # reimported module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2386
diff
changeset
|
2468 |
for evt, mapping_method in [(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
f86eefc8d378
clean etherlab: pylint, W0404 # reimported module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2386
diff
changeset
|
2469 |
(wx.grid.EVT_GRID_CELL_LEFT_CLICK, self.OnSelectCell), |
f86eefc8d378
clean etherlab: pylint, W0404 # reimported module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2386
diff
changeset
|
2470 |
(wx.grid.EVT_GRID_CELL_LEFT_DCLICK, self.OnRegModifyDialog)]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2471 |
self.Bind(evt, mapping_method) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2472 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2473 |
def SetValue(self, parent, reg_monitor_data, low_index, high_index): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2474 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2475 |
Set the RegMonitorData into the main table. |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2476 |
@param parent: RegisterNotebook object |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2477 |
@param reg_monitor_data: data |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2478 |
@param low_index: the lowest index of the page |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2479 |
@param high_index: the highest index of the page |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2480 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2481 |
self.RegMonitorData = reg_monitor_data |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2482 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2483 |
# set label name and size |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2484 |
register_maintable_label = [(0, "Description"), (1, "Dec"), |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2485 |
(2, "Hex"), (3, "Char")] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2486 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2487 |
for (index, label) in register_maintable_label: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2488 |
self.SetColLabelValue(index, label) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2489 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2490 |
self.SetColSize(0, 200) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2491 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2492 |
# if reg_monitor_data is 0, it is initialization of register access. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2493 |
if reg_monitor_data == 0: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2494 |
return 0 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2495 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2496 |
# set data into UI |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2497 |
row = col = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2498 |
for row_index in reg_monitor_data[low_index:high_index]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2499 |
col = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2500 |
self.SetRowLabelValue(row, row_index[0]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2501 |
for data_index in range(4): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2502 |
self.SetCellValue(row, col, row_index[data_index+1]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2503 |
self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2504 |
self.SetReadOnly(row, col, True) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2505 |
col = col + 1 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2506 |
row = row + 1 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2507 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2508 |
def OnSelectCell(self, event): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2509 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2510 |
Handles the event of the cell of the main table. |
2389
f86eefc8d378
clean etherlab: pylint, W0404 # reimported module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2386
diff
changeset
|
2511 |
@param event: wx.grid object (left click) |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2512 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2513 |
# if reg_monitor_data is 0, it is initialization of register access. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2514 |
if self.RegMonitorData == 0: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2515 |
event.Skip() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2516 |
return 0 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2517 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2518 |
sub_row = 0 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2519 |
sub_col = 4 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2520 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2521 |
address = self.GetRowLabelValue(event.GetRow()) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2522 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2523 |
reg_sub_grid_data = [] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2524 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2525 |
BIT_RANGE, NAME, DESCRIPTIONS = range(3) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2526 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2527 |
# Check if this register's detail description is exist or not, |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2528 |
# and create data structure for the detail description table ; sub grid |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2529 |
if address in self.RegisterAccessPanel.RegisterSubGridDict: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2530 |
for element in self.RegisterAccessPanel.RegisterSubGridDict[address]: |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
2531 |
row_data = [] |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2532 |
row_data.append(element[BIT_RANGE]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2533 |
row_data.append(element[NAME]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2534 |
bin_data = "{:0>16b}".format(int(self.GetCellValue(event.GetRow(), 1))) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2535 |
value_range = element[BIT_RANGE].split('-') |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2536 |
value = (bin_data[8:16][::-1]+bin_data[0:8][::-1])[int(value_range[0]):(int(value_range[-1])+1)][::-1] |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2537 |
row_data.append(str(int(('0b'+str(value)), 2))) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2538 |
if value in element[DESCRIPTIONS]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2539 |
row_data.append(element[DESCRIPTIONS][value]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2540 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2541 |
row_data.append('') |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2542 |
reg_sub_grid_data.append(row_data) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2543 |
sub_row = sub_row + 1 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2544 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2545 |
self.parent.UpdateSubTable(sub_row, sub_col, reg_sub_grid_data) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2546 |
# event.Skip() updates UI of selecting cell |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2547 |
event.Skip() |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2548 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2549 |
def OnRegModifyDialog(self, event): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2550 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2551 |
Handle the event of the cell of the main table. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2552 |
Display the window where the user modifies the value of the cell. |
2389
f86eefc8d378
clean etherlab: pylint, W0404 # reimported module
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2386
diff
changeset
|
2553 |
@param event: wx.grid object (double click) |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2554 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2555 |
# user can enter a value in case that user double-clicked 'Dec' or 'Hex' value. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2556 |
if event.GetCol() == 1 or event.GetCol() == 2: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
2557 |
dlg = wx.TextEntryDialog(self, _("Enter hex(0xnnnn) or dec(n) value"), |
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
2558 |
_("Register Modify Dialog"), style=wx.OK | wx.CANCEL) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2559 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2560 |
# Setting value in initial dialog value |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2561 |
start_value = self.GetCellValue(event.GetRow(), event.GetCol()) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2562 |
dlg.SetValue(start_value) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2563 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2564 |
if dlg.ShowModal() == wx.ID_OK: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2565 |
try: |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2566 |
# It int(input) success, this input is dev or hex value. |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2567 |
# Otherwise, it's error, so it goes except. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2568 |
int(dlg.GetValue(), 0) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2569 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2570 |
# reg_write |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2571 |
# ex) ethercat reg_write -p 0 -t uint16 0x0000 0x0000 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2572 |
return_val = self.Controler.CommonMethod.RegWrite('0x'+self.GetRowLabelValue(event.GetRow()), dlg.GetValue()) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2573 |
|
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
2574 |
if len(return_val) == 0: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2575 |
# set dec |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2576 |
self.SetCellValue(event.GetRow(), 1, str(int(dlg.GetValue(), 0))) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2577 |
# set hex |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2578 |
hex_data = '0x'+"{:0>4x}".format(int(dlg.GetValue(), 0)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2579 |
self.SetCellValue(event.GetRow(), 2, hex_data) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2580 |
# set char |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2581 |
char_data = "" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2582 |
# If hex_data is been able to convert to ascii code, append ascii code. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2583 |
for iter in range(2): |
2365
bc07b9910cdb
cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2364
diff
changeset
|
2584 |
if int(hex_data[(iter+1)*2:(iter+2)*2], 16) >= 32 and int(hex_data[(iter+1)*2:(iter+2)*2], 16) <= 126: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2585 |
char_data = char_data + chr(int(hex_data[(iter+1)*2:(iter+2)*2], 16)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2586 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2587 |
char_data = char_data + "." |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2588 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2589 |
self.SetCellValue(event.GetRow(), 3, char_data) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2590 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2591 |
else: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
2592 |
self.Controler.CommonMethod.CreateErrorDialog(_('You can\'t modify it. This register is read-only or it\'s not connected.')) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2593 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2594 |
except ValueError: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
2595 |
self.Controler.CommonMethod.CreateErrorDialog(_('You entered wrong value. You can enter dec or hex value only.')) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2596 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2597 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2598 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2599 |
# For Register Access Notebook Panel (Sub Table) |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2600 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2601 |
class RegisterSubTable(wx.grid.Grid): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2602 |
def __init__(self, parent, row, col): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2603 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2604 |
Constructor |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2605 |
@param parent: RegisterNotebook object |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2606 |
@param row, col: size of the table |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2607 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2608 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2609 |
self.Data = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2610 |
self.Row = row |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2611 |
self.Col = col |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2612 |
|
2363
9c7da6ff6a34
cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2361
diff
changeset
|
2613 |
wx.grid.Grid.__init__(self, parent, -1, size=(820, 150), |
2367
0fb54172a18b
cleanup etherlab: pep8, E227 missing whitespace around bitwise or shift operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2366
diff
changeset
|
2614 |
style=wx.EXPAND | wx.ALIGN_CENTRE_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2615 |
|
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2616 |
def SetValue(self, parent, data): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2617 |
""" |
2383
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2618 |
Set the data into the subtable. |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2619 |
@param parent: RegisterNotebook object |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2620 |
@param data: data |
6cc3460be285
clean etherlab: pep8, W191 indentation contains tabs
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2382
diff
changeset
|
2621 |
""" |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2622 |
# lset label name and size |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2623 |
Register_SubTable_Label = [(0, "Bits"), (1, "Name"), |
2380
b35bce45bc5a
clean etherlab: pep8, E127 continuation line over-indented for visual indent
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2379
diff
changeset
|
2624 |
(2, "Value"), (3, "Enum")] |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2625 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2626 |
for (index, label) in Register_SubTable_Label: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2627 |
self.SetColLabelValue(index, label) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2628 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2629 |
self.SetColSize(1, 200) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2630 |
self.SetColSize(3, 200) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2631 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2632 |
# set data into table |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2633 |
row = col = 0 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2634 |
for rowData in data: |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2635 |
col = 0 |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2636 |
for element in rowData: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2637 |
self.SetCellValue(row, col, element) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2638 |
self.SetCellAlignment(row, col, wx.ALIGN_CENTRE, wx.ALIGN_CENTER) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2639 |
self.SetReadOnly(row, col, True) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2640 |
col = col + 1 |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2641 |
row = row + 1 |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2642 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2643 |
|
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2644 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2645 |
# For Master State Panel |
2356
c26e0c66d8d5
cleanup etherlab: pep8, E265 block comment should start with '# '
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2355
diff
changeset
|
2646 |
# ------------------------------------------------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2647 |
class MasterStatePanelClass(wx.Panel): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2648 |
def __init__(self, parent, controler): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2649 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2650 |
Constructor |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2651 |
@param parent: wx.ScrollWindow object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2652 |
@Param controler: _EthercatSlaveCTN class in EthercatSlave.py |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2653 |
""" |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2654 |
wx.Panel.__init__(self, parent) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2655 |
self.Controler = controler |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2656 |
self.parent = parent |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2657 |
self.StaticBox = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2658 |
self.StaticText = {} |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2659 |
self.TextCtrl = {} |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2660 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2661 |
# ----------------------- Main Sizer and Update Button -------------------------------------------- |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
2662 |
self.MasterStateSizer = {"main": wx.BoxSizer(wx.VERTICAL)} |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2663 |
for key, attr in [ |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2664 |
("innerTop", [2, 10, 1, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2665 |
("innerMiddle", [1, 10, 1, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2666 |
("innerBottom", [1, 10, 1, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2667 |
("innerMasterState", [2, 10, 3, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2668 |
("innerDeviceInfo", [4, 10, 3, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2669 |
("innerFrameInfo", [4, 10, 5, 10]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2670 |
("innerSlaveInfo", [1, 10, 2, 10])]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2671 |
self.MasterStateSizer[key] = wx.FlexGridSizer(cols=attr[0], hgap=attr[1], rows=attr[2], vgap=attr[3]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2672 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2673 |
self.MSUpdateButton = wx.Button(self, label=_("Update")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2674 |
self.MSUpdateButton.Bind(wx.EVT_BUTTON, self.OnMSUpdateButtonClick) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2675 |
self.SIUpdateButton = wx.Button(self, label=_("Update")) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2676 |
self.SIUpdateButton.Bind(wx.EVT_BUTTON, self.OnSIUpdateButtonClick) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2677 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2678 |
for key, label in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2679 |
("masterState", "EtherCAT Master State"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2680 |
("deviceInfo", "Ethernet Network Card Information"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2681 |
("frameInfo", "Network Frame Information"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2682 |
("slaveInfo", "Slave Information")]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2683 |
self.StaticBox[key] = wx.StaticBox(self, label=_(label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2684 |
self.MasterStateSizer[key] = wx.StaticBoxSizer(self.StaticBox[key]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2685 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2686 |
# ----------------------- Master State ----------------------------------------------------------- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2687 |
for key, label in [ |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2688 |
('Phase', 'Phase:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2689 |
('Active', 'Active:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2690 |
('Slaves', 'Slave Count:')]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2691 |
self.StaticText[key] = wx.StaticText(self, label=_(label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2692 |
self.TextCtrl[key] = wx.TextCtrl(self, size=wx.Size(130, 24), style=wx.TE_READONLY) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2693 |
self.MasterStateSizer['innerMasterState'].AddMany([self.StaticText[key], self.TextCtrl[key]]) |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2694 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2695 |
self.MasterStateSizer['masterState'].AddSizer(self.MasterStateSizer['innerMasterState']) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2696 |
|
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2697 |
# ----------------------- Ethernet Network Card Information --------------------------------------- |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2698 |
for key, label in [ |
2379
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2699 |
('Main', 'MAC Address:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2700 |
('Link', 'Link State:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2701 |
('Tx frames', 'Tx Frames:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2702 |
('Rx frames', 'Rx Frames:'), |
015b724c30a5
clean etherlab: pep8, E129 visually indented line with same indent as next logical line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2377
diff
changeset
|
2703 |
('Lost frames', 'Lost Frames:')]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2704 |
self.StaticText[key] = wx.StaticText(self, label=_(label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2705 |
self.TextCtrl[key] = wx.TextCtrl(self, size=wx.Size(130, 24), style=wx.TE_READONLY) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2706 |
self.MasterStateSizer['innerDeviceInfo'].AddMany([self.StaticText[key], self.TextCtrl[key]]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2707 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2708 |
self.MasterStateSizer['deviceInfo'].AddSizer(self.MasterStateSizer['innerDeviceInfo']) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2709 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2710 |
# ----------------------- Network Frame Information ----------------------------------------------- |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2711 |
for key, label in [ |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2712 |
("Tx frame rate [1/s]", "Tx Frame Rate [1/s]:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2713 |
("Tx rate [KByte/s]", "Tx Rate [KByte/s]:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2714 |
("Rx frame rate [1/s]", "Rx Frame Rate [1/s]:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2715 |
("Rx rate [KByte/s]", "Rx Rate [KByte/s]:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2716 |
("Loss rate [1/s]", "Loss Rate [1/s]:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2717 |
("Frame loss [%]", "Frame Loss [%]:")]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2718 |
self.StaticText[key] = wx.StaticText(self, label=_(label)) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2719 |
self.MasterStateSizer['innerFrameInfo'].Add(self.StaticText[key]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2720 |
self.TextCtrl[key] = {} |
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2721 |
for index in ['0', '1', '2']: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2722 |
self.TextCtrl[key][index] = wx.TextCtrl(self, size=wx.Size(130, 24), style=wx.TE_READONLY) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2723 |
self.MasterStateSizer['innerFrameInfo'].Add(self.TextCtrl[key][index]) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2724 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2725 |
self.MasterStateSizer['frameInfo'].AddSizer(self.MasterStateSizer['innerFrameInfo']) |
2355
fec77f2b9e07
cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2354
diff
changeset
|
2726 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2727 |
# ------------------------------- Slave Information ----------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2728 |
self.SITreeListCtrl = SITreeListCtrl(self, self.Controler) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2729 |
self.MasterStateSizer["innerSlaveInfo"].AddMany([self.SIUpdateButton, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2730 |
self.SITreeListCtrl]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2731 |
self.MasterStateSizer["slaveInfo"].AddSizer( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2732 |
self.MasterStateSizer["innerSlaveInfo"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2733 |
|
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2734 |
# --------------------------------- Main Sizer ---------------------------------------------------- |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2735 |
self.MasterStateSizer["main"].Add(self.MSUpdateButton) |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2736 |
for key, sub, in [ |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2737 |
("innerTop", [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2738 |
"masterState", "deviceInfo"]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2739 |
("innerMiddle", [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2740 |
"frameInfo"]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2741 |
("innerBottom", [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2742 |
"slaveInfo"]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2743 |
("main", [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2744 |
"innerTop", "innerMiddle", "innerBottom"])]: |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2745 |
for key2 in sub: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2746 |
self.MasterStateSizer[key].AddSizer(self.MasterStateSizer[key2]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2747 |
|
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2748 |
self.SetSizer(self.MasterStateSizer["main"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2749 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2750 |
def OnMSUpdateButtonClick(self, event): |
2354
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2751 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2752 |
Handle the event of the 'Update' button. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2753 |
Update the data of the master state. |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2754 |
@param event: wx.EVT_BUTTON object |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2755 |
""" |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2756 |
if self.Controler.GetCTRoot()._connector is not None: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2757 |
self.MasterState = self.Controler.CommonMethod.GetMasterState() |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2758 |
# Update each TextCtrl |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2759 |
if self.MasterState: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2760 |
for key in self.TextCtrl: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2761 |
if isinstance(self.TextCtrl[key], dict): |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2762 |
for index in self.TextCtrl[key]: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2763 |
self.TextCtrl[key][index].SetValue(self.MasterState[key][int(index)]) |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2764 |
else: |
9460872f1440
convert some etherlab source files to unix format
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2353
diff
changeset
|
2765 |
self.TextCtrl[key].SetValue(self.MasterState[key][0]) |
2375
cfa68a06a24d
clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2374
diff
changeset
|
2766 |
else: |
2423
2c7b7ae24d57
Improve localization support in etherlab (mostly)
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
2417
diff
changeset
|
2767 |
self.Controler.CommonMethod.CreateErrorDialog(_('PLC not connected!')) |
2643
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2768 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2769 |
def OnSIUpdateButtonClick(self, event): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2770 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2771 |
Handle the event of the radio box in the slave information |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2772 |
@param event: wx.EVT_RADIOBOX object |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2773 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2774 |
if self.Controler.GetCTRoot()._connector is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2775 |
self.SITreeListCtrl.UpdateSI() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2776 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2777 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2778 |
self.Controler.CommonMethod.CreateErrorDialog('PLC not connected!') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2779 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2780 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2781 |
#------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2782 |
# For Slave Information Panel |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2783 |
#------------------------------------------------------------------------------- |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2784 |
class SITreeListCtrl(wx.Panel): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2785 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2786 |
EC_Addrs = ["0x0300", "0x0302", "0x0304", "0x0306", "0x0301", "0x0303", "0x0305", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2787 |
"0x0307", "0x0308", "0x0309", "0x030A", "0x030B", "0x030C", "0x030D", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2788 |
"0x0310", "0x0311", "0x0312", "0x0313", "0x0442", "0x0443"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2789 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2790 |
def __init__(self, parent, controler): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2791 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2792 |
Constructor |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2793 |
@param parent: Reference to the MasterStatePanel class |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2794 |
@param Controler: _EthercatCTN class in EthercatMaster.py |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2795 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2796 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2797 |
wx.Panel.__init__(self, parent, -1, size=wx.Size(750, 350)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2798 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2799 |
self.Controler=controler |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2800 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2801 |
self.Tree = wx.gizmos.TreeListCtrl(self, -1, size=wx.Size(750,350), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2802 |
style=wx.TR_HAS_BUTTONS |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2803 |
|wx.TR_HIDE_ROOT |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2804 |
|wx.TR_ROW_LINES |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2805 |
|wx.TR_COLUMN_LINES |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2806 |
|wx.TR_FULL_ROW_HIGHLIGHT) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2807 |
for label, width in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2808 |
("name", 400), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2809 |
("position", 100), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2810 |
("state", 100), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2811 |
("error", 100)]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2812 |
self.Tree.AddColumn(label, width=width) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2813 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2814 |
self.Tree.SetMainColumn(0) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2815 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2816 |
def UpdateSI(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2817 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2818 |
Update the data of the slave information. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2819 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2820 |
position, not_used, state, not_used, name = range(5) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2821 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2822 |
slave_node = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2823 |
slave_info_list = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2824 |
error_counter= [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2825 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2826 |
# get slave informations (name, position, state) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2827 |
slaves_infos = self.Controler.CommonMethod.GetSlaveStateFromSlave() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2828 |
slave_info_lines = slaves_infos.splitlines() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2829 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2830 |
for line in slave_info_lines: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2831 |
slave_info_list.append(line.split(None,4)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2832 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2833 |
slave_num = len(slave_info_lines) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2834 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2835 |
reg_info = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2836 |
for ec in self.EC_Addrs: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2837 |
reg_info.append(ec + ",0x001") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2838 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2839 |
# get error counts of slaves |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2840 |
err_count_list = self.Controler.CommonMethod.MultiRegRead(slave_num, reg_info) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2841 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2842 |
self.Tree.DeleteAllItems() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2843 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2844 |
root = self.Tree.AddRoot("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2845 |
ec_list_idx = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2846 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2847 |
for slave_idx in range(slave_num): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2848 |
slave_node = self.Tree.AppendItem(root, "") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2849 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2850 |
# set name, postion, state |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2851 |
col_num = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2852 |
for info_idx in [name, position, state]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2853 |
self.Tree.SetItemText(slave_node, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2854 |
slave_info_list[slave_idx][info_idx], col_num) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2855 |
col_num += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2856 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2857 |
error_counter = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2858 |
ec_idx = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2859 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2860 |
# set error counter's name and default value |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2861 |
for ec, sub_ecs in [("Port Error Counters 0/1/2/3",[ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2862 |
"Invaild Frame Counter 0/1/2/3", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2863 |
"RX Error Counter 0/1/2/3"]), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2864 |
("Forward RX Error Counter 0/1/2/3", []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2865 |
("ECAT Processing Unit Error Counter", []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2866 |
("PDI Error Counter", []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2867 |
("Lost Link Counter 0/1/2/3", []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2868 |
("Watchdog Counter Process Data", []), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2869 |
("Watchdog Counter PDI", [])]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2870 |
ec_sub_idx = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2871 |
ec_name = ec |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2872 |
tree_node = self.Tree.AppendItem(slave_node, "%s" % ec) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2873 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2874 |
if ec_name.find("0/1/2/3") > 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2875 |
num_ports = 4 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2876 |
err_count = [0, 0, 0, 0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2877 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2878 |
num_ports = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2879 |
err_count = [0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2880 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2881 |
error_counter[(ec_idx, ec_sub_idx)] = { |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2882 |
"name": ec_name, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2883 |
"tree_node": tree_node, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2884 |
"num_ports": num_ports, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2885 |
"err_count": err_count} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2886 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2887 |
for sub_ec in sub_ecs: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2888 |
ec_sub_idx += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2889 |
ec_name = sub_ec |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2890 |
tree_node = self.Tree.AppendItem(\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2891 |
error_counter[(ec_idx, 0)]["tree_node"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2892 |
"%s" % sub_ec) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2893 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2894 |
if ec_name.find("0/1/2/3") > 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2895 |
num_ports = 4 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2896 |
err_count = [0, 0, 0, 0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2897 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2898 |
num_ports = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2899 |
err_count = [0] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2900 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2901 |
error_counter[(ec_idx, ec_sub_idx)] = { |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2902 |
"name": ec_name, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2903 |
"tree_node": tree_node, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2904 |
"num_ports": num_ports, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2905 |
"err_count": err_count} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2906 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2907 |
for port_num in range(num_ports): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2908 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2909 |
error_counter[(ec_idx, ec_sub_idx)]["err_count"][port_num] += \ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2910 |
int(err_count_list[ec_list_idx].split(",")[2], 16) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2911 |
except: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2912 |
error_counter[(ec_idx, ec_sub_idx)]["err_count"][port_num] = -1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2913 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2914 |
ec_list_idx += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2915 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2916 |
if ec_sub_idx > 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2917 |
for port_num in range(num_ports): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2918 |
err_sum = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2919 |
for sub_idx in range(1, ec_sub_idx+1): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2920 |
err_sum += error_counter[(ec_idx, sub_idx)]\ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2921 |
["err_count"][port_num] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2922 |
error_counter[(ec_idx, 0)]["err_count"][port_num] = err_sum |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2923 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2924 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2925 |
for port_num in range(num_ports): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2926 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2927 |
error_counter[(ec_idx, ec_sub_idx)]["err_count"][port_num] += \ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2928 |
int(err_count_list[ec_list_idx].split(",")[2], 16) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2929 |
except: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2930 |
error_counter[(ec_idx, ec_sub_idx)]["err_count"][port_num] = -1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2931 |
ec_list_idx += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2932 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2933 |
ec_idx += 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2934 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2935 |
# set texts in "error" column. |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2936 |
ec_info_list = error_counter.items() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2937 |
ec_info_list.sort() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2938 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2939 |
err_checker = "none" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2940 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2941 |
for (idx, sub_idx), ec_info in ec_info_list: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2942 |
ec_text = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2943 |
for port_num in range(ec_info["num_ports"]): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2944 |
if ec_info["err_count"][port_num] != 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2945 |
err_checker = "occurred" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2946 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2947 |
if ec_info["err_count"][port_num] < 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2948 |
ec_text = "reg I/O error" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2949 |
else: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2950 |
ec_text = ec_text + "%d/" % ec_info["err_count"][port_num] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2951 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2952 |
ec_text = ec_text.strip("/") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2953 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2954 |
self.Tree.SetItemText(ec_info["tree_node"], ec_text, col_num) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2955 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2956 |
self.Tree.SetItemText(slave_node, err_checker, col_num) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2957 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2958 |
class DCConfigPanel(wx.Panel): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2959 |
def __init__(self, parent, controler): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2960 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2961 |
Constructor |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2962 |
@param parent: Reference to the MasterStatePanel class |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2963 |
@param Controler: _EthercatCTN class in EthercatMaster.py |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2964 |
""" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2965 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2966 |
wx.Panel.__init__(self, parent, -1, size=wx.Size(750, 350)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2967 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2968 |
self.Controler = controler |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2969 |
self.parent = parent |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2970 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2971 |
self.ESI_DC_Data = self.Controler.CommonMethod.LoadESIData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2972 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2973 |
# initialize SlaveStatePanel UI dictionaries |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2974 |
self.StaticBoxDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2975 |
self.StaticTextDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2976 |
self.TextCtrlDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2977 |
self.ComboBoxDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2978 |
self.CheckBoxDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2979 |
self.RadioButtonDic = {} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2980 |
OperationModeComboList = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2981 |
Sync1CycleComboList = [] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2982 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2983 |
for ESI_Data in self.ESI_DC_Data: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2984 |
OperationModeComboList.append(ESI_Data["desc"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2985 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2986 |
UnitComboList = [ "/100", "/ 50", "/ 40", "/ 30", "/ 25", "/ 20", "/16", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2987 |
"/ 10", "/ 8", "/ 5", "/ 4", "/ 3", "/ 2", "x 1", "x 2", "x 3", "x 4", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2988 |
"x 5", "x 8", "x 10", "x 16", "x 20", "x 25", "x 30", "x 40", "x 50", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2989 |
"x 100" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2990 |
] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2991 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2992 |
UnitComboListPlus = [ "/100", "/ 50", "/ 40", "/ 30", "/ 25", "/ 20", "/16", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2993 |
"/ 10", "/ 8", "/ 5", "/ 4", "/ 3", "/ 2", "x 0", "x 1", "x 2", "x 3", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2994 |
"x 4", "x 5", "x 8", "x 10", "x 16", "x 20", "x 25", "x 30", "x 40", |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2995 |
"x 50", "x 100" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2996 |
] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2997 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2998 |
for i in range(1024): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
2999 |
Sync1CycleComboList.append("x " + str(i + 1)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3000 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3001 |
# iniitalize BoxSizer and FlexGridSizer |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3002 |
self.SizerDic = { |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3003 |
"DCConfig_main_sizer" : wx.BoxSizer(wx.VERTICAL), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3004 |
"DCConfig_inner_main_sizer" : wx.FlexGridSizer(cols=1, hgap=50, rows=2, vgap=10), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3005 |
"CyclicMode_InnerSizer" : wx.FlexGridSizer(cols=1, hgap=5, rows=2, vgap=5), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3006 |
"SyncMode_InnerSizer" : wx.FlexGridSizer(cols=2, hgap=5, rows=1, vgap=5), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3007 |
"OperationMode_InnerSizer" : wx.FlexGridSizer(cols=2, hgap=100, rows=2, vgap=10), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3008 |
"CheckEnable_InnerSizer" : wx.FlexGridSizer(cols=2, hgap=10, rows=1, vgap=10), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3009 |
"Sync0_InnerSizer" : wx.FlexGridSizer(cols=1, hgap=15, rows=3, vgap=10), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3010 |
"Sync0_CycleTimeSizer" : wx.FlexGridSizer(cols=2, hgap=10, rows=2, vgap=5), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3011 |
"Sync0_ShiftTimeSizer" : wx.FlexGridSizer(cols=2, hgap=20, rows=2, vgap=5), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3012 |
"Sync1_InnerSizer" : wx.FlexGridSizer(cols=1, hgap=15, rows=3, vgap=10), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3013 |
"Sync1_CycleTimeSizer" : wx.FlexGridSizer(cols=2, hgap=10, rows=2, vgap=5), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3014 |
"Sync1_ShiftTimeSizer" : wx.FlexGridSizer(cols=2, hgap=20, rows=2, vgap=5) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3015 |
} |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3016 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3017 |
# initialize StaticBox and StaticBoxSizer |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3018 |
for box_name, box_label in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3019 |
("CyclicModeBox", "Cyclic Mode"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3020 |
("Sync0Box", "Sync0"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3021 |
("Sync0CycleTimeBox", "Cycle Time (us):"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3022 |
("Sync0ShiftTimeBox", "Shift Time (us):"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3023 |
("Sync1Box", "Sync1"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3024 |
("Sync1CycleTimeBox", "Cycle Time (us):"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3025 |
("Sync1ShiftTimeBox", "Shift Time (us):") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3026 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3027 |
self.StaticBoxDic[box_name] = wx.StaticBox(self, label=_(box_label)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3028 |
self.SizerDic[box_name] = wx.StaticBoxSizer(self.StaticBoxDic[box_name]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3029 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3030 |
for statictext_name, statictext_label in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3031 |
("MainLabel", "Distributed Clock"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3032 |
("OperationModeLabel", "Operation Mode:"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3033 |
("SyncUnitCycleLabel", "Sync Unit Cycle (us)"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3034 |
("Sync0ShiftTimeUserDefinedLabel", "User Defined"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3035 |
("Sync1ShiftTimeUserDefinedLabel", "User Defined"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3036 |
("BlankObject", ""), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3037 |
("BlankObject1", "") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3038 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3039 |
self.StaticTextDic[statictext_name] = wx.StaticText(self, label=_(statictext_label)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3040 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3041 |
for textctl_name in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3042 |
("SyncUnitCycle_Ctl"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3043 |
("Sync0CycleTimeUserDefined_Ctl"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3044 |
("Sync0ShiftTimeUserDefined_Ctl"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3045 |
("Sync1CycleTimeUserDefined_Ctl"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3046 |
("Sync1ShiftTimeUserDefined_Ctl"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3047 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3048 |
self.TextCtrlDic[textctl_name] = wx.TextCtrl( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3049 |
self, size=wx.Size(130, 24), style=wx.TE_READONLY) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3050 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3051 |
for checkbox_name, checkbox_label in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3052 |
("DCEnable", "Enable"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3053 |
("Sync0Enable", "Enable Sync0"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3054 |
("Sync1Enable", "Enable Sync1") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3055 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3056 |
self.CheckBoxDic[checkbox_name] = wx.CheckBox(self, -1, checkbox_label) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3057 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3058 |
for combobox_name, combobox_list, size in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3059 |
("OperationModeChoice", OperationModeComboList, 250), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3060 |
("Sync0UnitCycleChoice", UnitComboList, 130), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3061 |
("Sync1UnitCycleChoice", UnitComboList, 130) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3062 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3063 |
self.ComboBoxDic[combobox_name] = wx.ComboBox(self, size=wx.Size(size, 24), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3064 |
choices = combobox_list, style = wx.CB_DROPDOWN | wx.CB_READONLY) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3065 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3066 |
for radiobutton_name, radiobutton_label in [ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3067 |
("Sync0CycleTimeUnitRadioButton", "Sync Unit Cycle"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3068 |
("Sync0CycleTimeUserDefinedRadioButton", "User Defined"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3069 |
("Sync1CycleTimeUnitRadioButton", "Sync Unit Cycle"), |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3070 |
("Sync1CycleTimeUserDefinedRadioButton", "User Defined") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3071 |
]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3072 |
self.RadioButtonDic[radiobutton_name] = wx.RadioButton( |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3073 |
self, label = radiobutton_label, style = wx.RB_SINGLE) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3074 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3075 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3076 |
self.ApplyButton = wx.Button(self, label="Apply") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3077 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3078 |
# binding event |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3079 |
self.Bind(wx.EVT_CHECKBOX, self.CheckDCEnable, self.CheckBoxDic["DCEnable"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3080 |
#self.Bind(wx.EVT_COMBOBOX, self.SelectOperationMode, self.ComboBoxDic["OperationModeChoice"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3081 |
#self.Bind(wx.EVT_COMBOBOX, self.SelectUnitCycle, self.ComboBoxDic["Sync0UnitChoice"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3082 |
self.Bind(wx.EVT_RADIOBUTTON, self.SelectSync0CycleTime, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3083 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3084 |
self.Bind(wx.EVT_RADIOBUTTON, self.SelectSync0CycleTime, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3085 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3086 |
self.Bind(wx.EVT_RADIOBUTTON, self.SelectSync1CycleTime, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3087 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3088 |
self.Bind(wx.EVT_RADIOBUTTON, self.SelectSync1CycleTime, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3089 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3090 |
self.Bind(wx.EVT_CHECKBOX, self.CheckSync0Enable, self.CheckBoxDic["Sync0Enable"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3091 |
self.Bind(wx.EVT_CHECKBOX, self.CheckSync1Enable, self.CheckBoxDic["Sync1Enable"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3092 |
self.Bind(wx.EVT_BUTTON, self.OnClickApplyButton, self.ApplyButton) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3093 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3094 |
# sync1 shifttime box contents |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3095 |
self.SizerDic["Sync1_ShiftTimeSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3096 |
self.StaticTextDic["Sync1ShiftTimeUserDefinedLabel"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3097 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3098 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3099 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3100 |
# sync1 shifttime box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3101 |
self.SizerDic["Sync1ShiftTimeBox"].Add(self.SizerDic["Sync1_ShiftTimeSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3102 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3103 |
# sync1 cycletime box contents |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3104 |
self.SizerDic["Sync1_CycleTimeSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3105 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3106 |
self.ComboBoxDic["Sync1UnitCycleChoice"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3107 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3108 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3109 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3110 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3111 |
# sync0 cycletime box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3112 |
self.SizerDic["Sync1CycleTimeBox"].Add(self.SizerDic["Sync1_CycleTimeSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3113 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3114 |
self.SizerDic["Sync1_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3115 |
self.CheckBoxDic["Sync1Enable"], self.SizerDic["Sync1CycleTimeBox"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3116 |
self.SizerDic["Sync1ShiftTimeBox"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3117 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3118 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3119 |
# sync1 box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3120 |
self.SizerDic["Sync1Box"].Add(self.SizerDic["Sync1_InnerSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3121 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3122 |
# sync0 shifttime box contents |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3123 |
self.SizerDic["Sync0_ShiftTimeSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3124 |
self.StaticTextDic["Sync0ShiftTimeUserDefinedLabel"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3125 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3126 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3127 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3128 |
# sync0 shifttime box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3129 |
self.SizerDic["Sync0ShiftTimeBox"].Add(self.SizerDic["Sync0_ShiftTimeSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3130 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3131 |
# sync0 cycletime box contents |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3132 |
self.SizerDic["Sync0_CycleTimeSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3133 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3134 |
self.ComboBoxDic["Sync0UnitCycleChoice"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3135 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3136 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3137 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3138 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3139 |
# sync0 cycletime box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3140 |
self.SizerDic["Sync0CycleTimeBox"].Add(self.SizerDic["Sync0_CycleTimeSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3141 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3142 |
self.SizerDic["Sync0_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3143 |
self.CheckBoxDic["Sync0Enable"], self.SizerDic["Sync0CycleTimeBox"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3144 |
self.SizerDic["Sync0ShiftTimeBox"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3145 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3146 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3147 |
# sync0 box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3148 |
self.SizerDic["Sync0Box"].Add(self.SizerDic["Sync0_InnerSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3149 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3150 |
# sync0, sync1 box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3151 |
self.SizerDic["SyncMode_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3152 |
self.SizerDic["Sync0Box"], self.SizerDic["Sync1Box"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3153 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3154 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3155 |
# CyclicMode Box |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3156 |
self.SizerDic["CheckEnable_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3157 |
self.StaticTextDic["SyncUnitCycleLabel"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3158 |
self.TextCtrlDic["SyncUnitCycle_Ctl"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3159 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3160 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3161 |
self.SizerDic["OperationMode_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3162 |
self.StaticTextDic["OperationModeLabel"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3163 |
self.ComboBoxDic["OperationModeChoice"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3164 |
self.CheckBoxDic["DCEnable"], self.SizerDic["CheckEnable_InnerSizer"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3165 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3166 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3167 |
self.SizerDic["CyclicMode_InnerSizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3168 |
self.SizerDic["OperationMode_InnerSizer"], |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3169 |
self.SizerDic["SyncMode_InnerSizer"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3170 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3171 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3172 |
self.SizerDic["CyclicModeBox"].Add(self.SizerDic["CyclicMode_InnerSizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3173 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3174 |
# Main Sizer |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3175 |
self.SizerDic["DCConfig_inner_main_sizer"].AddMany([ |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3176 |
self.StaticTextDic["MainLabel"], self.ApplyButton, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3177 |
self.SizerDic["CyclicModeBox"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3178 |
]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3179 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3180 |
self.SizerDic["DCConfig_main_sizer"].Add(self.SizerDic["DCConfig_inner_main_sizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3181 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3182 |
self.SetSizer(self.SizerDic["DCConfig_main_sizer"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3183 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3184 |
self.Centre() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3185 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3186 |
self.UIOnOffSet(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3187 |
self.LoadProjectDCData() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3188 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3189 |
def UIOnOffSet(self, activate): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3190 |
if activate : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3191 |
for object in self.RadioButtonDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3192 |
self.RadioButtonDic[object].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3193 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3194 |
for object in self.ComboBoxDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3195 |
if object == "OperationModeChoice": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3196 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3197 |
self.ComboBoxDic[object].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3198 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3199 |
for object in self.TextCtrlDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3200 |
if object in ["SyncUnitCycle_Ctl", "InputReference_Ctl"]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3201 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3202 |
self.TextCtrlDic[object].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3203 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3204 |
for object in self.CheckBoxDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3205 |
if object == "DCEnable": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3206 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3207 |
self.CheckBoxDic[object].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3208 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3209 |
# initial set or DC enable uncheck |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3210 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3211 |
for object in self.RadioButtonDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3212 |
self.RadioButtonDic[object].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3213 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3214 |
for object in self.ComboBoxDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3215 |
if object == "OperationModeChoice": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3216 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3217 |
self.ComboBoxDic[object].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3218 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3219 |
for object in self.TextCtrlDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3220 |
if object == "SyncUnitCycle_Ctl": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3221 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3222 |
self.TextCtrlDic[object].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3223 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3224 |
for object in self.CheckBoxDic: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3225 |
if object == "DCEnable": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3226 |
continue |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3227 |
self.CheckBoxDic[object].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3228 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3229 |
for data in self.ESI_DC_Data: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3230 |
index = self.Controler.ExtractHexDecValue(data["assign_activate"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3231 |
if index == 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3232 |
config_name = data["desc"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3233 |
self.ComboBoxDic["OperationModeChoice"].SetStringSelection(config_name) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3234 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3235 |
def CheckSync0Enable(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3236 |
if evt.GetInt(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3237 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3238 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3239 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3240 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3241 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3242 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3243 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3244 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3245 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3246 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3247 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3248 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3249 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3250 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3251 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3252 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3253 |
def CheckSync1Enable(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3254 |
if evt.GetInt(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3255 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3256 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3257 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3258 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3259 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3260 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3261 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3262 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3263 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3264 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3265 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3266 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3267 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3268 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3269 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3270 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3271 |
def CheckDCEnable(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3272 |
ns_mode = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3273 |
task_cycle_ns = self.GetInterval(ns_mode) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3274 |
sync0_cycle_factor = None |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3275 |
sync1_cycle_factor = None |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3276 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3277 |
#task_cycle_ns = self.Controler.GetCTRoot()._Ticktime |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3278 |
if (task_cycle_ns > 0): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3279 |
self.UIOnOffSet(evt.GetInt()) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3280 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3281 |
if evt.GetInt(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3282 |
# default select DC enable sync0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3283 |
default_list_num = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3284 |
config_name = self.ESI_DC_Data[default_list_num]["desc"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3285 |
assign_act = self.ESI_DC_Data[default_list_num]["assign_activate"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3286 |
sync0_cycle_time_ns = self.ESI_DC_Data[default_list_num]["cycletime_sync0"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3287 |
if sync0_cycle_time_ns == 0 : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3288 |
sync0_cycle_factor = self.ESI_DC_Data[default_list_num]["cycletime_sync0_factor"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3289 |
sync0_shift_time_ns = self.ESI_DC_Data[default_list_num]["shifttime_sync0"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3290 |
sync1_cycle_time_ns = self.ESI_DC_Data[default_list_num]["cycletime_sync1"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3291 |
if sync1_cycle_time_ns == 0 : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3292 |
sync1_cycle_factor = self.ESI_DC_Data[default_list_num]["cycletime_sync1_factor"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3293 |
sync1_shift_time_ns = self.ESI_DC_Data[default_list_num]["shifttime_sync1"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3294 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3295 |
cal_assign_act = self.Controler.ExtractHexDecValue(assign_act) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3296 |
sync0_cycle_time_us = str(int(sync0_cycle_time_ns) / 1000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3297 |
sync0_shift_time_us = str(int(sync0_shift_time_ns) / 1000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3298 |
sync1_cycle_time_us = str(int(sync1_cycle_time_ns) / 1000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3299 |
sync1_shift_time_us = str(int(sync1_shift_time_ns) / 1000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3300 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3301 |
task_cycle_to_us = str(int(task_cycle_ns) / 1000) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3302 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3303 |
# DC sync0 mode |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3304 |
if cal_assign_act == 768: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3305 |
# Disable About Sync1 Objects |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3306 |
self.CheckBoxDic["Sync1Enable"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3307 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3308 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3309 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3310 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3311 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3312 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3313 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3314 |
self.CheckBoxDic["Sync1Enable"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3315 |
if sync1_cycle_factor is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3316 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3317 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3318 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3319 |
self.SetSyncUnitCycle(sync1_cycle_factor, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3320 |
self.ComboBoxDic["Sync1UnitCycleChoice"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3321 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3322 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3323 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3324 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3325 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].SetValue(sync1_cycle_time_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3326 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3327 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].SetValue(sync1_shift_time_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3328 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3329 |
# Set Sync0 Objects |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3330 |
self.CheckBoxDic["Sync0Enable"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3331 |
if sync0_cycle_factor is not None: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3332 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3333 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3334 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3335 |
self.SetSyncUnitCycle(sync0_cycle_factor, |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3336 |
self.ComboBoxDic["Sync0UnitCycleChoice"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3337 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3338 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3339 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3340 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3341 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].SetValue(sync0_cycle_time_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3342 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3343 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].SetValue(sync0_shift_time_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3344 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3345 |
self.ComboBoxDic["OperationModeChoice"].SetStringSelection(config_name) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3346 |
self.TextCtrlDic["SyncUnitCycle_Ctl"].SetValue(task_cycle_to_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3347 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3348 |
self.CheckBoxDic["Sync0Enable"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3349 |
self.CheckBoxDic["Sync1Enable"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3350 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3351 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3352 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3353 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3354 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3355 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3356 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3357 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].SetValue("") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3358 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3359 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3360 |
self.UIOnOffSet(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3361 |
#error_str = "DC Enable is not possble, please set task interval" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3362 |
error_str = "Can't Set DC Enable" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3363 |
self.Controler.CommonMethod.CreateErrorDialog(error_str) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3364 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3365 |
def SetSyncUnitCycle(self, factor, object): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3366 |
# factor > 0 ==> * factor, factor < 0 ==> / factor |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3367 |
factor_to_int = int(factor) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3368 |
if factor_to_int > 0: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3369 |
lists = object.GetStrings() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3370 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3371 |
for token in lists: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3372 |
temp = token.split(" ") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3373 |
if (temp[0] == "x") and (int(temp[1]) == factor_to_int): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3374 |
object.SetStringSelection(token) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3375 |
return True |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3376 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3377 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3378 |
lists = object.GetStrings() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3379 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3380 |
for token in lists: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3381 |
temp = token.split(" ") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3382 |
if (temp[0] == "/") and (int(temp[1]) == factor_to_int): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3383 |
object.SetStringSelection(token) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3384 |
return True |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3385 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3386 |
return False |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3387 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3388 |
def GetInterval(self, mode): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3389 |
project_infos = self.Controler.GetCTRoot().GetProjectInfos() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3390 |
for project_info_list in project_infos["values"]: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3391 |
if project_info_list["name"] == "Resources" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3392 |
token = project_info_list["values"][0]["tagname"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3393 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3394 |
tasks, instances = self.Controler.GetCTRoot().GetEditedResourceInfos(token) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3395 |
try: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3396 |
task_cycle_ns = self.ParseTime(tasks[0]["Interval"]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3397 |
except : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3398 |
task_cycle_ns = 0 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3399 |
task_cycle_us = int(task_cycle_ns) / 1000 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3400 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3401 |
# mode == 1 ==> return ns |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3402 |
# mode == 2 ==> return us |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3403 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3404 |
if mode == 1: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3405 |
return task_cycle_ns |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3406 |
if mode == 2: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3407 |
return str(task_cycle_us) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3408 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3409 |
def ParseTime(self, input): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3410 |
# input example : 't#1ms' |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3411 |
# temp.split('#') -> ['t', '1ms'] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3412 |
temp = input.split('#') |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3413 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3414 |
# temp[1] : '1ms' |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3415 |
# temp[-2:] : 'ms' |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3416 |
# temp[:-2] : '1' |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3417 |
if temp[1][-2:] == "ms": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3418 |
# convert nanosecond unit |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3419 |
result = int(temp[1][:-2]) * 1000000 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3420 |
elif temp[1][-2:] == "us": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3421 |
result = int(temp[1][:-2]) * 1000 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3422 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3423 |
return str(result) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3424 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3425 |
def SelectSync0CycleTime(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3426 |
selected_object = evt.GetEventObject() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3427 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3428 |
if selected_object.GetLabel() == "User Defined" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3429 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3430 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3431 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3432 |
elif selected_object.GetLabel() == "Sync Unit Cycle" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3433 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3434 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3435 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3436 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3437 |
def SelectSync1CycleTime(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3438 |
selected_object = evt.GetEventObject() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3439 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3440 |
if selected_object.GetLabel() == "User Defined" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3441 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3442 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3443 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3444 |
elif selected_object.GetLabel() == "Sync Unit Cycle" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3445 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3446 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3447 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3448 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3449 |
def GetCycle(self, period, section): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3450 |
temp = section.split(" ") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3451 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3452 |
if temp[0] == "x": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3453 |
result = int(period) * int(temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3454 |
elif temp[0] == "/" : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3455 |
result = int(period) / int(temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3456 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3457 |
result = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3458 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3459 |
return result |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3460 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3461 |
def OnClickApplyButton(self, evt): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3462 |
us_mode = 2 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3463 |
dc_enable = self.CheckBoxDic["DCEnable"].GetValue() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3464 |
dc_desc = self.ComboBoxDic["OperationModeChoice"].GetStringSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3465 |
dc_assign_activate = self.ESI_DC_Data[0]["assign_activate"] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3466 |
dc_assign_activate_mod = dc_assign_activate.split('x')[1] |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3467 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3468 |
if self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].GetValue(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3469 |
temp = self.ComboBoxDic["Sync0UnitCycleChoice"].GetStringSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3470 |
dc_sync0_cycle = "1_" + str(self.GetCycle(self.GetInterval(us_mode), temp)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3471 |
elif self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].GetValue(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3472 |
dc_sync0_cycle = "2_" + self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].GetValue() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3473 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3474 |
dc_sync0_cycle = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3475 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3476 |
if self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].GetValue(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3477 |
temp = self.ComboBoxDic["Sync1UnitCycleChoice"].GetStringSelection() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3478 |
dc_sync1_cycle = "1_" + self.GetCycle(self.GetInterval(us_mode), temp) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3479 |
elif self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].GetValue(): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3480 |
dc_sync1_cycle = "2_" + self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].GetValue() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3481 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3482 |
dc_sync1_cycle = "" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3483 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3484 |
dc_sync0_shift = self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].GetValue() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3485 |
dc_sync1_shift = self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].GetValue() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3486 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3487 |
self.Controler.BaseParams.setDC_Enable(dc_enable) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3488 |
self.Controler.BaseParams.setDC_Desc(dc_desc) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3489 |
self.Controler.BaseParams.setDC_Assign_Activate(dc_assign_activate_mod) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3490 |
if dc_sync0_cycle: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3491 |
self.Controler.BaseParams.setDC_Sync0_Cycle_Time(dc_sync0_cycle) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3492 |
if dc_sync0_shift: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3493 |
self.Controler.BaseParams.setDC_Sync0_Shift_Time(dc_sync0_shift) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3494 |
if dc_sync1_cycle: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3495 |
self.Controler.BaseParams.setDC_Sync1_Cycle_Time(dc_sync1_cycle) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3496 |
if dc_sync1_shift: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3497 |
self.Controler.BaseParams.setDC_Sync1_Shift_Time(dc_sync1_shift) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3498 |
project_infos = self.Controler.GetCTRoot().CTNRequestSave() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3499 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3500 |
def GetSymbol(self, period, cycle): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3501 |
cmp1 = int(period) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3502 |
cmp2 = int(cycle) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3503 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3504 |
if cmp1 == cmp2 : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3505 |
return "x 1" |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3506 |
elif cmp2 > cmp1 : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3507 |
temp = cmp2 / cmp1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3508 |
result = "x " + str(temp) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3509 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3510 |
temp = cmp1 / cmp2 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3511 |
result = "/ " + str(temp) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3512 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3513 |
return result |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3514 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3515 |
def SetSyncCycle(self, period, sync0_cycle, sync1_cycle): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3516 |
if sync0_cycle != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3517 |
self.CheckBoxDic["Sync0Enable"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3518 |
temp = sync0_cycle.split("_") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3519 |
if temp[0] == "1": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3520 |
symbol = self.GetSymbol(period, temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3521 |
self.ComboBoxDic["Sync0UnitCycleChoice"].SetStringSelection(symbol) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3522 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3523 |
self.RadioButtonDic["Sync0CycleTimeUnitRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3524 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3525 |
self.TextCtrlDic["Sync0CycleTimeUserDefined_Ctl"].SetValue(temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3526 |
self.ComboBoxDic["Sync0UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3527 |
self.RadioButtonDic["Sync0CycleTimeUserDefinedRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3528 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3529 |
if sync1_cycle != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3530 |
self.CheckBoxDic["Sync1Enable"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3531 |
temp = sync1_cycle.split("_") |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3532 |
if temp[0] == "1": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3533 |
symbol = self.GetSymbol(period, temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3534 |
self.ComboBoxDic["Sync1UnitChoice"].SetStringSelection(symbol) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3535 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3536 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3537 |
else : |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3538 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].SetValue(temp[1]) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3539 |
self.ComboBoxDic["Sync1UnitChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3540 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].SetValue(True) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3541 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3542 |
def LoadProjectDCData(self): |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3543 |
ns_mode = 1 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3544 |
task_cycle_ns = self.GetInterval(ns_mode) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3545 |
task_cycle_to_us = int(task_cycle_ns) / 1000 |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3546 |
dc_enable = self.Controler.BaseParams.getDC_Enable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3547 |
dc_desc = self.Controler.BaseParams.getDC_Desc() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3548 |
dc_assign_activate = self.Controler.BaseParams.getDC_Assign_Activate() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3549 |
dc_sync0_cycle = self.Controler.BaseParams.getDC_Sync0_Cycle_Time() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3550 |
dc_sync0_shift = self.Controler.BaseParams.getDC_Sync0_Shift_Time() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3551 |
dc_sync1_cycle = self.Controler.BaseParams.getDC_Sync1_Cycle_Time() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3552 |
dc_sync1_shift = self.Controler.BaseParams.getDC_Sync1_Shift_Time() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3553 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3554 |
self.UIOnOffSet(dc_enable) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3555 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3556 |
if dc_enable: |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3557 |
self.CheckBoxDic["DCEnable"].SetValue(dc_enable) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3558 |
self.ComboBoxDic["OperationModeChoice"].SetStringSelection(dc_desc) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3559 |
self.TextCtrlDic["SyncUnitCycle_Ctl"].SetValue(str(task_cycle_to_us)) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3560 |
self.SetSyncCycle(str(task_cycle_to_us), dc_sync0_cycle, dc_sync1_cycle) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3561 |
if dc_sync0_shift != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3562 |
self.TextCtrlDic["Sync0ShiftTimeUserDefined_Ctl"].SetValue(dc_sync0_shift) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3563 |
if dc_sync1_shift != "None": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3564 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].SetValue(dc_sync1_shift) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3565 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3566 |
if dc_assign_activate == "300": |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3567 |
self.CheckBoxDic["Sync1Enable"].SetValue(False) |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3568 |
self.RadioButtonDic["Sync1CycleTimeUnitRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3569 |
self.ComboBoxDic["Sync1UnitCycleChoice"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3570 |
self.RadioButtonDic["Sync1CycleTimeUserDefinedRadioButton"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3571 |
self.TextCtrlDic["Sync1CycleTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3572 |
self.TextCtrlDic["Sync1ShiftTimeUserDefined_Ctl"].Disable() |
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3573 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3574 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3575 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3576 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3577 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3578 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3579 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3580 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3581 |
|
b98d9e08231f
Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
diff
changeset
|
3582 |