From eb706bf094cb94104536cd1bb827828db672df5d Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Sat, 09 Jul 2016 10:38:18 +0000
Subject: [PATCH] Merged the difference

---
 python/trisurf/tsmgr.py |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/python/trisurf/tsmgr.py b/python/trisurf/tsmgr.py
index 258f4c9..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
@@ -14,6 +14,8 @@
 	from . import WebTrisurf
 else:
 	from urlparse import urlparse
+	from vtk import *
+	from . import VTKRendering
 #import io
 
 
@@ -42,6 +44,7 @@
 	action_group.add_argument('-s','--status',help='print status of the processes',action='store_true')
 	action_group.add_argument('-v','--version', help='print version information and exit', action='store_true')
 	action_group.add_argument('--web-server', type=int,metavar="PORT", nargs=1, help='EXPERIMENTAL: starts web server and never exist.')
+	action_group.add_argument('-p','--preview',help='preview last VTU shape',action='store_true')
 	parser.add_argument('--force', help='if dangerous operation (killing all the processes) is requested, this flag is required to execute the operation. Otherwise, the request will be ignored.', action="store_true")
 	parser.add_argument('-H', '--host', nargs=1, help='specifies which host is itended for the operation. Defauts to localhost for all operations except --status and --version, where all configured hosts are assumed.')
 	parser.add_argument('--html', help='Generate HTML output', action="store_true")
@@ -191,12 +194,21 @@
 		delete_comments(args,host)
 	elif args['web_server']!=None:
 		start_web_server(args,host)
+	elif args['preview']:
+		preview_vtu(args,host)
 	else: #version requested
 		print(getTrisurfVersion())
 	return
 
 
-	
+
+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 host['name'] == socket.gethostname():
+		VTKRendering.Renderer(args,host)
 
 def getListOfHostConfigurationByHostname(hosts,host):
 	rhost=[]

--
Gitblit v1.9.3