Send completion percentage as float (incl. available decimals)

This commit is contained in:
Gina Häußge 2013-12-25 23:39:51 +01:00
parent a0374cb4ea
commit cec2bdb805
3 changed files with 7 additions and 4 deletions

View file

@ -130,7 +130,7 @@ Retrieve information about the current job
} }
}, },
"progress": { "progress": {
"completion": 23, "completion": 0.2298468264184775,
"filepos": 337942, "filepos": 337942,
"printTime": 276, "printTime": 276,
"printTimeLeft": 912 "printTimeLeft": 912
@ -231,7 +231,7 @@ Progress information
- Description - Description
* - ``completion`` * - ``completion``
- 1 - 1
- Integer - Float
- Percentage of completion of the current print job - Percentage of completion of the current print job
* - ``filepos`` * - ``filepos``
- 1 - 1

View file

@ -291,7 +291,7 @@ class Printer():
self._printTimeLeft = printTimeLeft self._printTimeLeft = printTimeLeft
self._stateMonitor.setProgress({ self._stateMonitor.setProgress({
"completion": int(self._progress * 100) if self._progress is not None else None, "completion": self._progress * 100 if self._progress is not None else None,
"filepos": filepos, "filepos": filepos,
"printTime": int(self._printTime) if self._printTime is not None else None, "printTime": int(self._printTime) if self._printTime is not None else None,
"printTimeLeft": int(self._printTimeLeft * 60) if self._printTimeLeft is not None else None "printTimeLeft": int(self._printTimeLeft * 60) if self._printTimeLeft is not None else None
@ -564,6 +564,9 @@ class Printer():
} }
} }
def getTemperatureHistory(self):
return self._temps
def getCurrentConnection(self): def getCurrentConnection(self):
if self._comm is None: if self._comm is None:
return "Closed", None, None return "Closed", None, None

View file

@ -11,7 +11,7 @@ import octoprint.util as util
from octoprint.filemanager.destinations import FileDestinations from octoprint.filemanager.destinations import FileDestinations
from octoprint.settings import settings, valid_boolean_trues from octoprint.settings import settings, valid_boolean_trues
from octoprint.server import printer, gcodeManager, eventManager, restricted_access, NO_CONTENT from octoprint.server import printer, gcodeManager, eventManager, restricted_access, NO_CONTENT
from octoprint.server.util import redirectToTornado, urlForDownload from octoprint.server.util import urlForDownload
from octoprint.server.api import api from octoprint.server.api import api