2020import subprocess
2121import numpy as np
2222import zndraw .type_defs
23- import zndraw . zndraw
23+ import zndraw
2424import zndraw .utils
2525import zndraw .draw
2626import znsocket
@@ -421,7 +421,6 @@ class Visualizer():
421421 """
422422
423423 SERVER_PORT = None
424- SOCKET_PORT = None
425424
426425 def __init__ (self ,
427426 system : espressomd .system .System = None ,
@@ -488,12 +487,9 @@ def _start_server(self):
488487 """
489488 Start the ZnDraw server through a subprocess
490489 """
491- self .socket_port = zndraw .utils .get_port (default = 6374 )
492-
493490 Visualizer .SERVER_PORT = self .port
494- Visualizer .SOCKET_PORT = self .socket_port
495491
496- self .server = subprocess .Popen (["zndraw" , "--no-browser" , f"--port={ self .port } " , f"--storage-port= { self . socket_port } " ],
492+ self .server = subprocess .Popen (["zndraw" , "--no-browser" , f"--port={ self .port } " ],
497493 stdout = subprocess .DEVNULL ,
498494 stderr = subprocess .DEVNULL
499495 )
@@ -502,25 +498,8 @@ def _start_zndraw(self):
502498 """
503499 Start the ZnDraw client and connect to the server
504500 """
505- config = zndraw .zndraw .TimeoutConfig (
506- connection = 10 ,
507- modifier = 0.25 ,
508- between_calls = 0.1 ,
509- emit_retries = 3 ,
510- call_retries = 1 ,
511- connect_retries = 3 ,
512- )
513- while True :
514- try :
515- self .r = znsocket .Client (
516- address = f"{ self .url } :{ self .SOCKET_PORT } " )
517- break
518- except BaseException :
519- time .sleep (0.5 )
520-
521501 url = f"{ self .url } :{ self .SERVER_PORT } "
522- self .zndraw = zndraw .zndraw .ZnDrawLocal (
523- r = self .r , url = url , token = self .token , timeout = config )
502+ self .zndraw = zndraw .ZnDraw (url = url , token = self .token )
524503 parsed_url = urllib .parse .urlparse (
525504 f"{ self .zndraw .url } /token/{ self .zndraw .token } " )
526505 self .address = parsed_url ._replace (scheme = "http" ).geturl ()
0 commit comments