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

Method mcProgress

src/astroprint/printer/__init__.py:650–677  ·  view source on GitHub ↗

Callback method for the comm object, called upon any change in progress of the printjob. Triggers storage of new values for printTime, printTimeLeft and the current progress.

(self)

Source from the content-addressed store, hash-verified

648 self._addTemperatureData(temp, bedTemp)
649
650 def mcProgress(self):
651 """
652 Callback method for the comm object, called upon any change in progress of the printjob.
653 Triggers storage of new values for printTime, printTimeLeft and the current progress.
654 """
655
656 #Calculate estimated print time left
657 printTime = self.getPrintTime()
658 progress = self.getPrintProgress()
659 estimatedTimeLeft = None
660
661 if self._estimatedPrintTime:
662 if printTime and progress:
663 if progress < 1.0:
664 estimatedTimeLeft = self._estimatedPrintTime * ( 1.0 - progress )
665 elaspedTimeVariance = printTime - ( self._estimatedPrintTime - estimatedTimeLeft )
666 adjustedEstimatedTime = self._estimatedPrintTime + elaspedTimeVariance
667 estimatedTimeLeft = ( adjustedEstimatedTime * ( 1.0 - progress) ) / 60
668 else:
669 estimatedTimeLeft = 0
670
671 else:
672 estimatedTimeLeft = self._estimatedPrintTime / 60
673
674 value = self._formatPrintingProgressData(progress, self.getPrintFilepos(), printTime, estimatedTimeLeft, self.getCurrentLayer())
675 eventManager().fire(Events.PRINTING_PROGRESS, value)
676
677 self._setProgressData(progress, self.getPrintFilepos(), printTime, estimatedTimeLeft, self.getCurrentLayer())
678
679 def mcHeatingUpUpdate(self, value):
680 self._stateMonitor._state['flags']['heatingUp'] = value

Callers 1

Calls 8

getPrintTimeMethod · 0.95
getPrintProgressMethod · 0.95
getPrintFileposMethod · 0.95
getCurrentLayerMethod · 0.95
_setProgressDataMethod · 0.95
eventManagerFunction · 0.90
fireMethod · 0.80

Tested by

no test coverage detected