mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 18:27:51 -06:00
Add the compatible machine families property to printerOutputModel
This is used by the cluster to indicate by which families of printers the job can be displayed CL-894
This commit is contained in:
parent
98d0ad6c27
commit
fb1033ad99
4 changed files with 39 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
|
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot
|
||||||
from typing import Optional, TYPE_CHECKING
|
from typing import Optional, TYPE_CHECKING, List
|
||||||
|
|
||||||
from PyQt5.QtCore import QUrl
|
from PyQt5.QtCore import QUrl
|
||||||
from PyQt5.QtGui import QImage
|
from PyQt5.QtGui import QImage
|
||||||
|
@ -23,6 +23,7 @@ class PrintJobOutputModel(QObject):
|
||||||
ownerChanged = pyqtSignal()
|
ownerChanged = pyqtSignal()
|
||||||
configurationChanged = pyqtSignal()
|
configurationChanged = pyqtSignal()
|
||||||
previewImageChanged = pyqtSignal()
|
previewImageChanged = pyqtSignal()
|
||||||
|
compatibleMachineFamiliesChanged = pyqtSignal()
|
||||||
|
|
||||||
def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None:
|
def __init__(self, output_controller: "PrinterOutputController", key: str = "", name: str = "", parent=None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -36,11 +37,21 @@ class PrintJobOutputModel(QObject):
|
||||||
self._owner = "" # Who started/owns the print job?
|
self._owner = "" # Who started/owns the print job?
|
||||||
|
|
||||||
self._configuration = None # type: Optional[ConfigurationModel]
|
self._configuration = None # type: Optional[ConfigurationModel]
|
||||||
|
self._compatible_machine_families = [] # type: List[str]
|
||||||
self._preview_image_id = 0
|
self._preview_image_id = 0
|
||||||
|
|
||||||
self._preview_image = None
|
self._preview_image = None
|
||||||
|
|
||||||
|
@pyqtProperty("QStringList", notify=compatibleMachineFamiliesChanged)
|
||||||
|
def compatibleMachineFamilies(self):
|
||||||
|
# Hack; Some versions of cluster will return a family more than once...
|
||||||
|
return set(self._compatible_machine_families)
|
||||||
|
|
||||||
|
def setCompatibleMachineFamilies(self, compatible_machine_families: List[str]) -> None:
|
||||||
|
if self._compatible_machine_families != compatible_machine_families:
|
||||||
|
self._compatible_machine_families = compatible_machine_families
|
||||||
|
self.compatibleMachineFamiliesChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty(QUrl, notify=previewImageChanged)
|
@pyqtProperty(QUrl, notify=previewImageChanged)
|
||||||
def preview_image_url(self):
|
def preview_image_url(self):
|
||||||
self._preview_image_id += 1
|
self._preview_image_id += 1
|
||||||
|
|
|
@ -552,7 +552,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
||||||
|
|
||||||
configuration.setExtruderConfigurations(extruders)
|
configuration.setExtruderConfigurations(extruders)
|
||||||
print_job.updateConfiguration(configuration)
|
print_job.updateConfiguration(configuration)
|
||||||
|
print_job.setCompatibleMachineFamilies(data["compatible_machine_families"])
|
||||||
print_job.stateChanged.connect(self._printJobStateChanged)
|
print_job.stateChanged.connect(self._printJobStateChanged)
|
||||||
return print_job
|
return print_job
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,30 @@ Item
|
||||||
onOpened: visible = true
|
onOpened: visible = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
id: printerFamilyPills
|
||||||
|
spacing: 0.5 * UM.Theme.getSize("default_margin").width
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: extrudersInfo.top
|
||||||
|
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
}
|
||||||
|
height: childrenRect.height
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: printJob.compatibleMachineFamilies
|
||||||
|
|
||||||
|
delegate: PrinterFamilyPill
|
||||||
|
{
|
||||||
|
text: modelData
|
||||||
|
color: UM.Theme.getColor("viewport_background")
|
||||||
|
padding: 3
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// PrintCore && Material config
|
// PrintCore && Material config
|
||||||
Row
|
Row
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue