Skip to content

Commit d07b55d

Browse files
Merge branch 'main' into memo
2 parents 98982d7 + edc1fe9 commit d07b55d

File tree

2 files changed

+29
-26
lines changed

2 files changed

+29
-26
lines changed

requirements.build.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ bitarray==2.9.2
99
simpleaudio-patched==1.0.5
1010
numpy==1.26.4
1111
charset-normalizer<3.0.0
12-
semver==3.0.2
12+
semver==3.0.2
13+
wakepy==0.10.1

src/main/python/main/ayab/engine/engine.py

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
from PySide6.QtCore import QCoreApplication, Signal
2626
from PySide6.QtWidgets import QDockWidget
27+
from wakepy import keep
2728

2829
from .. import utils
2930
from ..machine import Machine
@@ -172,33 +173,34 @@ def run(self, operation: Operation) -> None:
172173
self.config.portname = self.__read_portname()
173174
self.control.start(self.pattern, self.memos, self.config, operation)
174175

175-
while True:
176-
# continue operating
177-
# typically each step involves some communication with the device
178-
output = self.control.operate(operation)
179-
if output != self.control.notification:
180-
self.__feedback.handle(output)
181-
self.control.notification = output
182-
if operation == Operation.KNIT:
183-
self.__handle_status()
184-
if self.__canceled or self.control.state == State.FINISHED:
185-
break
186-
187-
self.control.stop()
176+
with keep.presenting(on_fail="pass"):
177+
while True:
178+
# continue operating
179+
# typically each step involves some communication with the device
180+
output = self.control.operate(operation)
181+
if output != self.control.notification:
182+
self.__feedback.handle(output)
183+
self.control.notification = output
184+
if operation == Operation.KNIT:
185+
self.__handle_status()
186+
if self.__canceled or self.control.state == State.FINISHED:
187+
break
188+
189+
self.control.stop()
188190

189-
if operation == Operation.KNIT:
190-
if self.__canceled:
191-
self.emit_notification("Knitting canceled.")
192-
self.__logger.info("Knitting canceled.")
191+
if operation == Operation.KNIT:
192+
if self.__canceled:
193+
self.emit_notification("Knitting canceled.")
194+
self.__logger.info("Knitting canceled.")
195+
else:
196+
# operation == Operation.TEST:
197+
self.__logger.info("Finished knitting.")
193198
else:
194-
# operation == Operation.TEST:
195-
self.__logger.info("Finished knitting.")
196-
else:
197-
# TODO: provide translations for these messages
198-
self.__logger.info("Finished testing.")
199-
200-
# send signal to finish operation
201-
self.emit_operation_finisher(operation)
199+
# TODO: provide translations for these messages
200+
self.__logger.info("Finished testing.")
201+
202+
# send signal to finish operation
203+
self.emit_operation_finisher(operation)
202204

203205
def __handle_status(self) -> None:
204206
if self.status.active:

0 commit comments

Comments
 (0)