Change listType -> componentType. Makes it a bit more clear that this variable decides which component should be used for the model.

CURA-9514
This commit is contained in:
joeydelarago 2022-08-31 10:50:20 +02:00
parent f94bbb9ebc
commit 19835844bf
3 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ class MachineListModel(ListModel):
IsOnlineRole = Qt.ItemDataRole.UserRole + 5 IsOnlineRole = Qt.ItemDataRole.UserRole + 5
MachineCountRole = Qt.ItemDataRole.UserRole + 6 MachineCountRole = Qt.ItemDataRole.UserRole + 6
IsAbstractMachineRole = Qt.ItemDataRole.UserRole + 7 IsAbstractMachineRole = Qt.ItemDataRole.UserRole + 7
ListTypeRole = Qt.ItemDataRole.UserRole + 8 ComponentTypeRole = Qt.ItemDataRole.UserRole + 8
def __init__(self, parent=None) -> None: def __init__(self, parent=None) -> None:
super().__init__(parent) super().__init__(parent)
@ -41,7 +41,7 @@ class MachineListModel(ListModel):
self.addRoleName(self.IsOnlineRole, "isOnline") self.addRoleName(self.IsOnlineRole, "isOnline")
self.addRoleName(self.MachineCountRole, "machineCount") self.addRoleName(self.MachineCountRole, "machineCount")
self.addRoleName(self.IsAbstractMachineRole, "isAbstractMachine") self.addRoleName(self.IsAbstractMachineRole, "isAbstractMachine")
self.addRoleName(self.ListTypeRole, "listType") self.addRoleName(self.ComponentTypeRole, "componentType")
self._change_timer = QTimer() self._change_timer = QTimer()
self._change_timer.setInterval(200) self._change_timer.setInterval(200)
@ -103,13 +103,13 @@ class MachineListModel(ListModel):
if len(abstract_machine_stacks) > 0: if len(abstract_machine_stacks) > 0:
if self._show_cloud_printers: if self._show_cloud_printers:
self.appendItem({"listType": "HIDE_BUTTON", self.appendItem({"componentType": "HIDE_BUTTON",
"isOnline": True, "isOnline": True,
"isAbstractMachine": False, "isAbstractMachine": False,
"machineCount": 0 "machineCount": 0
}) })
else: else:
self.appendItem({"listType": "SHOW_BUTTON", self.appendItem({"componentType": "SHOW_BUTTON",
"isOnline": True, "isOnline": True,
"isAbstractMachine": False, "isAbstractMachine": False,
"machineCount": 0 "machineCount": 0
@ -130,7 +130,7 @@ class MachineListModel(ListModel):
has_connection |= connection_type in container_stack.configuredConnectionTypes has_connection |= connection_type in container_stack.configuredConnectionTypes
self.appendItem({ self.appendItem({
"listType": "MACHINE", "componentType": "MACHINE",
"name": container_stack.getName(), "name": container_stack.getName(),
"id": container_stack.getId(), "id": container_stack.getId(),
"metadata": container_stack.getMetaData().copy(), "metadata": container_stack.getMetaData().copy(),

View file

@ -11,7 +11,7 @@ Loader {
id: loader id: loader
width: parent.width width: parent.width
sourceComponent: { sourceComponent: {
switch (model.listType) { switch (model.componentType) {
case "HIDE_BUTTON": case "HIDE_BUTTON":
hideButtonComponent hideButtonComponent
break; break;

View file

@ -35,7 +35,7 @@ ListView
onClicked: function() onClicked: function()
{ {
switch (model.listType) { switch (model.componentType) {
case "HIDE_BUTTON": case "HIDE_BUTTON":
listView.model.setShowCloudPrinters(false); listView.model.setShowCloudPrinters(false);
break; break;