Allow access to the current printed file position
This commit is contained in:
1 parent
06f7abdb2d
commit
e04bdb3571
2 files changed
+20
-3
No files matched your search
@@ -405,6 +405,15 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
|
||||
self._setProgressData(completion=0)
|
||||
self._setCurrentZ(None)
|
||||
|
||||
def get_file_position(self):
|
||||
if self._comm is None:
|
||||
return None
|
||||
|
||||
if self._selectedFile is None:
|
||||
return None
|
||||
|
||||
return self._comm.getFilePosition()
|
||||
|
||||
def start_print(self, pos=None):
|
||||
"""
|
||||
Starts the currently loaded print job.
|
||||
|
||||
@@ -939,15 +939,23 @@ class MachineCom(object):
|
||||
|
||||
##~~ record aborted file positions
|
||||
|
||||
def _recordFilePosition(self):
|
||||
def getFilePosition(self):
|
||||
if self._currentFile is None:
|
||||
return
|
||||
return None
|
||||
|
||||
origin = self._currentFile.getFileLocation()
|
||||
filename = self._currentFile.getFilename()
|
||||
pos = self._currentFile.getFilepos()
|
||||
|
||||
self._callback.on_comm_record_fileposition(origin, filename, pos)
|
||||
return dict(origin=origin,
|
||||
filename=filename,
|
||||
pos=pos)
|
||||
|
||||
def _recordFilePosition(self):
|
||||
if self._currentFile is None:
|
||||
return
|
||||
data = self.getFilePosition()
|
||||
self._callback.on_comm_record_fileposition(data["origin"], data["filename"], data["pos"])
|
||||
|
||||
##~~ communication monitoring and handling
|
||||
|
||||
|
||||
Reference in new issue
Block a user