Python scripting - Technology operators

CENPyOlpTech_AttribChangedOperator

Previous  Chapter  Next

 

The object of the CENPyOlpTech_AttribChangedOperator class is passed to the PostTechOnAttribChanged callback as a parameter.

It can be used to obtain the required operators within the scope of the PostTechOnAttribChanged callback in the %TechnologyName%.py script file, located in the folder of the plugin.

 

[Example]

 

def PostTechOnAttribChanged(techAttribChangedOperator):

   pass

 

 

Methods

 

GetAttribGetter()

 

o

return

Object of CENPyOlpAttribGetter class

 

This operator gives the possibility to find attribute and get their values.

 

[Example]

   attribGetter = techAttribChangedOperator.GetAttribGetter()

 


 

GetAttribSetter()

 

o

return

Object of CENPyOlpAttribSetter class

 

This operator gives the possibility to change attribute values.

 

[Example]

   attribSetter = techAttribChangedOperator.GetAttribSetter()

 


 

GetLoggerOperator()

 

o

return

Object of CENPyOlpLogOperator class

 

This operator gives the possibility to log issues resulting by user input.

 

[Example]

   logOperator = techAttribChangedOperator.GetLoggerOperator()

 


 

GetController()

 

o

return

Object of CENPyOlpController class

 

This method returns the assigned controller.

 

[Example]

   controller = techAttribChangedOperator.GetController()

 


 

 Method is deprecated, consider using GetChangedAttributeName()

 

GetChangedAttribute()

 

o

return

Object of CENPyOlpAttribute class

 

 This method returns the changed attribute which rises OnAttribChanged callback.

 

[Example]

   changedAttrib = techAttribChangedOperator.GetChangedAttribute()

 


 

GetChangedAttributeName()

 

o

return

name of the changed attribute

 

This method returns the name of changed attribute which rises OnAttribChanged callback.

 

[Example]

def PostOnAttribChanged(Operator):

   logging = Operator.GetLoggerOperator()

   logging.LogInfo(FILE_NAME +" GetChangedAttributeName:"+ Operator.GetChangedAttributeName())

 


 

GetChangedComponent()

 

o

return

Object of CENPyOlpProgramComponent class that contain changed attribute, can be program, operation group or operation.

 

This method returns the object of the container on which the attribute change happened.

 

[Example]

See example for GetOperatorForComponent below.

 


 

GetOperatorForComponent(prgComponent: CENPyOlpProgramComponent) : CENPyOlpTech_AttribChangedOperator

 

o

prgComponent

program component to get an operator for it

 

o

return

Object of CENPyOlpTech_AttribChangedOperator class that represents attribute change operator for program, operation group or operation.

 

This method returns object of the container on which the attribute change happened.

 

[Example]

# Code shows how to propagate attribute values from Program level to Operation level

# get attribute getter and setter

def PostTechOnAttribChanged(Operator):

    attribGetter = Operator.GetAttribGetter()

    attribSetter = Operator.GetAttribSetter()  

    # get the changed attribute name and check if we have to do something

    changedAttribute = Operator.GetChangedAttribute()

    changedAttributeName = changedAttribute.GetName()

    if (changedAttribute.GetName() == "TestMaster"):        

        intAttrib = attribGetter.GetAttributeIntegerByName("TestMaster")

        if intAttrib != None:

            program = Operator.GetChangedComponent()

            if program.GetType() == OLPPROGRAMCOMPONENTTYPE_PROGRAM:

                groupComponents = program.GetChildComponents()

                for groupComponent in groupComponents:

                    if (groupComponent.GetType() == OLPPROGRAMCOMPONENTTYPE_OPERATIONGROUP):

                        operationComponents = groupComponent.GetChildComponents()

                        for operationComponent in operationComponents:

                            if (operationComponent.GetType() == OLPPROGRAMCOMPONENTTYPE_OPERATION):

                                componentOperator = Operator.GetOperatorForComponent(operationComponent)

                                componentAttribSetter = componentOperator.GetAttribSetter()

                                componentAttribSetter.SetInteger("TestSubscriber", intAttrib.GetValue())

 


 


Previous
Previous page
Chapter
Chapter page
Next
Next page