@@ -30,17 +30,6 @@ class _Server(vtk_wslink.ServerProtocol):
30
30
authKey = "wslink-secret"
31
31
view = None
32
32
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 ))
44
33
45
34
@staticmethod
46
35
def add_arguments (parser ):
@@ -63,10 +52,17 @@ def initialize(self):
63
52
self .setSharedObject ("db" , dict ())
64
53
65
54
# 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
+
70
66
# tell the C++ web app to use no encoding.
71
67
# ParaViewWebPublishImageDelivery must be set to decode=False to match.
72
68
self .getApplication ().SetImageEncoding (0 )
@@ -102,7 +98,7 @@ def initialize(self):
102
98
# =============================================================================
103
99
104
100
105
- def run_server ():
101
+ def run_server (Server = _Server ):
106
102
PYTHON_ENV = os .environ .get ("PYTHON_ENV" , default = "prod" ).strip ().lower ()
107
103
if PYTHON_ENV == "prod" :
108
104
prod_config ()
@@ -112,7 +108,7 @@ def run_server():
112
108
parser = argparse .ArgumentParser (description = "Vtk server" )
113
109
server .add_arguments (parser )
114
110
115
- _Server .add_arguments (parser )
111
+ Server .add_arguments (parser )
116
112
args = parser .parse_args ()
117
113
118
114
if not "host" in args :
@@ -123,8 +119,8 @@ def run_server():
123
119
os .environ ["DATA_FOLDER_PATH" ] = args .data_folder_path
124
120
125
121
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 )
128
124
129
125
130
126
if __name__ == "__main__" :
0 commit comments