36 from lxml import etree |
36 from lxml import etree |
37 |
37 |
38 import util.paths as paths |
38 import util.paths as paths |
39 from util.TranslationCatalogs import NoTranslate |
39 from util.TranslationCatalogs import NoTranslate |
40 from plcopen import * |
40 from plcopen import * |
41 from plcopen.XSLTModelQuery import XSLTModelQuery |
41 from plcopen.InstancesPathCollector import InstancesPathCollector |
42 from graphics.GraphicCommons import * |
42 from graphics.GraphicCommons import * |
43 from PLCGenerator import * |
43 from PLCGenerator import * |
44 |
44 |
45 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)?") |
45 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)?") |
46 |
46 |
265 self.Root.variables.append(_VariablesTreeItemInfos( |
265 self.Root.variables.append(_VariablesTreeItemInfos( |
266 *(_translate_args( |
266 *(_translate_args( |
267 [_StringValue, class_extraction, _StringValue] + |
267 [_StringValue, class_extraction, _StringValue] + |
268 [_BoolValue] * 2, args) + [[]]))) |
268 [_BoolValue] * 2, args) + [[]]))) |
269 |
269 |
270 |
|
271 class InstancesPathCollector(XSLTModelQuery): |
|
272 """ object for collecting instances path list""" |
|
273 def __init__(self, controller): |
|
274 self.Instances = [] |
|
275 XSLTModelQuery.__init__(self, |
|
276 controller, |
|
277 "instances_path.xslt", |
|
278 [("AddInstance", self.AddInstance)]) |
|
279 |
|
280 def AddInstance(self, context, *args): |
|
281 self.Instances.append(args[0][0]) |
|
282 |
|
283 def Collect(self, root, name, debug): |
|
284 self._process_xslt(root, debug, instance_type = name) |
|
285 res = self.Instances |
|
286 self.Instances = [] |
|
287 return res |
|
288 |
270 |
289 class InstanceTagName(object): |
271 class InstanceTagName(object): |
290 """Helpers object for generating instance tagname""" |
272 """Helpers object for generating instance tagname""" |
291 |
273 |
292 def __init__(self, controller): |
274 def __init__(self, controller): |