Ticket #47762: mayavi_vtk62_191.diff

File mayavi_vtk62_191.diff, 3.9 KB (added by jjstickel (Jonathan Stickel), 9 years ago)
  • tvtk/common.py

    diff --git a/tvtk/common.py b/tvtk/common.py
    index 77a141d..f6f704a 100644
    a b  
    1111import vtk
    1212
    1313vtk_major_version = vtk.vtkVersion.GetVTKMajorVersion()
     14vtk_minor_version = vtk.vtkVersion.GetVTKMinorVersion()
    1415
    1516######################################################################
    1617# Utility functions.
    def get_tvtk_name(vtk_name): 
    4647def is_old_pipeline():
    4748    return vtk_major_version < 6
    4849
     50def is_version_62():
     51    return vtk_major_version == 6 and vtk_minor_version == 2
     52
    4953def configure_connection(obj, inp):
    5054    """ Configure topology for vtk pipeline obj."""
    5155    if hasattr(inp, 'output_port'):
  • tvtk/tests/test_vtk_parser.py

    diff --git a/tvtk/tests/test_vtk_parser.py b/tvtk/tests/test_vtk_parser.py
    index 8a4f31e..28a8c4d 100644
    a b def test_parse(self): 
    136136
    137137        res = ['BackfaceRender', 'DeepCopy', 'Render']
    138138        if hasattr(obj, 'GetTexture'):
    139             if vtk_major_version == 6 and vtk_minor_version >= 1:
     139            if vtk_major_version == 6:
    140140                res = ['AddShaderVariable', 'BackfaceRender', 'DeepCopy',
    141                        'ReleaseGraphicsResources', 'RemoveAllTextures', 'RemoveTexture',
    142                        'Render']
     141                       'ReleaseGraphicsResources', 'RemoveAllTextures',
     142                       'RemoveTexture', 'Render']
     143                if vtk_minor_version == 2:
     144                    res.append('VTKTextureUnit')
    143145            else:
    144146                res = ['AddShaderVariable', 'BackfaceRender', 'DeepCopy',
    145147                       'LoadMaterial', 'LoadMaterialFromString',
  • tvtk/vtk_parser.py

    diff --git a/tvtk/vtk_parser.py b/tvtk/vtk_parser.py
    index c5407bc..0ffec78 100644
    a b  
    77# License: BSD Style.
    88
    99import re
     10import types
    1011
    1112# Local imports (these are relative imports for a good reason).
    1213import class_tree
    1314import vtk_module as vtk
    14 
     15from common import is_version_62
    1516
    1617class VTKMethodParser:
    1718    """This class provides useful methods for parsing methods of a VTK
    def get_method_signature(self, method): 
    299300          A VTK method object.
    300301
    301302        """
     303        # VTK 6.2 false built in funcs/methods are ignored
     304        if is_version_62():
     305            built_in_func = isinstance(method, types.BuiltinFunctionType)
     306            built_in_meth = isinstance(method, types.BuiltinMethodType)
     307            if not (built_in_func or built_in_meth):
     308                return None
    302309        # Remove all the C++ function signatures.
    303310        doc = method.__doc__
    304311        doc = doc[:doc.find('\n\n')]
  • tvtk/wrapper_gen.py

    diff --git a/tvtk/wrapper_gen.py b/tvtk/wrapper_gen.py
    index ed4b4d2..7936a87 100644
    a b  
    1616
    1717# Local imports (these are relative imports because the package is not
    1818# installed when these modules are imported).
    19 from common import get_tvtk_name, camel2enthought
     19from common import get_tvtk_name, camel2enthought, is_version_62
    2020import vtk_parser
    2121import indenter
    2222import special_gen
    def _gen_other_methods(self, klass, out): 
    744744            vtk_meth = getattr(klass, m)
    745745            self._write_tvtk_method(out, vtk_meth)
    746746
     747
    747748    #################################################################
    748749    # Private utility methods.
    749750    #################################################################
    def _write_tvtk_method(self, out, vtk_meth, sig=None): 
    10421043          If None, this is computed.  If not, the passed signature
    10431044          information is used.
    10441045        """
    1045         if not sig:
     1046        if sig is None:
    10461047            sig = self.parser.get_method_signature(vtk_meth)
     1048       
     1049        # VTK 6.2: There exists no method signature for false built in
     1050        # functions/methods
     1051        if sig is None:
     1052            return
    10471053
    10481054        # Figure out if we really need to wrap the return and deref
    10491055        # the args.