--- a/PLCControler.py Fri Feb 16 13:00:06 2018 +0100
+++ b/PLCControler.py Fri Feb 16 18:24:55 2018 +0100
@@ -38,6 +38,7 @@
import util.paths as paths
from util.TranslationCatalogs import NoTranslate
+from plcopen.XSLTModelQuery import XSLTModelQuery from graphics.GraphicCommons import *
from PLCGenerator import *
@@ -267,33 +268,6 @@
[_BoolValue] * 2, args) + [[]])))
-class XSLTModelQuery(object):
- """ a class to handle XSLT queries on project and libs """
- def __init__(self, controller, xsltpath, ext = []):
- # arbitrary set debug to false, updated later
- # merge xslt extensions for library access to query specific ones
- ("GetProject", lambda *_ignored:
- controller.GetProject(self.debug)),
- ("GetStdLibs", lambda *_ignored:
- [lib for lib in StdBlckLibs.values()]),
- ("GetExtensions", lambda *_ignored:
- [ctn["types"] for ctn in controller.ConfNodeTypes])
- # parse and compile. "beremiz" arbitrary namespace for extensions
- self.xslt = etree.XSLT(
- os.path.join(ScriptDirectory, "plcopen", xsltpath),
- extensions={ ("beremiz", name):call for name, call in xsltext})
- def _process_xslt(self, root, debug, **kwargs):
- return self.xslt(root,**{k:etree.XSLT.strparam(v) for k,v in kwargs.iteritems()})
class InstancesPathCollector(XSLTModelQuery):
""" object for collecting instances path list"""
def __init__(self, controller):
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/plcopen/XSLTModelQuery.py Fri Feb 16 18:24:55 2018 +0100
@@ -0,0 +1,39 @@
+# This file is part of Beremiz. +# See COPYING file for copyrights details. +from __future__ import absolute_import +import util.paths as paths +from plcopen.structures import StdBlckLibs +ScriptDirectory = paths.AbsDir(__file__) +class XSLTModelQuery(object): + """ a class to handle XSLT queries on project and libs """ + def __init__(self, controller, xsltpath, ext = []): + # arbitrary set debug to false, updated later + # merge xslt extensions for library access to query specific ones + ("GetProject", lambda *_ignored: + controller.GetProject(self.debug)), + ("GetStdLibs", lambda *_ignored: + [lib for lib in StdBlckLibs.values()]), + ("GetExtensions", lambda *_ignored: + [ctn["types"] for ctn in controller.ConfNodeTypes]) + # parse and compile. "beremiz" arbitrary namespace for extensions + self.xslt = etree.XSLT( + os.path.join(ScriptDirectory, xsltpath), + extensions={ ("beremiz", name):call for name, call in xsltext}) + def _process_xslt(self, root, debug, **kwargs): + return self.xslt(root,**{k:etree.XSLT.strparam(v) for k,v in kwargs.iteritems()})