Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 19, 2023
1 parent 87f05ba commit 265e5ea
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 265e5ea

Please sign in to comment.