11# Standard library imports
22import argparse
33import os
4- import sys
54
65# Third party imports
76import vtk
@@ -31,6 +30,17 @@ class _Server(vtk_wslink.ServerProtocol):
3130 authKey = "wslink-secret"
3231 view = None
3332 debug = False
33+ custom_protocols = []
34+ mesh_protocols = VtkMeshView ()
35+ model_protocols = VtkModelView ()
36+ custom_protocols .append (VtkView ())
37+ custom_protocols .append (VtkViewerView ())
38+ custom_protocols .append (mesh_protocols )
39+ custom_protocols .append (VtkMeshPointsView ())
40+ custom_protocols .append (VtkMeshEdgesView ())
41+ custom_protocols .append (VtkMeshPolygonsView ())
42+ custom_protocols .append (model_protocols )
43+ custom_protocols .append (VtkGenericView (mesh_protocols , model_protocols ))
3444
3545 @staticmethod
3646 def add_arguments (parser ):
@@ -53,16 +63,9 @@ def initialize(self):
5363 self .setSharedObject ("db" , dict ())
5464
5565 # Custom API
56- mesh_protocols = VtkMeshView ()
57- model_protocols = VtkModelView ()
58- self .registerVtkWebProtocol (VtkView ())
59- self .registerVtkWebProtocol (VtkViewerView ())
60- self .registerVtkWebProtocol (mesh_protocols )
61- self .registerVtkWebProtocol (VtkMeshPointsView ())
62- self .registerVtkWebProtocol (VtkMeshEdgesView ())
63- self .registerVtkWebProtocol (VtkMeshPolygonsView ())
64- self .registerVtkWebProtocol (model_protocols )
65- self .registerVtkWebProtocol (VtkGenericView (mesh_protocols , model_protocols ))
66+ print ("Nb protocols" , len (_Server .custom_protocols ))
67+ for protocol in _Server .custom_protocols :
68+ self .registerVtkWebProtocol (protocol )
6669
6770 # tell the C++ web app to use no encoding.
6871 # ParaViewWebPublishImageDelivery must be set to decode=False to match.
0 commit comments