From 09d1becf1e21dfead6ee3b574cfed41d24d3f31d Mon Sep 17 00:00:00 2001 From: tastyratz Date: Sun, 5 Mar 2023 11:48:45 -0500 Subject: [PATCH 01/16] Update InsertAtLayerChange.py I removed the period from the G-code to insert label for consistency. I also added a third option to this called "Skip layers". This allows you to insert gcode with a specific number of layers skipped (i.e. skip layers 1 will insert gcode every other layer, skip layers 3 will insert every fourth). As an example, this change allowed me to insert a nozzle cleaning routine in my gcode without having to run it EVERY layer. --- .../scripts/InsertAtLayerChange.py | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/plugins/PostProcessingPlugin/scripts/InsertAtLayerChange.py b/plugins/PostProcessingPlugin/scripts/InsertAtLayerChange.py index 5fb506b42b..8cadceb528 100644 --- a/plugins/PostProcessingPlugin/scripts/InsertAtLayerChange.py +++ b/plugins/PostProcessingPlugin/scripts/InsertAtLayerChange.py @@ -26,27 +26,40 @@ class InsertAtLayerChange(Script): }, "gcode_to_add": { - "label": "G-code to insert.", + "label": "G-code to insert", "description": "G-code to add before or after layer change.", "type": "str", "default_value": "" + }, + "skip_layers": + { + "label": "Skip layers", + "description": "Number of layers to skip between insertions (0 for every layer).", + "type": "int", + "default_value": 0, + "minimum_value": 0 } } }""" def execute(self, data): gcode_to_add = self.getSettingValueByKey("gcode_to_add") + "\n" + skip_layers = self.getSettingValueByKey("skip_layers") + count = 0 for layer in data: # Check that a layer is being printed lines = layer.split("\n") for line in lines: if ";LAYER:" in line: index = data.index(layer) - if self.getSettingValueByKey("insert_location") == "before": - layer = gcode_to_add + layer - else: - layer = layer + gcode_to_add + if count == 0: + if self.getSettingValueByKey("insert_location") == "before": + layer = gcode_to_add + layer + else: + layer = layer + gcode_to_add - data[index] = layer + data[index] = layer + + count = (count + 1) % (skip_layers + 1) break return data From 2249e298cabf9214aaa6de62779b3d94f014fad9 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Wed, 3 Apr 2024 12:32:25 +0200 Subject: [PATCH 02/16] Implement printer search feature in local printer selection Added a search field in the 'Add Local Printer' section which allows users to search for their desired printer. A timer has been set to trigger the search function as the user types into the search field. A clear button is visible for easy removal of the search text. Adjusted the ListModel.py to correctly emit dataChanged signal when there are changes in the list. CURA-11003 --- .../AddLocalPrinterScrollView.qml | 98 ++++++++++++++++++- 1 file changed, 95 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index eb19e5234e..d61350cf97 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -15,7 +15,7 @@ import Cura 1.1 as Cura Item { id: base - + property bool findingPrinter: false // The currently selected machine item in the local machine list. property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null // The currently active (expanded) section/category, where section/category is the grouping of local machine items. @@ -63,6 +63,14 @@ Item } return undefined; } + Timer + { + id: printerSearchTimer + onTriggered: filter.editingFinished() + interval: 500 + running: false + repeat: false + } Component.onCompleted: { @@ -73,6 +81,90 @@ Item base.currentSections = base.currentSections; } + Cura.TextField + { + id: filter + width: Math.floor(parent.width * 0.48) + implicitHeight: parent.height + placeholderText: catalog.i18nc("@label:textbox", "Search Printer") + font: UM.Theme.getFont("default_italic") + leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 + property var expandedCategories + property bool lastFindingPrinters: false + + UM.ColorImage + { + id: searchIcon + source: UM.Theme.getIcon("Magnifier") + anchors + { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + } + height: UM.Theme.getSize("small_button_icon").height + width: height + color: UM.Theme.getColor("text") + } + + onTextChanged: printerSearchTimer.restart() + onEditingFinished: + { + console.log("here") + machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} + findingPrinters = (text.length > 0) + if (findingPrinters != lastFindingPrinters) + { + updateDefinitionModel() + lastFindingPrinters = findingPrinters + } + } + + Keys.onEscapePressed: filter.text = "" + function updateDefinitionModel() + { + if (findingPrinters) + { + expandedCategories = machineDefinitionsModel.expanded.slice() + machineDefinitionsModel.expanded = [""] // keep categories closed while to prevent render while making settings visible one by one + machineDefinitionsModel.showAncestors = true + machineDefinitionsModel.showAll = true + machineDefinitionsModel.expanded = ["*"] + } + else + { + if (expandedCategories) + { + machineDefinitionsModel.expanded = expandedCategories + } + machineDefinitionsModel.showAncestors = false + machineDefinitionsModel.showAll = false + } + } + } + UM.SimpleButton + { + id: clearFilterButton + iconSource: UM.Theme.getIcon("Cancel") + visible: findingPrinters + + height: Math.round(filter.height * 0.4) + width: visible ? height : 0 + + anchors.verticalCenter: filter.verticalCenter + anchors.right: filter.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + color: UM.Theme.getColor("setting_control_button") + hoverColor: UM.Theme.getColor("setting_control_button_hover") + + onClicked: + { + filter.text = "" + filter.forceActiveFocus() + } + } + Row { id: localPrinterSelectionItem @@ -83,8 +175,8 @@ Item { id: machineList width: Math.floor(parent.width * 0.48) - height: parent.height - + height: parent.height - filter.height + y: filter.height clip: true ScrollBar.vertical: UM.ScrollBar {} From 56d6325671d4b64a6468ff7bd2cbd97b9201b0d6 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Wed, 3 Apr 2024 14:50:14 +0200 Subject: [PATCH 03/16] expanding found machines inside sections CURA-11003 --- .../AddLocalPrinterScrollView.qml | 52 ++++++++++++------- 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index d61350cf97..d84ac15275 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -15,7 +15,7 @@ import Cura 1.1 as Cura Item { id: base - property bool findingPrinter: false + property bool findingPrinters: false // The currently selected machine item in the local machine list. property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null // The currently active (expanded) section/category, where section/category is the grouping of local machine items. @@ -63,6 +63,7 @@ Item } return undefined; } + Timer { id: printerSearchTimer @@ -110,43 +111,53 @@ Item onTextChanged: printerSearchTimer.restart() onEditingFinished: { - console.log("here") machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} - findingPrinters = (text.length > 0) - if (findingPrinters != lastFindingPrinters) + base.findingPrinters = (text.length > 0) + if (base.findingPrinters != lastFindingPrinters) { updateDefinitionModel() - lastFindingPrinters = findingPrinters + lastFindingPrinters = base.findingPrinters } } Keys.onEscapePressed: filter.text = "" function updateDefinitionModel() { - if (findingPrinters) + if (base.findingPrinters) { - expandedCategories = machineDefinitionsModel.expanded.slice() - machineDefinitionsModel.expanded = [""] // keep categories closed while to prevent render while making settings visible one by one - machineDefinitionsModel.showAncestors = true - machineDefinitionsModel.showAll = true - machineDefinitionsModel.expanded = ["*"] + base.currentSections.clear() + for (var i = 0; i < machineDefinitionsModel.count; i++) + { + var sectionexpanded = machineDefinitionsModel.getItem(i)["section"] + if (!base.currentSections.has(sectionexpanded)) + { + base.currentSections.add(sectionexpanded); + } + } + updateCurrentItemUponSectionChange(base.currentSections[0]); + // Trigger update on base.currentSections + base.currentSections = base.currentSections; + // Set the machineName to the first element of the list + machineList.currentIndex = 0 } else { - if (expandedCategories) - { - machineDefinitionsModel.expanded = expandedCategories - } - machineDefinitionsModel.showAncestors = false - machineDefinitionsModel.showAll = false + const initialSection = "Ultimaker B.V."; + base.currentSections.clear(); + base.currentSections.add(initialSection); + updateCurrentItemUponSectionChange(initialSection); + // Trigger update on base.currentSections + base.currentSections = base.currentSections; + machineList.currentIndex = 0 } + } } UM.SimpleButton { id: clearFilterButton iconSource: UM.Theme.getIcon("Cancel") - visible: findingPrinters + visible: base.findingPrinters height: Math.round(filter.height * 0.4) width: visible ? height : 0 @@ -230,6 +241,11 @@ Item } onClicked: + { + changeVisibility() + } + + function changeVisibility() { if (base.currentSections.has(section)) { From 4c42ed7085d336b92a0cd57dfd1b6912aca486e8 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Wed, 3 Apr 2024 16:16:28 +0200 Subject: [PATCH 04/16] Refactor code in AddLocalPrinterScrollView.qml The commit simplifies the function for updating current items in the AddLocalPrinterScrollView.qml file. It also removes unnecessary properties and functions, streamlining the process for setting printer info. The changes improve code readability and efficiency CURA-11003 --- .../AddLocalPrinterScrollView.qml | 47 +++++++------------ 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index d84ac15275..8fa456b6ff 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -43,25 +43,22 @@ Item const item = machineList.model.getItem(i); if (item.section == section) { - machineList.currentIndex = i; + updateCurrentItem(i) break; } } } - function getMachineName() + function updateCurrentItem(index) { - return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : ""; - } - - function getMachineMetaDataEntry(key) - { - var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined; - if (metadata) + machineList.currentIndex = index; + currentItem = machineList.model.getItem(index); + if (currentItem != undefined) { - return metadata[key]; + machineName.text = currentItem.name + manufacturer.text = currentItem.metadata["manufacturer"] + author.text = currentItem.metadata["author"] } - return undefined; } Timer @@ -90,8 +87,6 @@ Item placeholderText: catalog.i18nc("@label:textbox", "Search Printer") font: UM.Theme.getFont("default_italic") leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 - property var expandedCategories - property bool lastFindingPrinters: false UM.ColorImage { @@ -113,11 +108,7 @@ Item { machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} base.findingPrinters = (text.length > 0) - if (base.findingPrinters != lastFindingPrinters) - { - updateDefinitionModel() - lastFindingPrinters = base.findingPrinters - } + updateDefinitionModel() } Keys.onEscapePressed: filter.text = "" @@ -134,11 +125,10 @@ Item base.currentSections.add(sectionexpanded); } } - updateCurrentItemUponSectionChange(base.currentSections[0]); + base.updateCurrentItem(0) + // Trigger update on base.currentSections base.currentSections = base.currentSections; - // Set the machineName to the first element of the list - machineList.currentIndex = 0 } else { @@ -146,9 +136,9 @@ Item base.currentSections.clear(); base.currentSections.add(initialSection); updateCurrentItemUponSectionChange(initialSection); + updateCurrentItem(0) // Trigger update on base.currentSections base.currentSections = base.currentSections; - machineList.currentIndex = 0 } } @@ -241,11 +231,6 @@ Item } onClicked: - { - changeVisibility() - } - - function changeVisibility() { if (base.currentSections.has(section)) { @@ -277,7 +262,7 @@ Item checked: machineList.currentIndex == index text: name visible: base.currentSections.has(section) - onClicked: machineList.currentIndex = index + onClicked: base.updateCurrentItem(index) } } @@ -301,8 +286,8 @@ Item UM.Label { + id: machineName width: parent.width - (2 * UM.Theme.getSize("default_margin").width) - text: base.getMachineName() color: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("huge") elide: Text.ElideRight @@ -323,7 +308,7 @@ Item } UM.Label { - text: base.getMachineMetaDataEntry("manufacturer") + id: manufacturer width: parent.width - manufacturerLabel.width wrapMode: Text.WordWrap } @@ -334,7 +319,7 @@ Item } UM.Label { - text: base.getMachineMetaDataEntry("author") + id: author width: parent.width - profileAuthorLabel.width wrapMode: Text.WordWrap } From 2ed0377a052586fafa5557bbaa79c2e01313c33c Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 4 Apr 2024 14:09:58 +0200 Subject: [PATCH 05/16] added column for removing the magic number CURA-11003 --- .../AddLocalPrinterScrollView.qml | 325 +++++++++--------- 1 file changed, 168 insertions(+), 157 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 8fa456b6ff..f90c38757a 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -15,7 +15,7 @@ import Cura 1.1 as Cura Item { id: base - property bool findingPrinters: false + property bool searchFilterApplied: false // The currently selected machine item in the local machine list. property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null // The currently active (expanded) section/category, where section/category is the grouping of local machine items. @@ -65,7 +65,7 @@ Item { id: printerSearchTimer onTriggered: filter.editingFinished() - interval: 500 + interval: 50 running: false repeat: false } @@ -79,190 +79,201 @@ Item base.currentSections = base.currentSections; } - Cura.TextField - { - id: filter - width: Math.floor(parent.width * 0.48) - implicitHeight: parent.height - placeholderText: catalog.i18nc("@label:textbox", "Search Printer") - font: UM.Theme.getFont("default_italic") - leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 - - UM.ColorImage - { - id: searchIcon - source: UM.Theme.getIcon("Magnifier") - anchors - { - verticalCenter: parent.verticalCenter - left: parent.left - leftMargin: UM.Theme.getSize("default_margin").width - } - height: UM.Theme.getSize("small_button_icon").height - width: height - color: UM.Theme.getColor("text") - } - - onTextChanged: printerSearchTimer.restart() - onEditingFinished: - { - machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} - base.findingPrinters = (text.length > 0) - updateDefinitionModel() - } - - Keys.onEscapePressed: filter.text = "" - function updateDefinitionModel() - { - if (base.findingPrinters) - { - base.currentSections.clear() - for (var i = 0; i < machineDefinitionsModel.count; i++) - { - var sectionexpanded = machineDefinitionsModel.getItem(i)["section"] - if (!base.currentSections.has(sectionexpanded)) - { - base.currentSections.add(sectionexpanded); - } - } - base.updateCurrentItem(0) - - // Trigger update on base.currentSections - base.currentSections = base.currentSections; - } - else - { - const initialSection = "Ultimaker B.V."; - base.currentSections.clear(); - base.currentSections.add(initialSection); - updateCurrentItemUponSectionChange(initialSection); - updateCurrentItem(0) - // Trigger update on base.currentSections - base.currentSections = base.currentSections; - } - - } - } - UM.SimpleButton - { - id: clearFilterButton - iconSource: UM.Theme.getIcon("Cancel") - visible: base.findingPrinters - - height: Math.round(filter.height * 0.4) - width: visible ? height : 0 - - anchors.verticalCenter: filter.verticalCenter - anchors.right: filter.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - - color: UM.Theme.getColor("setting_control_button") - hoverColor: UM.Theme.getColor("setting_control_button_hover") - - onClicked: - { - filter.text = "" - filter.forceActiveFocus() - } - } - Row { id: localPrinterSelectionItem anchors.fill: parent - //Selecting a local printer to add from this list. - ListView + Column { - id: machineList + id: root width: Math.floor(parent.width * 0.48) - height: parent.height - filter.height - y: filter.height - clip: true - ScrollBar.vertical: UM.ScrollBar {} - - model: UM.DefinitionContainersModel + height: parent.height + Item { - id: machineDefinitionsModel - filter: { "visible": true } - sectionProperty: "manufacturer" - preferredSections: preferredCategories - } - - section.property: "section" - section.delegate: Button - { - id: button - width: machineList.width - height: UM.Theme.getSize("action_button").height - text: section - - property bool isActive: base.currentSections.has(section) - - background: Rectangle + width: root.width + height: filter.height + Cura.TextField { - anchors.fill: parent - color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent" - } - - contentItem: Item - { - width: childrenRect.width - height: UM.Theme.getSize("action_button").height + id: filter + width:parent.width + implicitHeight: parent.height + placeholderText: catalog.i18nc("@label:textbox", "Search Printer") + font: UM.Theme.getFont("default_italic") + leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 UM.ColorImage { - id: arrow - anchors.left: parent.left - width: UM.Theme.getSize("standard_arrow").width - height: UM.Theme.getSize("standard_arrow").height + id: searchIcon + source: UM.Theme.getIcon("Magnifier") + anchors + { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: UM.Theme.getSize("default_margin").width + } + height: UM.Theme.getSize("small_button_icon").height + width: height color: UM.Theme.getColor("text") - source: isActive ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight") } - UM.Label + onTextChanged: printerSearchTimer.restart() + onEditingFinished: { - id: label - anchors.left: arrow.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - text: button.text - font: UM.Theme.getFont("default_bold") + machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} + base.searchFilterApplied = (text.length > 0) + updateDefinitionModel() + } + + Keys.onEscapePressed: filter.text = "" + function updateDefinitionModel() + { + if (base.searchFilterApplied) + { + base.currentSections.clear() + for (var i = 0; i < machineDefinitionsModel.count; i++) + { + var sectionexpanded = machineDefinitionsModel.getItem(i)["section"] + if (!base.currentSections.has(sectionexpanded)) + { + base.currentSections.add(sectionexpanded); + } + } + base.updateCurrentItem(0) + + // Trigger update on base.currentSections + base.currentSections = base.currentSections; + } + else + { + const initialSection = "Ultimaker B.V."; + base.currentSections.clear(); + base.currentSections.add(initialSection); + updateCurrentItemUponSectionChange(initialSection); + updateCurrentItem(0) + // Trigger update on base.currentSections + base.currentSections = base.currentSections; + } + } } - onClicked: + UM.SimpleButton { - if (base.currentSections.has(section)) + id: clearFilterButton + iconSource: UM.Theme.getIcon("Cancel") + visible: base.searchFilterApplied + + height: Math.round(filter.height * 0.4) + width: visible ? height : 0 + + anchors.verticalCenter: filter.verticalCenter + anchors.right: filter.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + + color: UM.Theme.getColor("setting_control_button") + hoverColor: UM.Theme.getColor("setting_control_button_hover") + + onClicked: { - base.currentSections.delete(section); + filter.text = "" + filter.forceActiveFocus() } - else - { - base.currentSections.add(section); - base.updateCurrentItemUponSectionChange(section); - } - // Trigger update on base.currentSections - base.currentSections = base.currentSections; } } - delegate: Cura.RadioButton + //Selecting a local printer to add from this list. + ListView { - id: radioButton - anchors + id: machineList + width:root.width + height: root.height - filter.height + clip: true + ScrollBar.vertical: UM.ScrollBar {} + + model: UM.DefinitionContainersModel { - left: parent !== null ? parent.left : undefined - leftMargin: UM.Theme.getSize("standard_list_lineheight").width - - right: parent !== null ? parent.right : undefined - rightMargin: UM.Theme.getSize("default_margin").width + id: machineDefinitionsModel + filter: { "visible": true } + sectionProperty: "manufacturer" + preferredSections: preferredCategories } - height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830. - checked: machineList.currentIndex == index - text: name - visible: base.currentSections.has(section) - onClicked: base.updateCurrentItem(index) + section.property: "section" + section.delegate: Button + { + id: button + width: machineList.width + height: UM.Theme.getSize("action_button").height + text: section + + property bool isActive: base.currentSections.has(section) + + background: Rectangle + { + anchors.fill: parent + color: isActive ? UM.Theme.getColor("setting_control_highlight") : "transparent" + } + + contentItem: Item + { + width: childrenRect.width + height: UM.Theme.getSize("action_button").height + + UM.ColorImage + { + id: arrow + anchors.left: parent.left + width: UM.Theme.getSize("standard_arrow").width + height: UM.Theme.getSize("standard_arrow").height + color: UM.Theme.getColor("text") + source: isActive ? UM.Theme.getIcon("ChevronSingleDown") : UM.Theme.getIcon("ChevronSingleRight") + } + + UM.Label + { + id: label + anchors.left: arrow.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + text: button.text + font: UM.Theme.getFont("default_bold") + } + } + + onClicked: + { + if (base.currentSections.has(section)) + { + base.currentSections.delete(section); + } + else + { + base.currentSections.add(section); + base.updateCurrentItemUponSectionChange(section); + } + // Trigger update on base.currentSections + base.currentSections = base.currentSections; + } + } + + delegate: Cura.RadioButton + { + id: radioButton + anchors + { + left: parent !== null ? parent.left : undefined + leftMargin: UM.Theme.getSize("standard_list_lineheight").width + + right: parent !== null ? parent.right : undefined + rightMargin: UM.Theme.getSize("default_margin").width + } + height: visible ? UM.Theme.getSize("standard_list_lineheight").height : 0 //This causes the scrollbar to vary in length due to QTBUG-76830. + + checked: machineList.currentIndex == index + text: name + visible: base.currentSections.has(section) + onClicked: base.updateCurrentItem(index) + } } } From f35865e3c48fcd57b9768c176bf41ec4ad79d65b Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 4 Apr 2024 14:13:58 +0200 Subject: [PATCH 06/16] property name hasSearchFilter changed CURA-11003 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index f90c38757a..3aeb94db60 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -15,7 +15,7 @@ import Cura 1.1 as Cura Item { id: base - property bool searchFilterApplied: false + property bool hasSearchFilter: false // The currently selected machine item in the local machine list. property var currentItem: machineList.currentIndex >= 0 ? machineList.model.getItem(machineList.currentIndex) : null // The currently active (expanded) section/category, where section/category is the grouping of local machine items. @@ -121,14 +121,14 @@ Item onEditingFinished: { machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} - base.searchFilterApplied = (text.length > 0) + base.hasSearchFilter = (text.length > 0) updateDefinitionModel() } Keys.onEscapePressed: filter.text = "" function updateDefinitionModel() { - if (base.searchFilterApplied) + if (base.hasSearchFilter) { base.currentSections.clear() for (var i = 0; i < machineDefinitionsModel.count; i++) @@ -162,7 +162,7 @@ Item { id: clearFilterButton iconSource: UM.Theme.getIcon("Cancel") - visible: base.searchFilterApplied + visible: base.hasSearchFilter height: Math.round(filter.height * 0.4) width: visible ? height : 0 From 7a6f195b74d96937a92d7b94ff3f91459762c62e Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Thu, 4 Apr 2024 14:37:51 +0200 Subject: [PATCH 07/16] changed filter from "id" to "name" as both are different CURA-11003 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 3aeb94db60..4d0c0f1124 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -120,7 +120,7 @@ Item onTextChanged: printerSearchTimer.restart() onEditingFinished: { - machineDefinitionsModel.filter = {"id" : "*" + text.toLowerCase() + "*", "visible": true} + machineDefinitionsModel.filter = {"name" : "*" + text.toLowerCase() + "*", "visible": true} base.hasSearchFilter = (text.length > 0) updateDefinitionModel() } From 66754d837b42650968cf3ff6d4c447144c548fc6 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Fri, 5 Apr 2024 16:24:21 +0200 Subject: [PATCH 08/16] Remove redundant printerSearchTimer CURA-11003 --- .../qml/WelcomePages/AddLocalPrinterScrollView.qml | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 4d0c0f1124..f0f86bb17a 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -61,15 +61,6 @@ Item } } - Timer - { - id: printerSearchTimer - onTriggered: filter.editingFinished() - interval: 50 - running: false - repeat: false - } - Component.onCompleted: { const initialSection = "Ultimaker B.V."; @@ -117,7 +108,7 @@ Item color: UM.Theme.getColor("text") } - onTextChanged: printerSearchTimer.restart() + onTextChanged: filter.editingFinished() onEditingFinished: { machineDefinitionsModel.filter = {"name" : "*" + text.toLowerCase() + "*", "visible": true} From 7231c273a1602e22d3741515626f7956f1e22460 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Fri, 5 Apr 2024 16:26:33 +0200 Subject: [PATCH 09/16] Refactor textChanged event helps to increase code readability and maintainability. CURA-11003 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index f0f86bb17a..7a80c2403b 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -108,7 +108,7 @@ Item color: UM.Theme.getColor("text") } - onTextChanged: filter.editingFinished() + onTextChanged: editingFinished() onEditingFinished: { machineDefinitionsModel.filter = {"name" : "*" + text.toLowerCase() + "*", "visible": true} From 54636c3421b23a6578561d924831a533911fdcd6 Mon Sep 17 00:00:00 2001 From: GregValiant <64202104+GregValiant@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:32:28 -0400 Subject: [PATCH 10/16] Monitor Page Preheat values Change the default preheat values to the Initial Layer values. --- resources/qml/PrintMonitor.qml | 2 +- resources/qml/PrinterOutput/ExtruderBox.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 027586c381..cda7bb743b 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -129,7 +129,7 @@ ScrollView { id: bedTemperature containerStack: Cura.MachineManager.activeMachine - key: "material_bed_temperature" + key: "material_bed_temperature_layer_0" watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] storeIndex: 0 } diff --git a/resources/qml/PrinterOutput/ExtruderBox.qml b/resources/qml/PrinterOutput/ExtruderBox.qml index 46deec29ef..d6ce75a15a 100644 --- a/resources/qml/PrinterOutput/ExtruderBox.qml +++ b/resources/qml/PrinterOutput/ExtruderBox.qml @@ -22,7 +22,7 @@ Item { id: extruderTemperature containerStackId: Cura.ExtruderManager.extruderIds[position] - key: "material_print_temperature" + key: "material_print_temperature_layer_0" watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] storeIndex: 0 } From d017f0ec9c3f75509157d63fb2732209b006d51e Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Mon, 8 Apr 2024 15:37:48 +0200 Subject: [PATCH 11/16] increased size of clear icon CURA-11003 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 7a80c2403b..f876abf24f 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -155,7 +155,7 @@ Item iconSource: UM.Theme.getIcon("Cancel") visible: base.hasSearchFilter - height: Math.round(filter.height * 0.4) + height: Math.round(filter.height * 0.5) width: visible ? height : 0 anchors.verticalCenter: filter.verticalCenter From 3908db7696b9a73fc69fea2f4305fe50d051a274 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Wed, 10 Apr 2024 15:45:24 +0200 Subject: [PATCH 12/16] Update search bar style and theme alteration CURA-11003 --- .../qml/WelcomePages/AddLocalPrinterScrollView.qml | 11 ++++++++++- resources/themes/cura-light/theme.json | 6 ++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index f876abf24f..0376bfcfcc 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -89,8 +89,17 @@ Item id: filter width:parent.width implicitHeight: parent.height + background: Rectangle { + id: background + color: UM.Theme.getColor("main_background") + radius: 2 + border.width: 1 + border.color: UM.Theme.getColor("primary_button") + } + height: UM.Theme.getSize("small_button_icon").height*2 placeholderText: catalog.i18nc("@label:textbox", "Search Printer") - font: UM.Theme.getFont("default_italic") + placeholderTextColor: UM.Theme.getColor("primary_button") + font: UM.Theme.getFont("medium_italic") leftPadding: searchIcon.width + UM.Theme.getSize("default_margin").width * 2 UM.ColorImage diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json index 8f3f9076c5..7d320091a0 100644 --- a/resources/themes/cura-light/theme.json +++ b/resources/themes/cura-light/theme.json @@ -110,6 +110,12 @@ "italic": true, "family": "Noto Sans" }, + "medium_italic": { + "size": 1.16, + "weight": 400, + "italic": true, + "family": "Noto Sans" + }, "default_italic_ja_JP": { "size": 1.0, "weight": 400, From 1457569aeb8226157e5f0a1bee40b4780e29a432 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Wed, 10 Apr 2024 17:24:55 +0200 Subject: [PATCH 13/16] Fix handling of undefined printer items in AddLocalPrinterScrollView This commit addresses an issue wherein undefined current items were not properly handled in the AddLocalPrinterScrollView module. We've changed the code so that it now checks if currentItem and currentItem.name exist before attempting to assign. If they don't exist, we now set default values to avoid null or undefined references. This prevents potential errors or inconsistent behaviors in the UI. CURA-11003 --- .../qml/WelcomePages/AddLocalPrinterScrollView.qml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 0376bfcfcc..1b00aad94a 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -32,7 +32,7 @@ Item onCurrentItemChanged: { - printerName = currentItem == null ? "" : currentItem.name + printerName = currentItem && currentItem.name? currentItem.name: "" } function updateCurrentItemUponSectionChange(section) @@ -53,12 +53,18 @@ Item { machineList.currentIndex = index; currentItem = machineList.model.getItem(index); - if (currentItem != undefined) + if (currentItem && currentItem.name) { machineName.text = currentItem.name manufacturer.text = currentItem.metadata["manufacturer"] author.text = currentItem.metadata["author"] } + else + { + machineName.text = "No printers Found" + manufacturer.text = "" + author.text = "" + } } Component.onCompleted: @@ -93,7 +99,6 @@ Item id: background color: UM.Theme.getColor("main_background") radius: 2 - border.width: 1 border.color: UM.Theme.getColor("primary_button") } height: UM.Theme.getSize("small_button_icon").height*2 From a3911bdbfa47b0825d9b4980584fa9cf37ed52a1 Mon Sep 17 00:00:00 2001 From: Saumya Jain Date: Fri, 12 Apr 2024 12:29:07 +0200 Subject: [PATCH 14/16] PR comments CURA-11003 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 1b00aad94a..fba51ad4e7 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -98,10 +98,10 @@ Item background: Rectangle { id: background color: UM.Theme.getColor("main_background") - radius: 2 - border.color: UM.Theme.getColor("primary_button") + radius: UM.Theme.getSize("default_radius").width + border.color: UM.Theme.getColor("primary_button") } - height: UM.Theme.getSize("small_button_icon").height*2 + height: UM.Theme.getSize("small_button_icon").height * 2 placeholderText: catalog.i18nc("@label:textbox", "Search Printer") placeholderTextColor: UM.Theme.getColor("primary_button") font: UM.Theme.getFont("medium_italic") From 17372064c736e3bf1ef95dc7ff518359f4c82e3a Mon Sep 17 00:00:00 2001 From: Saumya Jain <70144862+saumyaj3@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:31:52 +0200 Subject: [PATCH 15/16] Update resources/qml/WelcomePages/AddLocalPrinterScrollView.qml Co-authored-by: Jaime van Kessel --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index fba51ad4e7..491156b3d8 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -93,7 +93,7 @@ Item Cura.TextField { id: filter - width:parent.width + width: parent.width implicitHeight: parent.height background: Rectangle { id: background From fd01684a23cb52a8ba6b4ada32c8c28347c56ad3 Mon Sep 17 00:00:00 2001 From: Saumya Jain <70144862+saumyaj3@users.noreply.github.com> Date: Fri, 12 Apr 2024 12:31:57 +0200 Subject: [PATCH 16/16] Update resources/qml/WelcomePages/AddLocalPrinterScrollView.qml Co-authored-by: Jaime van Kessel --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 491156b3d8..7f311b7187 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -191,7 +191,7 @@ Item ListView { id: machineList - width:root.width + width: root.width height: root.height - filter.height clip: true ScrollBar.vertical: UM.ScrollBar {}