From 8a1af86e7ccdd00e864b604e1f4dd9cfc031fbd7 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 08 Jul 2016 20:19:06 +0000
Subject: [PATCH] VTK added labeling of the timestep

---
 python/trisurf/tsmgr.py |   43 +++----------------------------------------
 1 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/python/trisurf/tsmgr.py b/python/trisurf/tsmgr.py
index 272a482..d973360 100644
--- a/python/trisurf/tsmgr.py
+++ b/python/trisurf/tsmgr.py
@@ -3,7 +3,7 @@
 from . import Remote
 from . import trisurf
 import socket
-import sys
+import os,sys
 import tabulate
 import subprocess,re
 import psutil
@@ -15,6 +15,7 @@
 else:
 	from urlparse import urlparse
 	from vtk import *
+	from . import VTKRendering
 #import io
 
 
@@ -203,49 +204,11 @@
 
 def preview_vtu(args,host):
 	#only for localhost at the moment
-	filename=host['runs'][0].getLastVTU()
-	print(filename)
 	if sys.version_info>=(3,0):
 		print("Preview works only with python 2.7")
 		exit(1)
 	if host['name'] == socket.gethostname():
-		target_runs=getTargetRunIdxList(args)
-		#if target_runs==None:
-		#	target_runs=list(range(1,len(host['runs'])+1))
-		#for i in target_runs:
-		#	host['runs'][i-1].start()
-		reader=vtkXMLUnstructuredGridReader()
-		reader.SetFileName(filename)
-		reader.Update() # Needed because of GetScalarRange
-		output = reader.GetOutput()
-		scalar_range = output.GetScalarRange()
-
-		# Create the mapper that corresponds the objects of the vtk file
-		# into graphics elements
-		mapper = vtkDataSetMapper()
-		mapper.SetInput(output)
-		mapper.SetScalarRange(scalar_range)
-
-		# Create the Actor
-		actor = vtkActor()
-		actor.SetMapper(mapper)
-
-		# Create the Renderer
-		renderer = vtkRenderer()
-		renderer.AddActor(actor)
-		renderer.SetBackground(0, 0, 0) # Set background to white
-
-		# Create the RendererWindow
-		renderer_window = vtkRenderWindow()
-		renderer_window.AddRenderer(renderer)
-
-		# Create the RendererWindowInteractor and display the vtk_file
-		interactor = vtkRenderWindowInteractor()
-		interactor.SetRenderWindow(renderer_window)
-		interactor.Initialize()
-		interactor.Start()
-
-
+		VTKRendering.Renderer(args,host)
 
 def getListOfHostConfigurationByHostname(hosts,host):
 	rhost=[]

--
Gitblit v1.9.3