MCPcopy Create free account
hub / github.com/Kitware/VTK / vtkCustomObject

Class vtkCustomObject

Common/Core/Testing/Python/TestSubClass.py:30–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28from vtkmodules.test import Testing
29
30class vtkCustomObject(vtkObject):
31 def __init__(self, extra=None):
32 """Initialize all attributes."""
33 if extra is None:
34 extra = vtkObject()
35 self._ExtraObject = extra
36
37 def GetClassName(self):
38 """Get the class name."""
39 return self.__class__.__name__
40
41 def GetExtraObject(self):
42 """Getter method."""
43 return self._ExtraObject
44
45 def SetExtraObject(self, o):
46 """Setter method."""
47 # make sure it is "None" or a vtkobject instance
48 if o == None or isinstance(o, vtkObjectBase):
49 self._ExtraObject = o
50 self.Modified()
51 else:
52 raise TypeError("requires None or a vtkobject")
53
54 def GetMTime(self):
55 """Override a method (only works when called from Python)"""
56 t = vtkObject.GetMTime(self)
57 if self._ExtraObject:
58 t = max(t, self._ExtraObject.GetMTime())
59 return t
60
61class vtkPointsCustom(vtkPoints):
62 def __init__(self):

Callers 5

testConstructorArgsMethod · 0.70
testPythonRTTIMethod · 0.70
testSubclassGhostMethod · 0.70

Calls

no outgoing calls

Tested by 5

testConstructorArgsMethod · 0.56
testPythonRTTIMethod · 0.56
testSubclassGhostMethod · 0.56