MCPcopy Create free account
hub / github.com/AstroPrint/AstroBox / togglePausePrint

Method togglePausePrint

src/astroprint/printer/__init__.py:552–575  ·  view source on GitHub ↗

Pause the current printjob.

(self)

Source from the content-addressed store, hash-verified

550 return {'error': 'no_print_job', 'message': 'No active print job to cancel'}
551
552 def togglePausePrint(self):
553 """
554 Pause the current printjob.
555 """
556 if not self.isConnected():
557 return
558
559 wasPaused = self.isPaused()
560
561 if wasPaused:
562 if self._pausedSince is not None:
563 self._secsPaused += ( time.time() - self._pausedSince )
564 self._pausedSince = None
565 else:
566 self._pausedSince = time.time()
567
568 self.setPause(not wasPaused)
569
570 cm = cameraManager()
571 if cm.is_timed_timelapse_active():
572 if wasPaused:
573 cm.resume_timelapse()
574 else:
575 cm.pause_timelapse()
576
577 #~~~ Printer callbacks ~~~
578

Callers 5

controlJobFunction · 0.80
pauseMethod · 0.80
resumeMethod · 0.80
pauseMethod · 0.80
resumeMethod · 0.80

Calls 7

isConnectedMethod · 0.95
isPausedMethod · 0.95
setPauseMethod · 0.95
cameraManagerFunction · 0.90
resume_timelapseMethod · 0.80
pause_timelapseMethod · 0.80

Tested by

no test coverage detected