Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
VTK
VTK
Commits
b41ca4b6
Commit
b41ca4b6
authored
May 06, 2010
by
David Gobbi
Committed by
Marcus D. Hanwell
Jun 16, 2010
Browse files
STYLE: remove tabs, trailing whitespace
parent
9cf2fa28
Changes
32
Hide whitespace changes
Inline
Side-by-side
Wrapping/Python/CMakeLists.txt
View file @
b41ca4b6
...
...
@@ -54,10 +54,10 @@ IF (APPLE)
ENDIF
(
APPLE
)
# Link against all the kit wrappers.
SET
(
VTKPYTHON_LINK_LIBS
${
VTK_PYTHON_LIBRARIES
}
SET
(
VTKPYTHON_LINK_LIBS
${
VTK_PYTHON_LIBRARIES
}
vtksys
vtkCommon
vtkCommon
vtkFiltering
vtkIO
vtkGraphics
...
...
@@ -108,10 +108,10 @@ IF(PYTHON_UTIL_LIBRARY)
ENDIF
(
PYTHON_UTIL_LIBRARY
)
IF
(
VTK_USE_RENDERING
)
SET
(
VTKPYTHON_LINK_LIBS
${
VTKPYTHON_LINK_LIBS
}
vtkRendering
vtkVolumeRendering
vtkHybrid
SET
(
VTKPYTHON_LINK_LIBS
${
VTKPYTHON_LINK_LIBS
}
vtkRendering
vtkVolumeRendering
vtkHybrid
vtkWidgets
)
SET
(
vtkpython_pyc_depends
${
vtkpython_pyc_depends
}
...
...
@@ -203,14 +203,14 @@ SET_TARGET_PROPERTIES(vtkpython PROPERTIES LINK_FLAGS "${VTKPYTHON_LINK_FLAGS}")
SET
(
PVTKPYTHON_EXECUTABLE
)
# Create the pvtkpython Python wrapper executable with MPI support.
IF
(
VTK_USE_PARALLEL AND VTK_USE_MPI
)
IF
(
MPI_LIBRARY
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARY
}
)
ENDIF
(
MPI_LIBRARY
)
IF
(
MPI_EXTRA_LIBRARY
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARIES
}
"
${
MPI_EXTRA_LIBRARY
}
"
)
ENDIF
(
MPI_EXTRA_LIBRARY
)
IF
(
MPI_LIBRARY
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARY
}
)
ENDIF
(
MPI_LIBRARY
)
IF
(
MPI_EXTRA_LIBRARY
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARIES
}
"
${
MPI_EXTRA_LIBRARY
}
"
)
ENDIF
(
MPI_EXTRA_LIBRARY
)
IF
(
VTK_USE_PARALLEL_BGL
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARIES
}
"
${
Boost_LIBRARIES
}
"
)
SET
(
MPI_LIBRARIES
${
MPI_LIBRARIES
}
"
${
Boost_LIBRARIES
}
"
)
ENDIF
(
VTK_USE_PARALLEL_BGL
)
...
...
@@ -257,7 +257,7 @@ IF(PYTHON_EXECUTABLE)
# Now create a list of Python files.
# Wrapping/Python/vtk/*.py
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
vtk/__helper
vtk/__init__
vtk/common
...
...
@@ -280,7 +280,7 @@ IF(PYTHON_EXECUTABLE)
)
# vtk.util package
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/util/__init__
vtk/util/vtkMethodParser
...
...
@@ -293,7 +293,7 @@ IF(PYTHON_EXECUTABLE)
)
# vtk.test package
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/test/BlackBox
vtk/test/Testing
...
...
@@ -301,7 +301,7 @@ IF(PYTHON_EXECUTABLE)
)
# Tk related files
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/tk/__init__
vtk/tk/vtkLoadPythonTkWidgets
...
...
@@ -312,7 +312,7 @@ IF(PYTHON_EXECUTABLE)
)
# PyQt v3 related files
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/qt/QVTKRenderWidget
vtk/qt/__init__
...
...
@@ -320,14 +320,14 @@ IF(PYTHON_EXECUTABLE)
)
# PyQt v4 related files
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/qt4/__init__
vtk/qt4/QVTKRenderWindowInteractor
)
# wxPython related files
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/wx/__init__
vtk/wx/wxVTKRenderWindow
...
...
@@ -335,7 +335,7 @@ IF(PYTHON_EXECUTABLE)
)
# pyGTK related files
SET
(
VTK_PYTHON_FILES
SET
(
VTK_PYTHON_FILES
${
VTK_PYTHON_FILES
}
vtk/gtk/GtkVTKRenderWindow
vtk/gtk/__init__
...
...
@@ -394,7 +394,7 @@ IF(PYTHON_EXECUTABLE)
# this should also depend on the vtkpython executable.
ADD_CUSTOM_TARGET
(
vtkpython_pyc ALL echo
"..."
DEPENDS
"
${
VTK_BINARY_DIR
}
/Wrapping/Python/vtk_compile_complete"
)
ADD_DEPENDENCIES
(
vtkpython_pyc
ADD_DEPENDENCIES
(
vtkpython_pyc
vtkpython
${
vtkpython_pyc_depends
}
)
...
...
@@ -403,7 +403,7 @@ IF(PYTHON_EXECUTABLE)
SET
(
VTK_INSTALL_NO_PYTHON 1
)
ENDIF
(
VTK_INSTALL_NO_RUNTIME
)
# If set (generally by projects that include VTK), we install the
# If set (generally by projects that include VTK), we install the
# vtk{*}Python libraries using CMake rather than setup.py. Which implies that
# they will be put will all other libraries. This is done in
# KitCommonPythonWrapBlock.cmake
...
...
@@ -414,7 +414,7 @@ IF(PYTHON_EXECUTABLE)
# Add a rule to use python distutils to install the python wrappers.
IF
(
NOT VTK_INSTALL_NO_PYTHON
)
SET
(
DOLLAR
"$"
)
# Create default python setup arguments if they are not set.
IF
(
NOT DEFINED VTK_PYTHON_SETUP_ARGS
)
SET
(
VTK_PYTHON_SETUP_ARGS
"--prefix=
\"
${
DOLLAR
}
{CMAKE_INSTALL_PREFIX}
\"
"
...
...
Wrapping/Python/README.txt
View file @
b41ca4b6
...
...
@@ -84,7 +84,7 @@ modules.
`VTK_ROOT` directory. To install VTK built from source you
simply need to run the "install rule". Under Unix this
implies running `make install` and under Windows this implies
running the INSTALL target.
running the INSTALL target.
The installation rule internally executes the
``VTK_BINARY_DIR/Wrapping/Python/setup.py`` script.
...
...
@@ -92,7 +92,7 @@ modules.
VTK-Python correctly. The `setup.py` script may also be
executed from the `VTK_BINARY_DIR` in order to build an
installer (via `bdist_wininst`) or to build a Python Egg.
VTK-Python interpreters
^^^^^^^^^^^^^^^^^^^^^^^
...
...
@@ -105,7 +105,7 @@ Python interpreter is good enough and works well for you, please use
it. However if you run into severe problems you might want to give
vtkpython a try. Incidentally, to see what the problems are with
the vanilla Python interpreter on some platforms read this thread:
http://public.kitware.com/pipermail/vtk-developers/2002-May/001536.html
Additionally, if you built VTK along with MPI support
...
...
@@ -145,7 +145,7 @@ in other kits can be imported by using the appropriate kit name.
Please do note that even when you import vtk.common, the vtk
namespace will still have all the kits loaded inside it. Its just
that vtk.common will have only the classes from the Common
directory.
directory.
Valid Kit names
...
...
@@ -203,7 +203,7 @@ the following widgets are available.
qt4 -- PyQt v4 widgets.
tk -- The Tkinter widgets.
tk -- The Tkinter widgets.
wx -- wxPython widgets.
...
...
@@ -280,7 +280,7 @@ in the form of Debian, RPM and other packages.
*not* as Python extension modules. Only the
``libvtk*Python.so`` (or ``vtk*Python.dll``) files are Python
extension modules. These extension modules are linked to the
`PythonD.so` libraries.
`PythonD.so` libraries.
Therefore, the ``libvtk*PythonD.so*`` files should be installed
somewhere in the linkers path (for example in `\usr\lib`).
...
...
Wrapping/Python/README_WRAP.txt
View file @
b41ca4b6
...
...
@@ -16,7 +16,7 @@ Overview:
Nearly all the power of VTK objects are available through Python
(with a few exceptions as noted below). The C++ symantics are
translated as directly as possible to Python symantics.
translated as directly as possible to Python symantics.
The Basics:
...
...
@@ -29,7 +29,7 @@ becomes
o = vtkObject()
and
o->Method()
o->Method()
becomes
o.Method()
...
...
@@ -40,7 +40,7 @@ list or array to a method that requires a C++ array e.g.:
>>> p = (100.0, 200.0, 100.0)
>>> a.SetPosition(p)
or if the C++ array is used to return information, you must pass a
or if the C++ array is used to return information, you must pass a
Python list or array that has the correct number of slots:
>>> z = [0.0, 0.0, 0.0]
...
...
@@ -65,7 +65,7 @@ Finally, the python 'None' is treated the same as C++ NULL:
>>> print a.GetMapper()
None
And perhaps one of the most pleasant features of Python is that all
And perhaps one of the most pleasant features of Python is that all
type-checking is performed at run time, so the type casts that are
often necessary in VTK-C++ are never needed in VTK-Python.
...
...
@@ -78,8 +78,8 @@ caution should be applied when using this feature.
Unavailable methods
-------------------
A method is not wrapped if
1) its parameter list contains a pointer/reference that is not a
A method is not wrapped if
1) its parameter list contains a pointer/reference that is not a
pointer/reference to a vtkObject
2) its parameter list contains a multidimensional array
3) it returns a pointer/reference that is not a pointer/reference
...
...
@@ -95,7 +95,7 @@ not wrapped. These are labelled as WRAP_EXCLUDE in the CMakeLists.txt
files.
Printing VTK objects
Printing VTK objects
====================
Printing a vtk object will provide the same information as provided
...
...
@@ -146,7 +146,7 @@ SetPosition(...)
C++: virtual void SetPosition (float _arg1, float _arg2, float _arg3);
V.SetPosition((float, float, float))
C++: virtual void SetPosition (float _arg[3]);
Set/Get/Add the position of the Prop3D in world coordinates.
...
...
@@ -214,7 +214,7 @@ Transmitting data from Python to VTK
If you have a large block of data in Python (for example a Numeric
array) that you want to access from VTK, then you can do so using
the vtkDataArray.SetVoidArray() method.
the vtkDataArray.SetVoidArray() method.
Creating a Python object from just the address of a VTK object
...
...
Wrapping/Python/setup_install_paths.py
View file @
b41ca4b6
...
...
@@ -26,7 +26,7 @@ def get_install_path(command, *args):
# convert setup args into an option dictionary
options
=
{}
for
arg
in
args
:
if
arg
==
'--'
:
break
...
...
@@ -63,7 +63,7 @@ def get_install_path(command, *args):
# get rid of trailing separator
if
prefix
!=
""
and
prefix
[
-
1
]
==
"/"
:
prefix
=
prefix
[
0
:
-
1
]
if
exec_prefix
!=
""
and
exec_prefix
[
-
1
]
==
"/"
:
exec_prefix
=
exec_prefix
[
0
:
-
1
]
...
...
@@ -100,7 +100,7 @@ def get_install_path(command, *args):
platlib
=
prefix
+
'/Lib/site-packages'
scripts
=
prefix
+
'/Scripts'
data
=
prefix
# allow direct setting of install directories
try
:
purelib
=
options
[
"--install-purelib"
]
...
...
@@ -135,4 +135,3 @@ def get_install_path(command, *args):
if
__name__
==
"__main__"
:
print
apply
(
get_install_path
,
sys
.
argv
[
1
:])
Wrapping/Python/vtk/__helper.py
View file @
b41ca4b6
...
...
@@ -17,7 +17,7 @@ def refine_import_err(mod_name, extension_name, exc):
- extension_name : The name of the extension module that is to be
imported by the module having mod_name.
- exc : The exception raised when the module called mod_name was
imported.
...
...
Wrapping/Python/vtk/__init__.py
View file @
b41ca4b6
...
...
@@ -35,7 +35,7 @@ except AttributeError:
orig_dlopen_flags
=
None
if
dl
and
(
os
.
name
==
'posix'
):
sys
.
setdlopenflags
(
dl
.
RTLD_NOW
|
dl
.
RTLD_GLOBAL
)
sys
.
setdlopenflags
(
dl
.
RTLD_NOW
|
dl
.
RTLD_GLOBAL
)
# Load all required kits.
from
common
import
*
...
...
Wrapping/Python/vtk/common.py
View file @
b41ca4b6
...
...
@@ -7,4 +7,3 @@ if os.name == 'posix':
from
libvtkCommonPython
import
*
else
:
from
vtkCommonPython
import
*
Wrapping/Python/vtk/genericfiltering.py
View file @
b41ca4b6
""" This module loads all the classes from the VTK GenericFiltering
library into its namespace. This is an optional module."""
import
os
import
os
if
os
.
name
==
'posix'
:
from
libvtkGenericFilteringPython
import
*
...
...
Wrapping/Python/vtk/gtk/GtkGLExtVTKRenderWindow.py
View file @
b41ca4b6
...
...
@@ -3,7 +3,7 @@ Description:
This provides a VTK widget for pyGtk. This embeds a vtkRenderWindow
inside a GTK widget. This is based on GtkVTKRenderWindow.py.
The extensions here allow the use of gtkglext rather than gtkgl and
pygtk-2 rather than pygtk-0. It requires pygtk-2.0.0 or later.
...
...
@@ -52,7 +52,7 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
self
.
_StillUpdateRate
=
0.0001
self
.
ConnectSignals
()
# need this to be able to handle key_press events.
self
.
set_flags
(
gtk
.
CAN_FOCUS
)
# default size
...
...
@@ -77,7 +77,7 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
gdk
.
POINTER_MOTION_HINT_MASK
|
gdk
.
ENTER_NOTIFY_MASK
|
gdk
.
LEAVE_NOTIFY_MASK
)
def
GetRenderWindow
(
self
):
return
self
.
_RenderWindow
...
...
@@ -93,8 +93,8 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
def
GetDesiredUpdateRate
(
self
):
"""Mirrors the method with the same name in
vtkRenderWindowInteractor."""
return
self
.
_DesiredUpdateRate
return
self
.
_DesiredUpdateRate
def
SetStillUpdateRate
(
self
,
rate
):
"""Mirrors the method with the same name in
vtkRenderWindowInteractor."""
...
...
@@ -123,7 +123,7 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
def
Created
(
self
):
return
self
.
__Created
def
OnConfigure
(
self
,
widget
,
event
):
self
.
widget
=
widget
self
.
_RenderWindow
.
SetSize
(
event
.
width
,
event
.
height
)
...
...
@@ -144,7 +144,7 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
"""Mouse button pressed."""
self
.
_RenderWindow
.
SetDesiredUpdateRate
(
self
.
_DesiredUpdateRate
)
return
gtk
.
TRUE
def
OnButtonUp
(
self
,
wid
,
event
):
"""Mouse button released."""
self
.
_RenderWindow
.
SetDesiredUpdateRate
(
self
.
_StillUpdateRate
)
...
...
@@ -161,7 +161,7 @@ class GtkGLExtVTKRenderWindowBase(gtk.gtkgl.DrawingArea):
def
OnLeave
(
self
,
wid
,
event
):
"""Leaving the vtkRenderWindow."""
return
gtk
.
TRUE
def
OnKeyPress
(
self
,
wid
,
event
):
"""Key pressed."""
return
gtk
.
TRUE
...
...
@@ -187,13 +187,13 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
self
.
_ViewportCenterX
=
0
self
.
_ViewportCenterY
=
0
self
.
_Picker
=
vtk
.
vtkCellPicker
()
self
.
_PickedAssembly
=
None
self
.
_PickedProperty
=
vtk
.
vtkProperty
()
self
.
_PickedProperty
.
SetColor
(
1
,
0
,
0
)
self
.
_PrePickedProperty
=
None
self
.
_OldFocus
=
None
# these record the previous mouse position
...
...
@@ -235,12 +235,12 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
w
=
self
.
get_pointer
()
self
.
UpdateRenderer
(
w
[
0
],
w
[
1
])
return
gtk
.
TRUE
def
OnKeyPress
(
self
,
wid
,
event
=
None
):
#if (event.keyval == gdk.keyval_from_name("q") or
# event.keyval == gdk.keyval_from_name("Q")):
# gtk.mainquit()
# gtk.mainquit()
if
(
event
.
keyval
==
gdk
.
keyval_from_name
(
'r'
)
or
event
.
keyval
==
gdk
.
keyval_from_name
(
'R'
)):
self
.
Reset
()
...
...
@@ -299,7 +299,7 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
if
(
windowY
>
1
):
vy
=
(
windowY
-
float
(
y
)
-
1
)
/
(
windowY
-
1
)
(
vpxmin
,
vpymin
,
vpxmax
,
vpymax
)
=
renderer
.
GetViewport
()
if
(
vx
>=
vpxmin
and
vx
<=
vpxmax
and
vy
>=
vpymin
and
vy
<=
vpymax
):
self
.
_CurrentRenderer
=
renderer
...
...
@@ -347,20 +347,20 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
def
Rotate
(
self
,
x
,
y
):
if
self
.
_CurrentRenderer
:
self
.
_CurrentCamera
.
Azimuth
(
self
.
_LastX
-
x
)
self
.
_CurrentCamera
.
Elevation
(
y
-
self
.
_LastY
)
self
.
_CurrentCamera
.
OrthogonalizeViewUp
()
self
.
_LastX
=
x
self
.
_LastY
=
y
self
.
_CurrentRenderer
.
ResetCameraClippingRange
()
self
.
Render
()
def
Pan
(
self
,
x
,
y
):
if
self
.
_CurrentRenderer
:
renderer
=
self
.
_CurrentRenderer
camera
=
self
.
_CurrentCamera
(
pPoint0
,
pPoint1
,
pPoint2
)
=
camera
.
GetPosition
()
...
...
@@ -386,7 +386,7 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
renderer
.
DisplayToWorld
()
fx
,
fy
,
fz
,
fw
=
renderer
.
GetWorldPoint
()
camera
.
SetPosition
(
fx
,
fy
,
fz
)
else
:
(
fPoint0
,
fPoint1
,
fPoint2
)
=
camera
.
GetFocalPoint
()
# Specify a point location in world coordinates
...
...
@@ -395,24 +395,24 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
# Convert world point coordinates to display coordinates
dPoint
=
renderer
.
GetDisplayPoint
()
focalDepth
=
dPoint
[
2
]
aPoint0
=
self
.
_ViewportCenterX
+
(
x
-
self
.
_LastX
)
aPoint1
=
self
.
_ViewportCenterY
-
(
y
-
self
.
_LastY
)
renderer
.
SetDisplayPoint
(
aPoint0
,
aPoint1
,
focalDepth
)
renderer
.
DisplayToWorld
()
(
rPoint0
,
rPoint1
,
rPoint2
,
rPoint3
)
=
renderer
.
GetWorldPoint
()
if
(
rPoint3
!=
0.0
):
rPoint0
=
rPoint0
/
rPoint3
rPoint1
=
rPoint1
/
rPoint3
rPoint2
=
rPoint2
/
rPoint3
camera
.
SetFocalPoint
((
fPoint0
-
rPoint0
)
+
fPoint0
,
camera
.
SetFocalPoint
((
fPoint0
-
rPoint0
)
+
fPoint0
,
(
fPoint1
-
rPoint1
)
+
fPoint1
,
(
fPoint2
-
rPoint2
)
+
fPoint2
)
camera
.
SetPosition
((
fPoint0
-
rPoint0
)
+
pPoint0
,
(
fPoint2
-
rPoint2
)
+
fPoint2
)
camera
.
SetPosition
((
fPoint0
-
rPoint0
)
+
pPoint0
,
(
fPoint1
-
rPoint1
)
+
pPoint1
,
(
fPoint2
-
rPoint2
)
+
pPoint2
)
...
...
@@ -445,7 +445,7 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
def
Reset
(
self
):
if
self
.
_CurrentRenderer
:
self
.
_CurrentRenderer
.
ResetCamera
()
self
.
Render
()
def
Wireframe
(
self
):
...
...
@@ -457,7 +457,7 @@ class GtkGLExtVTKRenderWindow(GtkGLExtVTKRenderWindowBase):
actor
.
GetProperty
().
SetRepresentationToWireframe
()
self
.
Render
()
def
Surface
(
self
):
actors
=
self
.
_CurrentRenderer
.
GetActors
()
numActors
=
actors
.
GetNumberOfItems
()
...
...
@@ -505,7 +505,7 @@ def main():
vtkgtk
=
GtkGLExtVTKRenderWindow
()
vtkgtk
.
show
()
vbox
=
gtk
.
VBox
(
spacing
=
3
)
vbox
.
show
()
vbox
.
pack_start
(
vtkgtk
)
...
...
@@ -514,7 +514,7 @@ def main():
button
.
show
()
vbox
.
pack_start
(
button
)
window
.
add
(
vbox
)
window
.
set_size_request
(
400
,
400
)
# The VTK stuff.
...
...
@@ -524,7 +524,7 @@ def main():
coneMapper
.
SetInput
(
cone
.
GetOutput
())
#coneActor = vtk.vtkLODActor()
coneActor
=
vtk
.
vtkActor
()
coneActor
.
SetMapper
(
coneMapper
)
coneActor
.
SetMapper
(
coneMapper
)
coneActor
.
GetProperty
().
SetColor
(
0.5
,
0.5
,
1.0
)
ren
=
vtk
.
vtkRenderer
()
vtkgtk
.
GetRenderWindow
().
AddRenderer
(
ren
)
...
...
Wrapping/Python/vtk/gtk/GtkGLExtVTKRenderWindowInteractor.py
View file @
b41ca4b6
...
...
@@ -43,7 +43,7 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
gtk
.
gtkgl
.
DrawingArea
.
__init__
(
self
)
self
.
set_double_buffered
(
gtk
.
FALSE
)
self
.
_RenderWindow
=
vtk
.
vtkRenderWindow
()
# private attributes
...
...
@@ -56,16 +56,16 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
self
.
_Iren
.
AddObserver
(
'CreateTimerEvent'
,
self
.
CreateTimer
)
self
.
_Iren
.
AddObserver
(
'DestroyTimerEvent'
,
self
.
DestroyTimer
)
self
.
ConnectSignals
()
# need this to be able to handle key_press events.
self
.
set_flags
(
gtk
.
CAN_FOCUS
)
def
set_size_request
(
self
,
w
,
h
):
gtk
.
gtkgl
.
DrawingArea
.
set_size_request
(
self
,
w
,
h
)
self
.
_RenderWindow
.
SetSize
(
w
,
h
)
self
.
_Iren
.
SetSize
(
w
,
h
)
self
.
_Iren
.
ConfigureEvent
()
gtk
.
gtkgl
.
DrawingArea
.
set_size_request
(
self
,
w
,
h
)
self
.
_RenderWindow
.
SetSize
(
w
,
h
)
self
.
_Iren
.
SetSize
(
w
,
h
)
self
.
_Iren
.
ConfigureEvent
()
def
ConnectSignals
(
self
):
self
.
connect
(
"realize"
,
self
.
OnRealize
)
self
.
connect
(
"expose_event"
,
self
.
OnExpose
)
...
...
@@ -83,8 +83,8 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
gdk
.
POINTER_MOTION_MASK
|
gdk
.
POINTER_MOTION_HINT_MASK
|
gdk
.
ENTER_NOTIFY_MASK
|
gdk
.
LEAVE_NOTIFY_MASK
)
def
__getattr__
(
self
,
attr
):
def
__getattr__
(
self
,
attr
):
"""Makes the object behave like a
vtkGenericRenderWindowInteractor"""
if
attr
==
'__vtk__'
:
...
...
@@ -122,7 +122,7 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
#self._Iren.Initialize()
self
.
__Created
=
1
return
gtk
.
TRUE
def
OnConfigure
(
self
,
widget
,
event
):
self
.
widget
=
widget
self
.
_Iren
.
SetSize
(
event
.
width
,
event
.
height
)
...
...
@@ -141,7 +141,7 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
return
gtk
.
TRUE
def
_GetCtrlShift
(
self
,
event
):
ctrl
,
shift
=
0
,
0
ctrl
,
shift
=
0
,
0
if
((
event
.
state
&
gdk
.
CONTROL_MASK
)
==
gdk
.
CONTROL_MASK
):
ctrl
=
1
if
((
event
.
state
&
gdk
.
SHIFT_MASK
)
==
gdk
.
SHIFT_MASK
):
...
...
@@ -158,15 +158,15 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
if
button
==
3
:
self
.
_Iren
.
RightButtonPressEvent
()
return
gtk
.
TRUE
elif
button
==
1
:
elif
button
==
1
:
self
.
_Iren
.
LeftButtonPressEvent
()
return
gtk
.
TRUE
elif
button
==
2
:
elif
button
==
2
:
self
.
_Iren
.
MiddleButtonPressEvent
()
return
gtk
.
TRUE
else
:
return
gtk
.
FALSE
def
OnButtonUp
(
self
,
wid
,
event
):
"""Mouse button released."""
m
=
self
.
get_pointer
()
...
...
@@ -177,13 +177,13 @@ class GtkGLExtVTKRenderWindowInteractor(gtk.gtkgl.DrawingArea):
if
button
==
3
:
self
.
_Iren
.
RightButtonReleaseEvent
()
return
gtk
.
TRUE
elif
button
==
1
:
elif
button
==
1
:
self
.
_Iren
.
LeftButtonReleaseEvent
()