author | Edouard Tisserant <edouard@beremiz.fr> |
Fri, 30 Aug 2024 11:50:23 +0200 | |
changeset 4008 | f30573e98600 |
parent 3750 | f62625418bff |
permissions | -rw-r--r-- |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
3 |
# This file is part of Beremiz |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
4 |
# See COPYING file for copyrights details. |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
5 |
|
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
2529
diff
changeset
|
6 |
|
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
7 |
from util.TranslationCatalogs import NoTranslate |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
8 |
_ = NoTranslate |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
9 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
10 |
ITEMS_EDITABLE = [ |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
11 |
ITEM_PROJECT, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
12 |
ITEM_POU, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
13 |
ITEM_VARIABLE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
14 |
ITEM_TRANSITION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
15 |
ITEM_ACTION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
16 |
ITEM_CONFIGURATION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
17 |
ITEM_RESOURCE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
18 |
ITEM_DATATYPE |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
2529
diff
changeset
|
19 |
] = list(range(8)) |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
20 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
21 |
ITEMS_UNEDITABLE = [ |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
22 |
ITEM_DATATYPES, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
23 |
ITEM_FUNCTION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
24 |
ITEM_FUNCTIONBLOCK, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
25 |
ITEM_PROGRAM, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
26 |
ITEM_TRANSITIONS, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
27 |
ITEM_ACTIONS, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
28 |
ITEM_CONFIGURATIONS, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
29 |
ITEM_RESOURCES, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
30 |
ITEM_PROPERTIES |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
2529
diff
changeset
|
31 |
] = list(range(8, 17)) |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
32 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
33 |
ITEMS_VARIABLE = [ |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
34 |
ITEM_VAR_LOCAL, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
35 |
ITEM_VAR_GLOBAL, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
36 |
ITEM_VAR_EXTERNAL, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
37 |
ITEM_VAR_TEMP, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
38 |
ITEM_VAR_INPUT, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
39 |
ITEM_VAR_OUTPUT, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
40 |
ITEM_VAR_INOUT |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
2529
diff
changeset
|
41 |
] = list(range(17, 24)) |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
42 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
43 |
ITEM_CONFNODE = 25 |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
44 |
|
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
45 |
VAR_CLASS_INFOS = { |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
46 |
"Local": ("localVars", ITEM_VAR_LOCAL), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
47 |
"Global": ("globalVars", ITEM_VAR_GLOBAL), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
48 |
"External": ("externalVars", ITEM_VAR_EXTERNAL), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
49 |
"Temp": ("tempVars", ITEM_VAR_TEMP), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
50 |
"Input": ("inputVars", ITEM_VAR_INPUT), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
51 |
"Output": ("outputVars", ITEM_VAR_OUTPUT), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
52 |
"InOut": ("inOutVars", ITEM_VAR_INOUT)} |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
53 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
54 |
POU_TYPES = { |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
55 |
"program": ITEM_PROGRAM, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
56 |
"functionBlock": ITEM_FUNCTIONBLOCK, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
57 |
"function": ITEM_FUNCTION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
58 |
} |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
59 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
60 |
CLASS_TYPES = { |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
61 |
"configuration": ITEM_CONFIGURATION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
62 |
"resource": ITEM_RESOURCE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
63 |
"action": ITEM_ACTION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
64 |
"transition": ITEM_TRANSITION, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
"program": ITEM_PROGRAM |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
} |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
67 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
LOCATIONS_ITEMS = [LOCATION_CONFNODE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
LOCATION_MODULE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
70 |
LOCATION_GROUP, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
71 |
LOCATION_VAR_INPUT, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
72 |
LOCATION_VAR_OUTPUT, |
3750
f62625418bff
automated conversion using 2to3-3.9 tool
GP Orcullo <kinsamanka@gmail.com>
parents:
2529
diff
changeset
|
73 |
LOCATION_VAR_MEMORY] = list(range(6)) |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
74 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
75 |
UNEDITABLE_NAMES = [_("User-defined POUs"), _("Functions"), _("Function Blocks"), |
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
76 |
_("Programs"), _("Data Types"), _("Transitions"), _("Actions"), |
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
77 |
_("Configurations"), _("Resources"), _("Properties")] |
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
78 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
79 |
[USER_DEFINED_POUS, FUNCTIONS, FUNCTION_BLOCKS, PROGRAMS, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
80 |
DATA_TYPES, TRANSITIONS, ACTIONS, CONFIGURATIONS, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
81 |
RESOURCES, PROPERTIES] = UNEDITABLE_NAMES |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
82 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
83 |
# ------------------------------------------------------------------------------- |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
84 |
# Project Element tag name computation functions |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
85 |
# ------------------------------------------------------------------------------- |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
86 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
87 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
88 |
# Compute a data type name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
89 |
def ComputeDataTypeName(datatype): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
90 |
return "D::%s" % datatype |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
91 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
92 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
93 |
# Compute a pou name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
94 |
def ComputePouName(pou): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
95 |
return "P::%s" % pou |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
96 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
97 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
98 |
# Compute a pou transition name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
99 |
def ComputePouTransitionName(pou, transition): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
100 |
return "T::%s::%s" % (pou, transition) |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
101 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
102 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
103 |
# Compute a pou action name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
104 |
def ComputePouActionName(pou, action): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
105 |
return "A::%s::%s" % (pou, action) |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
106 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
107 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
108 |
# Compute a pou name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
109 |
def ComputeConfigurationName(config): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
110 |
return "C::%s" % config |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
111 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
112 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
113 |
# Compute a pou name |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
114 |
def ComputeConfigurationResourceName(config, resource): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
115 |
return "R::%s::%s" % (config, resource) |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
116 |
|
1953
5736d25bb393
PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents:
1948
diff
changeset
|
117 |
|
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
118 |
def GetElementType(tagname): |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
119 |
words = tagname.split("::") |
2524
c80b0d864475
WIP adding searching capabilities in python files. was done :
Edouard Tisserant
parents:
1953
diff
changeset
|
120 |
if len(words) == 1: |
c80b0d864475
WIP adding searching capabilities in python files. was done :
Edouard Tisserant
parents:
1953
diff
changeset
|
121 |
return ITEM_CONFNODE |
1948
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
122 |
return { |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
123 |
"D": ITEM_DATATYPE, |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
124 |
"P": ITEM_POU, |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
125 |
"T": ITEM_TRANSITION, |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
126 |
"A": ITEM_ACTION, |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
127 |
"C": ITEM_CONFIGURATION, |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
128 |
"R": ITEM_RESOURCE |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
129 |
}[words[0]] |
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
130 |
|
b9a3f771aaab
Moved some definitions away from controller class, and adaped references them through all code.
Edouard Tisserant
parents:
1944
diff
changeset
|
131 |
|
1944
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
132 |
# remove gettext override |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
133 |
del _ |