plcopen/InstancesPathCollector.py
author GP Orcullo <kinsamanka@gmail.com>
Fri, 28 Oct 2022 12:39:15 +0800
branchpython3
changeset 3750 f62625418bff
parent 1953 5736d25bb393
child 3751 a80a66ba52d6
permissions -rw-r--r--
automated conversion using 2to3-3.9 tool

cmd used: 2to3-3.9 -w <file>
1942
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     1
#!/usr/bin/env python
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     3
# This file is part of Beremiz.
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     4
# See COPYING file for copyrights details.
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
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: 1953
diff changeset
     6
1942
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     7
from plcopen.XSLTModelQuery import XSLTModelQuery
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
     8
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1942
diff changeset
     9
1942
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    10
class InstancesPathCollector(XSLTModelQuery):
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    11
    """ object for collecting instances path list"""
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    12
    def __init__(self, controller):
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    13
        self.Instances = []
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    14
        XSLTModelQuery.__init__(self,
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    15
                                controller,
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    16
                                "instances_path.xslt",
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    17
                                [("AddInstance", self.AddInstance)])
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    18
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    19
    def AddInstance(self, context, *args):
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    20
        self.Instances.append(args[0][0])
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    21
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    22
    def Collect(self, root, name, debug):
1953
5736d25bb393 PEP8 and PyLint conformance: whitespaces and stuff
Edouard Tisserant
parents: 1942
diff changeset
    23
        self._process_xslt(root, debug, instance_type=name)
1942
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    24
        res = self.Instances
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    25
        self.Instances = []
a4382ae1ba82 Added /plcopen/InstancesPathCollector.py, to move more model xslt querying code away from PLCController.py.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
diff changeset
    26
        return res