3636 get_point_position_json = json .load (file )
3737with open (os .path .join (schemas , "reset.json" ), "r" ) as file :
3838 reset_json = json .load (file )
39+ with open (os .path .join (schemas , "set_opacity.json" ), "r" ) as file :
40+ set_opacity_json = json .load (file )
3941with open (os .path .join (schemas , "toggle_edge_visibility.json" ), "r" ) as file :
4042 toggle_edge_visibility_json = json .load (file )
41- with open (os .path .join (schemas , "point_size .json" ), "r" ) as file :
42- point_size_json = json .load (file )
43+ with open (os .path .join (schemas , "set_point_size .json" ), "r" ) as file :
44+ set_point_size_json = json .load (file )
4345with open (os .path .join (schemas , "toggle_point_visibility.json" ), "r" ) as file :
4446 toggle_point_visibility_json = json .load (file )
4547with open (os .path .join (schemas , "set_color.json" ), "r" ) as file :
@@ -246,11 +248,20 @@ def reset(self, params):
246248 renderWindow = self .getView ("-1" )
247249 renderWindow .GetRenderers ().GetFirstRenderer ().RemoveAllViewProps ()
248250
251+ @exportRpc (set_opacity_json ["rpc" ])
252+ def set_opacity (self , params ):
253+ validate_schemas (params , set_opacity_json )
254+ id = params ["id" ]
255+ opacity = float (params ["opacity" ])
256+ actor = self .get_object (id )["actor" ]
257+ actor .GetProperty ().SetOpacity (opacity )
258+ self .render ()
259+
249260 @exportRpc (toggle_edge_visibility_json ["rpc" ])
250261 def setEdgeVisibility (self , params ):
251262 validate_schemas (params , toggle_edge_visibility_json )
252263 print (f"{ params = } " , flush = True )
253- id = params ["id" ]
264+ id = str ( params ["id" ])
254265 visibility = bool (params ["visibility" ])
255266 actor = self .get_object (id )["actor" ]
256267 actor .GetProperty ().SetEdgeVisibility (visibility )
@@ -265,9 +276,9 @@ def setPointVisibility(self, params):
265276 actor .GetProperty ().SetVertexVisibility (visibility )
266277 self .render ()
267278
268- @exportRpc (point_size_json ["rpc" ])
279+ @exportRpc (set_point_size_json ["rpc" ])
269280 def setPointSize (self , params ):
270- validate_schemas (params , point_size_json )
281+ validate_schemas (params , set_point_size_json )
271282 id = params ["id" ]
272283 size = float (params ["size" ])
273284 actor = self .get_object (id )["actor" ]
0 commit comments