mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Move information related to print time etc. into a PrintInformation class
This commit is contained in:
parent
1c11104dd2
commit
49e80c30e5
2 changed files with 194 additions and 14 deletions
|
@ -23,6 +23,7 @@ from UM.Operations.SetTransformOperation import SetTransformOperation
|
|||
from PlatformPhysics import PlatformPhysics
|
||||
from BuildVolume import BuildVolume
|
||||
from CameraAnimation import CameraAnimation
|
||||
from PrintInformation import PrintInformation
|
||||
|
||||
from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty
|
||||
from PyQt5.QtGui import QColor
|
||||
|
@ -56,8 +57,7 @@ class PrinterApplication(QtApplication):
|
|||
'priority': 0
|
||||
}
|
||||
}
|
||||
self._print_duration = -1
|
||||
self._print_material_amount = -1
|
||||
self._print_information = None
|
||||
|
||||
self.activeMachineChanged.connect(self._onActiveMachineChanged)
|
||||
|
||||
|
@ -117,8 +117,6 @@ 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:
|
||||
|
@ -139,6 +137,8 @@ class PrinterApplication(QtApplication):
|
|||
|
||||
def registerObjects(self, engine):
|
||||
engine.rootContext().setContextProperty('Printer', self)
|
||||
self._print_information = PrintInformation()
|
||||
engine.rootContext().setContextProperty('PrintInformation', self._print_information)
|
||||
|
||||
def onSelectionChanged(self):
|
||||
if Selection.hasSelection():
|
||||
|
@ -263,16 +263,6 @@ 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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue