mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 07:48:59 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
849e968edb
@ -67,12 +67,25 @@ class DiscoveredPrinter(QObject):
|
|||||||
|
|
||||||
@pyqtProperty(bool, notify = machineTypeChanged)
|
@pyqtProperty(bool, notify = machineTypeChanged)
|
||||||
def isUnknownMachineType(self) -> bool:
|
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)
|
@pyqtProperty(QObject, constant = True)
|
||||||
def device(self) -> "NetworkedPrinterOutputDevice":
|
def device(self) -> "NetworkedPrinterOutputDevice":
|
||||||
return self._device
|
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
|
# 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"]:
|
def discoveredPrinters(self) -> List["DiscoveredPrinter"]:
|
||||||
item_list = list(
|
item_list = list(
|
||||||
x for x in self._discovered_printer_by_ip_dict.values() if not parseBool(x.device.getProperty("temporary")))
|
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],
|
def addDiscoveredPrinter(self, ip_address: str, key: str, name: str, create_callback: Callable[[str], None],
|
||||||
machine_type: str, device: "NetworkedPrinterOutputDevice") -> 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.",
|
"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",
|
"type": "float",
|
||||||
"unit": "mm",
|
"unit": "mm",
|
||||||
"default_value": 0.25,
|
"default_value": 0.20,
|
||||||
"minimum_value": "0.001",
|
"minimum_value": "0.001",
|
||||||
"minimum_value_warning": "0.02",
|
"minimum_value_warning": "0.02",
|
||||||
"maximum_value_warning": "2",
|
"maximum_value_warning": "2",
|
||||||
|
@ -53,7 +53,7 @@ Button
|
|||||||
verticalCenter: parent.verticalCenter
|
verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
text: machineSelectorButton.text
|
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")
|
font: UM.Theme.getFont("medium")
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
@ -68,6 +68,10 @@ Item
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
model: CuraApplication.getDiscoveredPrintersModel().discoveredPrinters
|
model: CuraApplication.getDiscoveredPrintersModel().discoveredPrinters
|
||||||
|
|
||||||
|
section.property: "modelData.sectionName"
|
||||||
|
section.criteria: ViewSection.FullString
|
||||||
|
section.delegate: sectionHeading
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
// Select the first one that's not "unknown" by default.
|
// 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
|
delegate: Cura.MachineSelectorButton
|
||||||
{
|
{
|
||||||
text: modelData.device.name
|
text: modelData.device.name
|
||||||
@ -88,7 +109,7 @@ Item
|
|||||||
width: networkPrinterListView.width
|
width: networkPrinterListView.width
|
||||||
outputDevice: modelData.device
|
outputDevice: modelData.device
|
||||||
|
|
||||||
enabled: !modelData.isUnknownMachineType
|
enabled: !modelData.isUnknownMachineType && modelData.isHostOfGroup
|
||||||
|
|
||||||
printerTypeLabelAutoFit: true
|
printerTypeLabelAutoFit: true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user