mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 15:13:56 -06:00
Add support for displaying print time and print material amount
This commit is contained in:
parent
0175eb7b59
commit
1c11104dd2
2 changed files with 69 additions and 9 deletions
|
@ -56,6 +56,9 @@ class PrinterApplication(QtApplication):
|
|||
'priority': 0
|
||||
}
|
||||
}
|
||||
self._print_duration = -1
|
||||
self._print_material_amount = -1
|
||||
|
||||
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||
|
||||
Preferences.getInstance().addPreference('cura/active_machine', '')
|
||||
|
@ -114,6 +117,8 @@ class PrinterApplication(QtApplication):
|
|||
|
||||
self.getStorageDevice('LocalFileStorage').removableDrivesChanged.connect(self._removableDrivesChanged)
|
||||
|
||||
self.getBackend().printDurationMessage.connect(self._onPrintDurationMessage)
|
||||
|
||||
if self.getMachines():
|
||||
active_machine_pref = Preferences.getInstance().getValue('cura/active_machine')
|
||||
if active_machine_pref:
|
||||
|
@ -258,6 +263,16 @@ class PrinterApplication(QtApplication):
|
|||
|
||||
return log
|
||||
|
||||
printDurationChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(float, notify = printDurationChanged)
|
||||
def printDuration(self):
|
||||
return self._print_duration
|
||||
|
||||
@pyqtProperty(float, notify = printDurationChanged)
|
||||
def printMaterialAmount(self):
|
||||
return self._print_material_amount
|
||||
|
||||
def _onActiveMachineChanged(self):
|
||||
machine = self.getActiveMachine()
|
||||
if machine:
|
||||
|
@ -356,3 +371,8 @@ class PrinterApplication(QtApplication):
|
|||
if device not in drives:
|
||||
if self._output_devices[device]['function'] == self._writeToSD:
|
||||
self.removeOutputDevice(device)
|
||||
|
||||
def _onPrintDurationMessage(self, duration, material_amount):
|
||||
self._print_duration = duration
|
||||
self._print_material_amount = material_amount
|
||||
self.printDurationChanged.emit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue