Skip to content

Commit

Permalink
Fixed vtkviewcell
Browse files Browse the repository at this point in the history
  • Loading branch information
rexissimus committed Feb 24, 2015
1 parent f819bf4 commit 681aad4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 33 deletions.
7 changes: 3 additions & 4 deletions vistrails/packages/vtk/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@
if registry.has_module('%s.spreadsheet' % get_vistrails_default_pkg_prefix(),
'SpreadsheetCell'):
# load these only if spreadsheet is enabled
from . import vtkviewcell
from .vtkhandler import _modules as handler_modules
from .vtkcell import _modules as cell_modules
_modules += cell_modules + handler_modules
# vtkviewcell.registerSelf()
from .vtkviewcell import _modules as view_cell_modules
from .vtkhandler import _modules as handler_modules
_modules += cell_modules + view_cell_modules + handler_modules


# TODO: code below is independent of VTK and should be moved elsewhere
Expand Down
38 changes: 9 additions & 29 deletions vistrails/packages/vtk/vtkviewcell.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,11 @@
from PyQt4 import QtCore, QtGui
import sip
from vistrails.core import system
from vistrails.core.modules.module_registry import get_module_registry
from vistrails.packages.spreadsheet.basic_widgets import SpreadsheetCell, CellLocation
from vistrails.packages.spreadsheet.basic_widgets import SpreadsheetCell
from vistrails.packages.spreadsheet.spreadsheet_cell import QCellWidget, QCellToolBar
import gc
from vistrails.gui.qt import qt_super
import vistrails.core.db.action
from vistrails.core.vistrail.action import Action
from vistrails.core.vistrail.port import Port
from vistrails.core.vistrail import module
from vistrails.core.vistrail import connection
from vistrails.core.vistrail.module_function import ModuleFunction
from vistrails.core.vistrail.module_param import ModuleParam
from vistrails.core.vistrail.location import Location
from vistrails.core.modules.vistrails_module import ModuleError
import copy

from identifiers import identifier as vtk_pkg_identifier

Expand All @@ -70,6 +60,10 @@ class VTKViewCell(SpreadsheetCell):
"""

_input_ports = [("Location", "spreadsheet:CellLocation"),
("SetRenderView", "vtkRenderView", {'depth':1})]
_output_ports = [("Instance", "VTKViewCell")]

def __init__(self):
SpreadsheetCell.__init__(self)
self.cellWidget = None
Expand All @@ -78,10 +72,10 @@ def compute(self):
""" compute() -> None
Dispatch the vtkRenderer to the actual rendering widget
"""
renderView = self.force_get_input('SetRenderView')
if renderView==None:
renderViews = self.force_get_input('SetRenderView')
if renderViews==None:
raise ModuleError(self, 'A vtkRenderView input is required.')
self.displayAndWait(QVTKViewWidget, (renderView,))
self.displayAndWait(QVTKViewWidget, renderViews)

AsciiToKeySymTable = ( None, None, None, None, None, None, None,
None, None,
Expand Down Expand Up @@ -998,18 +992,4 @@ def createToolBar(self):
self.addAnimationButtons()
self.appendAction(QVTKViewWidgetSaveCamera(self))

def registerSelf():
""" registerSelf() -> None
Registry module with the registry
"""
registry = get_module_registry()
registry.add_module(VTKViewCell)
registry.add_input_port(VTKViewCell, "Location", CellLocation)
from vistrails.core import debug
for (port,module) in [("SetRenderView",'vtkRenderView')]:
try:
registry.add_input_port(VTKViewCell, port,
'(%s:%s)' % (vtk_pkg_identifier, module))
except Exception, e:
debug.warning("Got an exception adding VTKViewCell's %s input "
"port" % port, e)
_modules = [VTKViewCell,]

0 comments on commit 681aad4

Please sign in to comment.