author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Sun, 18 Feb 2018 21:51:33 +0100 | |
changeset 1945 | 90bf6bd94b94 |
parent 1944 | 6162e34fb246 |
child 1948 | b9a3f771aaab |
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 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
6 |
from __future__ import absolute_import |
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 |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
19 |
] = range(8) |
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 |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
31 |
] = range(8, 17) |
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 |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
41 |
] = range(17, 24) |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
42 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
43 |
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
|
44 |
"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
|
45 |
"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
|
46 |
"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
|
47 |
"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
|
48 |
"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
|
49 |
"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
|
50 |
"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
|
51 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
52 |
POU_TYPES = { |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
53 |
"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
|
54 |
"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
|
55 |
"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
|
56 |
} |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
57 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
58 |
CLASS_TYPES = { |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
59 |
"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
|
60 |
"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
|
61 |
"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
|
62 |
"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
|
63 |
"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
|
64 |
} |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
65 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
66 |
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
|
67 |
LOCATION_MODULE, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
68 |
LOCATION_GROUP, |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
69 |
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
|
70 |
LOCATION_VAR_OUTPUT, |
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_MEMORY] = range(6) |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
72 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
73 |
UNEDITABLE_NAMES = [_("User-defined POUs"), _("Functions"), _("Function Blocks"), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
74 |
_("Programs"), _("Data Types"), _("Transitions"), _("Actions"), |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
75 |
_("Configurations"), _("Resources"), _("Properties")] |
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
76 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
77 |
[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
|
78 |
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
|
79 |
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
|
80 |
|
6162e34fb246
Moved some code from PLCController.py to other modules. Added necessary imports.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff
changeset
|
81 |
# 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
|
82 |
del _ |