def _full_screen_fired(self): fs = self._fullscreen if isinstance(fs, PopupScene): fs.close() self._fullscreen = None elif fs is None: ver = tvtk.Version() popup = False if wx.Platform == '__WXMSW__': popup = True elif ver.vtk_major_version > 5: popup = True elif (ver.vtk_major_version == 5) and \ ((ver.vtk_minor_version >= 1) or \ (ver.vtk_build_version > 2)): popup = True if popup: # There is a bug with earlier versions of VTK that # breaks reparenting a window which is why we test for # the version above. f = PopupScene(self) self._fullscreen = f f.fullscreen() else: f = FullScreen(self) f.run() # This will block. self._fullscreen = None
import numpy from enthought.traits.api import HasTraits, List, Instance, Any, Float, Bool, \ Str, Trait, Int from enthought.pyface.api import GUI from enthought.tvtk.api import tvtk from enthought.tvtk.tvtk_base import TVTKBase, vtk_color_trait from enthought.tvtk.tools import ivtk # Set this to False to not use LOD Actors. USE_LOD_ACTOR = True VTK_VER = float(tvtk.Version().vtk_version[:3]) ###################################################################### # Utility functions. ###################################################################### def _make_actor(**kwargs): """Return a TVTK actor. If `mlab.USE_LOD_ACTOR` is `True` it returns an LODActor if not it returns a normal actor. """ if USE_LOD_ACTOR: r = tvtk.LODActor(number_of_cloud_points=1500) r.property.point_size = 2.0 r.set(**kwargs) return r else:
""" An object to register callbacks and dispatch event wiring mouse clicks on a scene to picking. """ # ETS imports from enthought.traits.api import HasTraits, Dict, Instance, \ Enum, Int, Callable, on_trait_change, List, Tuple from enthought.mayavi.core.scene import Scene from enthought.tvtk.api import tvtk VTK_VERSION = tvtk.Version().vtk_major_version \ + .1*tvtk.Version().vtk_minor_version ################################################################################ # class `MousePickDispatcher` ################################################################################ class MousePickDispatcher(HasTraits): """ An event dispatcher to send pick event on mouse clicks. This objects wires VTK observers so that picking callbacks can be bound to mouse click without movement. The object deals with adding and removing the VTK-level callbacks. """ # The scene events are wired to. scene = Instance(Scene)
"""A component to manage an implicit plane widget. """ # Author: Prabhu Ramachandran <*****@*****.**> # Copyright (c) 2005, Enthought, Inc. # License: BSD Style. # Enthought library imports. from enthought.traits.api import Instance, Bool, Property from enthought.traits.ui.api import View, Group, Item, InstanceEditor from enthought.tvtk.api import tvtk # Local imports. from enthought.mayavi.core.component import Component VTK_VER = tvtk.Version().vtk_version ###################################################################### # `ImplicitPlane` class. ###################################################################### class ImplicitPlane(Component): # The version of this class. Used for persistence. __version__ = 0 # The widget that controls the plane. widget = Instance(tvtk.ImplicitPlaneWidget, args=(), kw={ 'key_press_activation': False, 'place_factor': 1.2, 'draw_plane': False,