vtkmodules.util.misc#

Miscellaneous functions and classes that don’t fit into specific categories.

Module Contents#

Functions#

deprecated

Decorator to mark functions as deprecated. When the decorated function is called, a DeprecationWarning is issued with the provided message.

calldata_type

set_call_data_type(type) – convenience decorator to easily set the CallDataType attribute for python function used as observer callback. For example:

vtkGetDataRoot

vtkGetDataRoot() – return vtk example data directory

vtkGetTempDir

vtkGetTempDir() – return vtk testing temp dir

vtkRegressionTestImage

vtkRegressionTestImage(renWin) – produce regression image for window

API#

vtkmodules.util.misc.deprecated(version, message)#

Decorator to mark functions as deprecated. When the decorated function is called, a DeprecationWarning is issued with the provided message.

Example

@deprecated(version=1.2, message=”Use ‘new_function’ instead.”) … def old_function(): … pass

old_function() DeprecationWarning: Function ‘old_function’ is deprecated since 1.2. Use ‘new_function’ instead.

Note you can filter warning messages, see: https://docs.python.org/3/library/warnings.html#describing-warning-filters

vtkmodules.util.misc.calldata_type(type)#

set_call_data_type(type) – convenience decorator to easily set the CallDataType attribute for python function used as observer callback. For example:

import vtkmodules.util.calldata_type import vtkmodules.util.vtkConstants import vtkmodules.vtkCommonCore import vtkCommand, vtkLookupTable

@calldata_type(vtkConstants.VTK_STRING) def onError(caller, event, calldata): print(“caller: %s - event: %s - msg: %s” % (caller.GetClassName(), event, calldata))

lt = vtkLookupTable() lt.AddObserver(vtkCommand.ErrorEvent, onError) lt.SetTableRange(2,1)

vtkmodules.util.misc.vtkGetDataRoot()#

vtkGetDataRoot() – return vtk example data directory

vtkmodules.util.misc.vtkGetTempDir()#

vtkGetTempDir() – return vtk testing temp dir

vtkmodules.util.misc.vtkRegressionTestImage(renWin)#

vtkRegressionTestImage(renWin) – produce regression image for window

This function writes out a regression .png file for a vtkWindow. Does anyone involved in testing care to elaborate?