plcopen/InstanceTagnameCollector.py
changeset 1953 5736d25bb393
parent 1952 0c20fc810d61
child 3750 f62625418bff
equal deleted inserted replaced
1952:0c20fc810d61 1953:5736d25bb393
     2 # -*- coding: utf-8 -*-
     2 # -*- coding: utf-8 -*-
     3 # This file is part of Beremiz.
     3 # This file is part of Beremiz.
     4 # See COPYING file for copyrights details.
     4 # See COPYING file for copyrights details.
     5 
     5 
     6 from __future__ import absolute_import
     6 from __future__ import absolute_import
     7 from plcopen.XSLTModelQuery import XSLTModelQuery 
     7 from plcopen.XSLTModelQuery import XSLTModelQuery
     8 from plcopen.types_enums import *
     8 from plcopen.types_enums import *
       
     9 
     9 
    10 
    10 class InstanceTagName(object):
    11 class InstanceTagName(object):
    11     """Helpers object for generating instance tagname"""
    12     """Helpers object for generating instance tagname"""
    12 
    13 
    13     def __init__(self):
    14     def __init__(self):
    36     """ object for collecting instances path list"""
    37     """ object for collecting instances path list"""
    37     def __init__(self, controller):
    38     def __init__(self, controller):
    38         XSLTModelQuery.__init__(self,
    39         XSLTModelQuery.__init__(self,
    39                                 controller,
    40                                 controller,
    40                                 "instance_tagname.xslt",
    41                                 "instance_tagname.xslt",
    41                                 [(name, self.FactoryCaller(name)) 
    42                                 [(name, self.FactoryCaller(name))
    42                                     for name in ["ConfigTagName",
    43                                  for name in ["ConfigTagName",
    43                                                  "ResourceTagName",
    44                                               "ResourceTagName",
    44                                                  "PouTagName",
    45                                               "PouTagName",
    45                                                  "ActionTagName",
    46                                               "ActionTagName",
    46                                                  "TransitionTagName"]])
    47                                               "TransitionTagName"]])
    47 
    48 
    48     def FactoryCaller(self, funcname):
    49     def FactoryCaller(self, funcname):
    49         def CallFactory(*args):
    50         def CallFactory(*args):
    50             return getattr(self.factory, funcname)(*args)
    51             return getattr(self.factory, funcname)(*args)
    51         return CallFactory
    52         return CallFactory