@@ -30,17 +30,6 @@ class _Server(vtk_wslink.ServerProtocol):
3030 authKey = "wslink-secret"
3131 view = None
3232 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 ))
4433
4534 @staticmethod
4635 def add_arguments (parser ):
@@ -63,10 +52,17 @@ def initialize(self):
6352 self .setSharedObject ("db" , dict ())
6453
6554 # Custom API
66- print ("Nb protocols" , len (_Server .custom_protocols ))
67- for protocol in _Server .custom_protocols :
68- self .registerVtkWebProtocol (protocol )
69-
55+ mesh_protocols = VtkMeshView ()
56+ model_protocols = VtkModelView ()
57+ self .registerVtkWebProtocol (VtkView ())
58+ self .registerVtkWebProtocol (VtkViewerView ())
59+ self .registerVtkWebProtocol (mesh_protocols )
60+ self .registerVtkWebProtocol (VtkMeshPointsView ())
61+ self .registerVtkWebProtocol (VtkMeshEdgesView ())
62+ self .registerVtkWebProtocol (VtkMeshPolygonsView ())
63+ self .registerVtkWebProtocol (model_protocols )
64+ self .registerVtkWebProtocol (VtkGenericView (mesh_protocols , model_protocols ))
65+
7066 # tell the C++ web app to use no encoding.
7167 # ParaViewWebPublishImageDelivery must be set to decode=False to match.
7268 self .getApplication ().SetImageEncoding (0 )
@@ -102,7 +98,7 @@ def initialize(self):
10298# =============================================================================
10399
104100
105- def run_server ():
101+ def run_server (Server = _Server ):
106102 PYTHON_ENV = os .environ .get ("PYTHON_ENV" , default = "prod" ).strip ().lower ()
107103 if PYTHON_ENV == "prod" :
108104 prod_config ()
@@ -112,7 +108,7 @@ def run_server():
112108 parser = argparse .ArgumentParser (description = "Vtk server" )
113109 server .add_arguments (parser )
114110
115- _Server .add_arguments (parser )
111+ Server .add_arguments (parser )
116112 args = parser .parse_args ()
117113
118114 if not "host" in args :
@@ -123,8 +119,8 @@ def run_server():
123119 os .environ ["DATA_FOLDER_PATH" ] = args .data_folder_path
124120
125121 print (f"{ args = } " , flush = True )
126- _Server .configure (args )
127- server .start_webserver (options = args , protocol = _Server )
122+ Server .configure (args )
123+ server .start_webserver (options = args , protocol = Server )
128124
129125
130126if __name__ == "__main__" :
0 commit comments