mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 21:13:58 -06:00
Merge branch 'master' into CURA-6435_new_style_add_machine
This commit is contained in:
commit
d72911df84
4 changed files with 52 additions and 6 deletions
|
@ -67,12 +67,25 @@ class DiscoveredPrinter(QObject):
|
|||
|
||||
@pyqtProperty(bool, notify = machineTypeChanged)
|
||||
def isUnknownMachineType(self) -> bool:
|
||||
return self.readableMachineType.lower() == "unknown"
|
||||
from cura.CuraApplication import CuraApplication
|
||||
readable_type = CuraApplication.getInstance().getMachineManager().getMachineTypeNameFromId(self._machine_type)
|
||||
return not readable_type
|
||||
|
||||
@pyqtProperty(QObject, constant = True)
|
||||
def device(self) -> "NetworkedPrinterOutputDevice":
|
||||
return self._device
|
||||
|
||||
@pyqtProperty(bool, constant = True)
|
||||
def isHostOfGroup(self) -> bool:
|
||||
return getattr(self._device, "clusterSize", 1) > 0
|
||||
|
||||
@pyqtProperty(str, constant = True)
|
||||
def sectionName(self) -> str:
|
||||
if self.isUnknownMachineType or not self.isHostOfGroup:
|
||||
return catalog.i18nc("@label", "The printer(s) below cannot be connected because they are part of a group")
|
||||
else:
|
||||
return catalog.i18nc("@label", "Available networked printers")
|
||||
|
||||
|
||||
#
|
||||
# Discovered printers are all the printers that were found on the network, which provide a more convenient way
|
||||
|
@ -92,8 +105,20 @@ class DiscoveredPrintersModel(QObject):
|
|||
def discoveredPrinters(self) -> List["DiscoveredPrinter"]:
|
||||
item_list = list(
|
||||
x for x in self._discovered_printer_by_ip_dict.values() if not parseBool(x.device.getProperty("temporary")))
|
||||
item_list.sort(key = lambda x: x.device.name)
|
||||
return item_list
|
||||
|
||||
# Split the printers into 2 lists and sort them ascending based on names.
|
||||
available_list = []
|
||||
not_available_list = []
|
||||
for item in item_list:
|
||||
if item.isUnknownMachineType or getattr(item.device, "clusterSize", 1) < 1:
|
||||
not_available_list.append(item)
|
||||
else:
|
||||
available_list.append(item)
|
||||
|
||||
available_list.sort(key = lambda x: x.device.name)
|
||||
not_available_list.sort(key = lambda x: x.device.name)
|
||||
|
||||
return available_list + not_available_list
|
||||
|
||||
def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None],
|
||||
machine_type: str, device: "NetworkedPrinterOutputDevice") -> None:
|
||||
|
|
|
@ -5853,7 +5853,7 @@
|
|||
"description": "The minimum size of a line segment after slicing. If you increase this, the mesh will have a lower resolution. This may allow the printer to keep up with the speed it has to process g-code and will increase slice speed by removing details of the mesh that it can't process anyway.",
|
||||
"type": "float",
|
||||
"unit": "mm",
|
||||
"default_value": 0.25,
|
||||
"default_value": 0.20,
|
||||
"minimum_value": "0.001",
|
||||
"minimum_value_warning": "0.02",
|
||||
"maximum_value_warning": "2",
|
||||
|
|
|
@ -53,7 +53,7 @@ Button
|
|||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
text: machineSelectorButton.text
|
||||
color: UM.Theme.getColor("text")
|
||||
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("small_button_text")
|
||||
font: UM.Theme.getFont("medium")
|
||||
visible: text != ""
|
||||
renderType: Text.NativeRendering
|
||||
|
|
|
@ -68,6 +68,10 @@ Item
|
|||
anchors.fill: parent
|
||||
model: CuraApplication.getDiscoveredPrintersModel().discoveredPrinters
|
||||
|
||||
section.property: "modelData.sectionName"
|
||||
section.criteria: ViewSection.FullString
|
||||
section.delegate: sectionHeading
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Select the first one that's not "unknown" by default.
|
||||
|
@ -81,6 +85,23 @@ Item
|
|||
}
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: sectionHeading
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
height: UM.Theme.getSize("setting_control").height
|
||||
text: section
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("small_button_text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Cura.MachineSelectorButton
|
||||
{
|
||||
text: modelData.device.name
|
||||
|
@ -88,7 +109,7 @@ Item
|
|||
width: networkPrinterListView.width
|
||||
outputDevice: modelData.device
|
||||
|
||||
enabled: !modelData.isUnknownMachineType
|
||||
enabled: !modelData.isUnknownMachineType && modelData.isHostOfGroup
|
||||
|
||||
printerTypeLabelAutoFit: true
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue