Skip to content

Commit

Permalink
Merge branch '200-secure-connection' of https://github.com/zincware/z…
Browse files Browse the repository at this point in the history
…ndraw into 200-secure-connection
  • Loading branch information
PythonFZ committed Oct 4, 2023
2 parents 9b81bfb + 5edd8ba commit 80fa0cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion zndraw/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def index():
stop=app.config.get("stop"),
step=app.config.get("step"),
),
"wait": True
"wait": True,
}

proc = mp.Process(
Expand All @@ -60,6 +60,7 @@ def on_join(data):
session["uuid"] = data["uuid"]
join_room(session["uuid"])


@app.route("/exit")
def exit_route():
"""Exit the session."""
Expand Down Expand Up @@ -115,10 +116,12 @@ def analysis_schema(data):
def selection_schema():
io.emit("selection:schema", get_selection_class().model_json_schema())


@io.on("draw:schema")
def draw_schema():
io.emit("draw:schema", Geometry.updated_schema())


@io.on("scene:schema")
def scene_schema():
import enum
Expand Down
4 changes: 2 additions & 2 deletions zndraw/zndraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def __post_init__(self):
self.socket.connect(self.url)
if not self.jupyter:
self.socket.sleep(2) # wait for the server to start

if self.wait:
self.socket.wait()

Expand Down Expand Up @@ -262,7 +262,7 @@ def read(self, filename: str, start: int = 0, stop: int = None, step: int = 1):
atoms_list = list(ase.io.iread(filename))[start:stop:step]
for idx, atoms in tqdm.tqdm(
enumerate(atoms_list), ncols=100, total=len(atoms_list)
):
):
self[idx] = atoms

def get_selection(self) -> list[int]:
Expand Down

0 comments on commit 80fa0cc

Please sign in to comment.