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
|
|
5 | 5 | # Copyright (c) 2005, Enthought, Inc. |
6 | 6 | # License: BSD Style. |
7 | 7 | |
| 8 | from distutils.version import StrictVersion |
| 9 | |
8 | 10 | # Enthought library imports. |
9 | 11 | from traits.api import Instance, Range, Str, Bool, Property, \ |
10 | 12 | Float |
… |
… |
|
16 | 18 | from mayavi.core.module import Module |
17 | 19 | from mayavi.core.pipeline_info import PipelineInfo |
18 | 20 | |
19 | | VTK_VER = float(tvtk.Version().vtk_version[:3]) |
| 21 | VTK_VER = StrictVersion(tvtk.Version().vtk_version) |
20 | 22 | |
21 | 23 | |
22 | 24 | ###################################################################### |
… |
… |
class Text(Module): |
68 | 70 | ######################################## |
69 | 71 | # The view of this object. |
70 | 72 | |
71 | | if VTK_VER > 5.1: |
| 73 | if VTK_VER > '5.1': |
72 | 74 | _text_actor_group = Group(Item(name='visibility'), |
73 | 75 | Item(name='text_scale_mode'), |
74 | 76 | Item(name='alignment_point'), |
… |
… |
def setup_pipeline(self): |
152 | 154 | set the `actors` attribute up at this point. |
153 | 155 | """ |
154 | 156 | actor = self.actor = tvtk.TextActor(input=str(self.text)) |
155 | | if VTK_VER > 5.1: |
| 157 | if VTK_VER > '5.1': |
156 | 158 | actor.set(text_scale_mode='prop', width=0.4, height=1.0) |
157 | 159 | else: |
158 | 160 | actor.set(scaled_text=True, width=0.4, height=1.0) |
diff --git a/tvtk/tools/mlab.py b/tvtk/tools/mlab.py
index 8262da0..dfe9230 100644
a
|
b
|
|
92 | 92 | # Copyright (c) 2005-2007, Enthought, Inc. |
93 | 93 | # License: BSD Style. |
94 | 94 | |
| 95 | from distutils.version import StrictVersion |
95 | 96 | |
96 | 97 | import numpy |
97 | 98 | |
… |
… |
|
107 | 108 | # Set this to False to not use LOD Actors. |
108 | 109 | USE_LOD_ACTOR = True |
109 | 110 | |
110 | | VTK_VER = float(tvtk.Version().vtk_version[:3]) |
| 111 | VTK_VER = StrictVersion(tvtk.Version().vtk_version) |
111 | 112 | |
112 | 113 | ###################################################################### |
113 | 114 | # Utility functions. |
… |
… |
def __init__(self, **traits): |
639 | 640 | super(Title, self).__init__(**traits) |
640 | 641 | |
641 | 642 | ta = self.text_actor |
642 | | if VTK_VER > 5.1: |
| 643 | if VTK_VER > '5.1': |
643 | 644 | ta.set(text_scale_mode='prop', height=0.05, input=self.text) |
644 | 645 | else: |
645 | 646 | ta.set(scaled_text=True, height=0.05, input=self.text) |