From 8b7022dd45f354a416867c257f8bdc254afe4e14 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Fri, 13 Jan 2017 23:15:52 +0000
Subject: [PATCH] Changes of VTKRendering due to possibility to compile VTK7

---
 trisurf/VTKRendering.py |   11 ++++++-----
 trisurf/tsmgr.py        |    9 +++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/trisurf/VTKRendering.py b/trisurf/VTKRendering.py
index 97b06ae..44fe699 100644
--- a/trisurf/VTKRendering.py
+++ b/trisurf/VTKRendering.py
@@ -1,9 +1,10 @@
 import os,sys
 from . import trisurf
-if sys.version_info<(3,0):
+try:
 	from vtk import *
-
-
+except:
+	print("Vtk rendering works if you manually install vtk7 for python3")
+	exit(1)
 
 class MultiRender:
 	def __init__(self,args,host):
@@ -51,7 +52,7 @@
 		output = reader.GetOutput()
 		scalar_range = output.GetScalarRange()
 		mapper = vtkDataSetMapper()
-		mapper.SetInput(output)
+		mapper.SetInputData(output)
 		mapper.SetScalarRange(scalar_range)
 
 		# Create the Actor
@@ -130,7 +131,7 @@
 		output = reader.GetOutput()
 		scalar_range = output.GetScalarRange()
 		mapper = vtkDataSetMapper()
-		mapper.SetInput(output)
+		mapper.SetInputData(output)
 		mapper.SetScalarRange(scalar_range)
 
 		# Create the Actor
diff --git a/trisurf/tsmgr.py b/trisurf/tsmgr.py
index 1ab0548..1143717 100644
--- a/trisurf/tsmgr.py
+++ b/trisurf/tsmgr.py
@@ -15,7 +15,8 @@
 else:
 	from urlparse import urlparse
 	from vtk import *
-	from . import VTKRendering
+	
+from . import VTKRendering
 #import io
 
 from IPython import embed
@@ -257,9 +258,9 @@
 
 def preview_vtu(args,host):
 	#only for localhost at the moment
-	if sys.version_info>=(3,0):
-		print("Preview works only with python 2.7")
-		exit(1)
+	#if sys.version_info>=(3,0):
+	#	print("Preview works only with python 2.7")
+	#	exit(1)
 	if host['name'] == socket.gethostname():
 		VTKRendering.Renderer(args,host)
 

--
Gitblit v1.9.3