(self, filename, sd, printAfterSelect=False, printJobId=None)
| 73 | #return self._sdFiles |
| 74 | |
| 75 | def selectFile(self, filename, sd, printAfterSelect=False, printJobId=None): |
| 76 | if sd and not self._plugin.allowSDCardPrinting: |
| 77 | raise('Printing from SD card is not supported on this printer') |
| 78 | |
| 79 | if not super(PrinterWithPlugin, self).selectFile(filename, sd, printAfterSelect, printJobId): |
| 80 | return False |
| 81 | |
| 82 | if not os.path.exists(filename) or not os.path.isfile(filename): |
| 83 | raise IOError("File %s does not exist" % filename) |
| 84 | |
| 85 | filesize = os.stat(filename).st_size |
| 86 | |
| 87 | eventManager().fire(Events.FILE_SELECTED, { |
| 88 | "file": filename, |
| 89 | "origin": FileDestinations.SDCARD if sd else FileDestinations.LOCAL |
| 90 | }) |
| 91 | |
| 92 | self._setJobData(filename, filesize, sd) |
| 93 | self.refreshStateData() |
| 94 | |
| 95 | self._currentFile = { |
| 96 | 'filename': filename, |
| 97 | 'size': filesize, |
| 98 | 'origin': FileDestinations.SDCARD if sd else FileDestinations.LOCAL, |
| 99 | 'start_time': None, |
| 100 | 'progress': None, |
| 101 | 'position': None |
| 102 | } |
| 103 | |
| 104 | if printAfterSelect: |
| 105 | self.startPrint() |
| 106 | |
| 107 | return True |
| 108 | |
| 109 | def startPrint(self, printJobId=None): |
| 110 | if not super(PrinterWithPlugin, self).startPrint(printJobId): |
nothing calls this directly
no test coverage detected