diff --git a/cura/Machines/Models/MachineListModel.py b/cura/Machines/Models/MachineListModel.py index 04faa4d1fc..cb7c3b5998 100644 --- a/cura/Machines/Models/MachineListModel.py +++ b/cura/Machines/Models/MachineListModel.py @@ -130,17 +130,21 @@ class MachineListModel(ListModel): if len(abstract_machine_stacks) > 0: if self._show_cloud_printers: - self.appendItem({"componentType": "HIDE_BUTTON", - "isOnline": True, - "isAbstractMachine": False, - "machineCount": 0 - }) + self.appendItem({ + "componentType": "HIDE_BUTTON", + "isOnline": True, + "isAbstractMachine": False, + "machineCount": 0, + "catergory": "connected", + }) else: - self.appendItem({"componentType": "SHOW_BUTTON", - "isOnline": True, - "isAbstractMachine": False, - "machineCount": 0 - }) + self.appendItem({ + "componentType": "SHOW_BUTTON", + "isOnline": True, + "isAbstractMachine": False, + "machineCount": 0, + "catergory": "connected", + }) for stack in other_machine_stacks: self.addItem(stack, False) @@ -150,11 +154,12 @@ class MachineListModel(ListModel): return self.appendItem({ - "componentType": "MACHINE", - "name": container_stack.getName(), - "id": container_stack.getId(), - "metadata": container_stack.getMetaData().copy(), - "isOnline": is_online, - "isAbstractMachine": parseBool(container_stack.getMetaDataEntry("is_abstract_machine", False)), - "machineCount": machine_count, - }) + "componentType": "MACHINE", + "name": container_stack.getName(), + "id": container_stack.getId(), + "metadata": container_stack.getMetaData().copy(), + "isOnline": is_online, + "isAbstractMachine": parseBool(container_stack.getMetaDataEntry("is_abstract_machine", False)), + "machineCount": machine_count, + "catergory": "connected" if is_online else "other", + }) diff --git a/resources/qml/PrinterSelector/MachineSelectorList.qml b/resources/qml/PrinterSelector/MachineSelectorList.qml index 1b0264929d..b3a65da7da 100644 --- a/resources/qml/PrinterSelector/MachineSelectorList.qml +++ b/resources/qml/PrinterSelector/MachineSelectorList.qml @@ -10,7 +10,7 @@ import Cura 1.0 as Cura ListView { id: listView - section.property: "isOnline" + section.property: "category" property real contentHeight: childrenRect.height property var onSelectPrinter @@ -21,7 +21,15 @@ ListView section.delegate: UM.Label { - text: section == "true" ? catalog.i18nc("@label", "Connected printers") : catalog.i18nc("@label", "Other printers") + text: { + switch (section) + { + case "connected": + return catalog.i18nc("@label", "Connected printers"); + case "other": + return catalog.i18nc("@label", "Other printers"); + } + } height: UM.Theme.getSize("action_button").height width: parent.width - scrollBar.width leftPadding: UM.Theme.getSize("default_margin").width