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 19, 2023
2 parents 3bd8141 + 265e5ea commit 1f4fab1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
2 changes: 2 additions & 0 deletions zndraw/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def download_request(data):
def download_response(data):
emit("download:response", data["data"], to=data["sid"])


@io.on("scene:play")
def scene_play(data):
print(f"scene:play {data}")
Expand All @@ -438,6 +439,7 @@ def scene_play(data):
else:
emit("scene:play", to=session["token"])


@io.on("scene:pause")
def scene_pause(data):
print(f"scene:pause {data}")
Expand Down
26 changes: 16 additions & 10 deletions zndraw/zndraw.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,14 @@ def selection(self, value: list[int]):
self.socket.emit("selection:set", data)

def play(self):
self.socket.emit("scene:play", {"sid": self._target_sid if self._target_sid else self.token})
self.socket.emit(
"scene:play", {"sid": self._target_sid if self._target_sid else self.token}
)

def pause(self):
self.socket.emit("scene:pause", {"sid": self._target_sid if self._target_sid else self.token})
self.socket.emit(
"scene:pause", {"sid": self._target_sid if self._target_sid else self.token}
)


@dataclasses.dataclass
Expand Down Expand Up @@ -326,14 +330,16 @@ def modifier_run(self, data):

size = len(self)

for idx, atoms in enumerate(modifier.run(
atom_ids=selection,
atoms=atoms,
points=points,
segments=segments,
json_data=json_data,
url=data["url"],
)):
for idx, atoms in enumerate(
modifier.run(
atom_ids=selection,
atoms=atoms,
points=points,
segments=segments,
json_data=json_data,
url=data["url"],
)
):
self[size + idx] = atoms
self.play()

Expand Down

0 comments on commit 1f4fab1

Please sign in to comment.