Add outputDevice, outputDeviceIcon properties and saveToOutputDevice slot to PrinterApplication

This commit is contained in:
Arjen Hiemstra 2015-04-03 18:03:30 +02:00
parent 77f6929de4
commit f001efde8f

View file

@ -45,6 +45,7 @@ class PrinterApplication(QtApplication):
self._physics = None self._physics = None
self._volume = None self._volume = None
self._platform = None self._platform = None
self._output_source = 'local_file'
self.activeMachineChanged.connect(self._onActiveMachineChanged) self.activeMachineChanged.connect(self._onActiveMachineChanged)
def _loadPlugins(self): def _loadPlugins(self):
@ -257,6 +258,24 @@ class PrinterApplication(QtApplication):
removableDrivesChanged = pyqtSignal() removableDrivesChanged = pyqtSignal()
outputDeviceChanged = pyqtSignal()
@pyqtProperty(str, notify = outputDeviceChanged)
def outputDevice(self):
return self._output_source
@pyqtProperty(str, notify = outputDeviceChanged)
def outputDeviceIcon(self):
if self._output_source == 'local_file':
return 'save'
elif self._output_source == 'sdcard':
return 'save_sd'
elif self._output_source == 'usb':
return 'print_usb'
@pyqtSlot()
def writeToOutputDevice(self):
pass
@pyqtProperty("QStringList", notify = removableDrivesChanged) @pyqtProperty("QStringList", notify = removableDrivesChanged)
def removableDrives(self): def removableDrives(self):
return list(self.getStorageDevice('LocalFileStorage').getRemovableDrives().keys()) return list(self.getStorageDevice('LocalFileStorage').getRemovableDrives().keys())