ModelListener (hwx.inspire.core)

Listens to the data model for object creation, modification and deletion.

Public Methods

activateModelListener (self, *typesOrObjects)
deactivateModelListener (self)
isModelListenerActive (self)
modelListenerInactive (self)
onObjectCreated (self, obj)
onObjectDeleted (self, obj)
onObjectModified (self, obj, attr)

Method Details

activateModelListener(self, *typesOrObjects)

Activates or start listening to the data model and call the handlers, when the specified types are created, destroyed or modified.

param *typesOrObjects:
 Types or objects to listen to. Sub classes of Named (Features are not supported).
type *typesOrObjects:
 Part, BC, Motor, …
deactivateModelListener(self)

Stops listening for data model changes.

isModelListenerActive(self)

Returns, True if the model listener is active else False.

modelListenerInactive(self)

Context to temporarily disable all the callbacks.

onObjectCreated(self, obj)

Callback method when an object is created.

Reimplement if interested when an object is created.

param obj:Object that got created. Sub classes of Named (Features are not supported).
type obj:Part, BC, Motor, …
onObjectDeleted(self, obj)

Callback method when an object is deleted or destroyed..

Reimplement if interested when an object is destroyed.

param obj:Object that got destroyed. Sub classes of Named (Features are not supported).
type obj:Part, BC, Motor, …
onObjectModified(self, obj, attr)

Callback method when an object is modified.

Reimplement if interested when an object’s attribute is modified.

param obj:Object whose attribute got modified. Sub classes of Named (Features are not supported).
type obj:Part, BC, Motor, …
param attr:Attribute in the object that got modified. attr can be location, mass, name, …
type attr:str