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

Method printingInfo

src/astroprint/plugin/services/system.py:270–303  ·  view source on GitHub ↗
(self, data, sendMessage)

Source from the content-addressed store, hash-verified

268 sendMessage("invalid_params",True)
269
270 def printingInfo(self, data, sendMessage):
271 pm = printerManager()
272 result = {}
273
274 if pm.isPrinting() or pm.isPaused():
275
276 # PRINTING INFO
277 currentFile = pm.selectedFile
278 fileName = currentFile["filename"]
279
280 result = pm.getFileInfo(fileName)
281
282 # PRINTING PROGRESS
283 printTime = pm.getPrintTime()
284 progress = pm.getPrintProgress()
285 estimatedTimeLeft = None
286
287 if pm._estimatedPrintTime:
288 if printTime and progress:
289 if progress < 1.0:
290 estimatedTimeLeft = pm._estimatedPrintTime * ( 1.0 - progress )
291 elaspedTimeVariance = printTime - ( pm._estimatedPrintTime - estimatedTimeLeft )
292 adjustedEstimatedTime = pm._estimatedPrintTime + elaspedTimeVariance
293 estimatedTimeLeft = ( adjustedEstimatedTime * ( 1.0 - progress) ) / 60
294 else:
295 estimatedTimeLeft = 0
296
297 else:
298 estimatedTimeLeft = pm._estimatedPrintTime / 60
299
300 value = pm._formatPrintingProgressData(progress, pm.getPrintFilepos(), printTime, estimatedTimeLeft, pm.getCurrentLayer())
301 result['progress'] = value
302
303 sendMessage(result)
304
305 def saveTempPreset(self, data, sendMessage):
306 ppm = printerProfileManager()

Callers

nothing calls this directly

Calls 9

printerManagerFunction · 0.90
getFileInfoMethod · 0.80
getCurrentLayerMethod · 0.80
isPrintingMethod · 0.45
isPausedMethod · 0.45
getPrintTimeMethod · 0.45
getPrintProgressMethod · 0.45
getPrintFileposMethod · 0.45

Tested by

no test coverage detected