Ticket #37410: vtk510_text.patch

File vtk510_text.patch, 2.7 KB (added by jjstickel (Jonathan Stickel), 12 years ago)
  • mayavi/modules/text.py

    From 15b0774659932596dab27363fa8eefdb855fda8f Mon Sep 17 00:00:00 2001
    From: "mluessi@nmr.mgh.harvard.edu" <mluessi@nmr.mgh.harvard.edu>
    Date: Mon, 9 Jul 2012 17:48:20 -0400
    Subject: [PATCH] FIX: version comp. for VTK 5.10
    
    ---
     mayavi/modules/text.py |    8 +++++---
     tvtk/tools/mlab.py     |    5 +++--
     2 files changed, 8 insertions(+), 5 deletions(-)
    
    diff --git a/mayavi/modules/text.py b/mayavi/modules/text.py
    index 1fcc0e0..d1c79c0 100644
    a b  
    55# Copyright (c) 2005, Enthought, Inc.
    66# License: BSD Style.
    77
     8from distutils.version import StrictVersion
     9
    810# Enthought library imports.
    911from traits.api import Instance, Range, Str, Bool, Property, \
    1012                                    Float
     
    1618from mayavi.core.module import Module
    1719from mayavi.core.pipeline_info import PipelineInfo
    1820
    19 VTK_VER = float(tvtk.Version().vtk_version[:3])
     21VTK_VER = StrictVersion(tvtk.Version().vtk_version)
    2022
    2123
    2224######################################################################
    class Text(Module): 
    6870    ########################################
    6971    # The view of this object.
    7072
    71     if VTK_VER > 5.1:
     73    if VTK_VER > '5.1':
    7274        _text_actor_group = Group(Item(name='visibility'),
    7375                                  Item(name='text_scale_mode'),
    7476                                  Item(name='alignment_point'),
    def setup_pipeline(self): 
    152154        set the `actors` attribute up at this point.
    153155        """
    154156        actor = self.actor = tvtk.TextActor(input=str(self.text))
    155         if VTK_VER > 5.1:
     157        if VTK_VER > '5.1':
    156158            actor.set(text_scale_mode='prop', width=0.4, height=1.0)
    157159        else:
    158160            actor.set(scaled_text=True, width=0.4, height=1.0)
  • tvtk/tools/mlab.py

    diff --git a/tvtk/tools/mlab.py b/tvtk/tools/mlab.py
    index 8262da0..dfe9230 100644
    a b  
    9292# Copyright (c) 2005-2007, Enthought, Inc.
    9393# License: BSD Style.
    9494
     95from distutils.version import StrictVersion
    9596
    9697import numpy
    9798
     
    107108# Set this to False to not use LOD Actors.
    108109USE_LOD_ACTOR = True
    109110
    110 VTK_VER = float(tvtk.Version().vtk_version[:3])
     111VTK_VER = StrictVersion(tvtk.Version().vtk_version)
    111112
    112113######################################################################
    113114# Utility functions.
    def __init__(self, **traits): 
    639640        super(Title, self).__init__(**traits)
    640641
    641642        ta = self.text_actor
    642         if VTK_VER > 5.1:
     643        if VTK_VER > '5.1':
    643644            ta.set(text_scale_mode='prop', height=0.05, input=self.text)
    644645        else:
    645646            ta.set(scaled_text=True, height=0.05, input=self.text)