~ubuntu-branches/ubuntu/precise/mayavi2/precise

« back to all changes in this revision

Viewing changes to enthought/mayavi/core/off_screen_engine.py

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2011-07-09 01:18:36 UTC
  • mfrom: (1.1.10 upstream) (2.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110709011836-fha21zirlgkqh92s
Tags: 4.0.0-1
* New upstream release
* debian/control:
  - Bump Standards-Version to 3.9.2
  - Set X-Python-Version: 2.6, fixes FTBFS (Closes: #625148)
  - Update Depends
* Update debian/watch file
* Cleanup debian/rules file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""
2
 
An off-screen mayavi engine.
3
 
"""
4
 
# Author: Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
5
 
# Copyright (c) 2008, Enthought, Inc.
6
 
# License: BSD Style.
7
 
 
8
 
from enthought.traits.api import Callable, Str
9
 
from enthought.tvtk.pyface.tvtk_scene import TVTKWindow
10
 
from enthought.mayavi.core.engine import Engine
11
 
from enthought.mayavi.preferences.api import set_scene_preferences 
12
 
 
13
 
 
14
 
def off_screen_viewer_factory(size=(400, 350)):
15
 
    """A factory that creates an offscreen viewer."""
16
 
    win = TVTKWindow(off_screen_rendering=True)
17
 
    # Set all preferences.
18
 
    set_scene_preferences(win.scene)
19
 
    # Set the size.
20
 
    win.scene.set_size(size)
21
 
    return win
22
 
 
23
 
################################################################################
24
 
# `OffScreenEngine` class.
25
 
################################################################################ 
26
 
class OffScreenEngine(Engine):
27
 
    # Overriding the scene factory trait of Engine.
28
 
    scene_factory = Callable(off_screen_viewer_factory)
29
 
 
30
 
    # Our name.
31
 
    name = Str('Mayavi offscreen Engine')