def main(): """This starts up the mayavi2 application. """ global mayavi # Make sure '.' is in sys.path if '' not in sys.path: sys.path.insert(0, '') # Start the app. if OFFSCREEN: mayavi = MayaviOffscreen() else: from enthought.etsconfig.api import ETSConfig # Check that we have a traits backend installed from enthought.traits.ui.toolkit import toolkit toolkit() # This forces the selection of a toolkit. if ETSConfig.toolkit in ('null', ''): raise ImportError, '''Could not import backend for traits ________________________________________________________________________________ Make sure that you have either the TraitsBackendWx or the TraitsBackendQt projects installed. If you installed Mayavi with easy_install, try easy_install <pkg_name>. easy_install Mayavi[app] will also work. If you performed a source checkout, be sure to run 'python setup.py install' in Traits, TraitsGUI, and the Traits backend of your choice. Also make sure that either wxPython or PyQT is installed. wxPython: http://www.wxpython.org/ PyQT: http://www.riverbankcomputing.co.uk/software/pyqt/intro ''' mayavi = MayaviApp() mayavi.main(sys.argv[1:])
def check_backend(): """ Check if either we are in test mode, or if there is a suitable traits backend installed. """ from enthought.traits.ui.toolkit import toolkit from enthought.etsconfig.api import ETSConfig from enthought.mayavi.tools.engine_manager import options toolkit() # This forces the selection of a toolkit. if (options.backend != 'test' and options.offscreen != True) and \ ETSConfig.toolkit in ('null', ''): raise ImportError, '''Could not import backend for traits
def _height_default ( self ): if self.volume is None: return 0 image = self.volume.image_resource( self.image_name ) if image is None: self.width = 0 return 0 self.width, height = toolkit().image_size( image.create_image() ) return height