equal
deleted
inserted
replaced
32 import re |
32 import re |
33 import datetime |
33 import datetime |
34 import util.paths as paths |
34 import util.paths as paths |
35 from time import localtime |
35 from time import localtime |
36 from collections import OrderedDict, namedtuple |
36 from collections import OrderedDict, namedtuple |
37 |
37 from util.TranslationCatalogs import NoTranslate |
38 from plcopen import * |
38 from plcopen import * |
39 from graphics.GraphicCommons import * |
39 from graphics.GraphicCommons import * |
40 from PLCGenerator import * |
40 from PLCGenerator import * |
41 |
41 |
42 duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:\.[0-9]*)?)ms)?") |
42 duration_model = re.compile("(?:([0-9]{1,2})h)?(?:([0-9]{1,2})m(?!s))?(?:([0-9]{1,2})s)?(?:([0-9]{1,3}(?:\.[0-9]*)?)ms)?") |
94 |
94 |
95 ScriptDirectory = paths.AbsDir(__file__) |
95 ScriptDirectory = paths.AbsDir(__file__) |
96 |
96 |
97 |
97 |
98 def GetUneditableNames(): |
98 def GetUneditableNames(): |
99 _ = lambda x: x |
99 _ = NoTranslate |
100 return [_("User-defined POUs"), _("Functions"), _("Function Blocks"), |
100 return [_("User-defined POUs"), _("Functions"), _("Function Blocks"), |
101 _("Programs"), _("Data Types"), _("Transitions"), _("Actions"), |
101 _("Programs"), _("Data Types"), _("Transitions"), _("Actions"), |
102 _("Configurations"), _("Resources"), _("Properties")] |
102 _("Configurations"), _("Resources"), _("Properties")] |
103 |
103 |
104 |
104 |
136 # Helpers functions for translating list of arguments |
136 # Helpers functions for translating list of arguments |
137 # from xslt to valid arguments |
137 # from xslt to valid arguments |
138 #------------------------------------------------------------------------------- |
138 #------------------------------------------------------------------------------- |
139 |
139 |
140 |
140 |
141 _StringValue = lambda x: x |
141 def _StringValue(x): |
142 _BoolValue = lambda x: x in ["true", "0"] |
142 return x |
|
143 |
|
144 |
|
145 def _BoolValue(x): |
|
146 return x in ["true", "0"] |
143 |
147 |
144 |
148 |
145 def _translate_args(translations, args): |
149 def _translate_args(translations, args): |
146 return [translate(arg[0]) if len(arg) > 0 else None |
150 return [translate(arg[0]) if len(arg) > 0 else None |
147 for translate, arg in |
151 for translate, arg in |