from vtk.vtkCommonExecutionModel import * from vtk.vtkFiltersSources import * from vtk.vtkParallelCore import * from vtk.vtkParaViewWebCore import * from vtk.vtkPVClientServerCoreCore import * from vtk.vtkPVServerManagerApplication import * from vtk.vtkPVServerManagerCore import * from vtk.vtkPVVTKExtensionsCore import * from vtk import * #------------------------------------------------------------------------------ # Start server #------------------------------------------------------------------------------ paraviewHelper = pv_ipython.ParaViewIPython() webArguments = pv_ipython.WebArguments('%s/www' % build_path) sphere = None def start(): paraviewHelper.Initialize( os.path.join(os.getcwd(), 'Testing', 'Temporary', 'mpi-python')) pv_ipython.IPythonProtocol.updateArguments(webArguments) paraviewHelper.SetWebProtocol(pv_ipython.IPythonProtocol, webArguments) return paraviewHelper.Start() def start_thread(): # Register some data at startup global sphere position = [random.random() * 2, random.random() * 2, random.random() * 2]
# Update python path to have ParaView libs build_path='/Volumes/SebKitSSD/Kitware/code/ParaView/build-ninja' sys.path.append('%s/lib'%build_path) sys.path.append('%s/lib/site-packages'%build_path) # iPython import #from IPython.display import HTML #from IPython.parallel import Client import paraview from paraview.web import ipython as pv_ipython from vtk import * iPythonClient = None paraviewHelper = pv_ipython.ParaViewIPython() webArguments = pv_ipython.WebArguments('/.../path-to-web-directory') def _start_paraview(): paraviewHelper.Initialize() paraviewHelper.SetWebProtocol(IPythonProtocol, webArguments) return paraviewHelper.Start() def _stop_paraview(): paraviewHelper.Finalize() def _pv_activate_dataset(): IPythonProtocol.ActivateDataSet('iPython-demo')