From 98275d2da056a6e3a0feabcf663d101bc1340bd5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 13:44:55 +0200 Subject: [PATCH 01/13] Create first start model on demand So if we don't use it, we don't spend any time on it. --- cura/CuraApplication.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index e5fe813bbd..4ce8eadaf8 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -224,7 +224,7 @@ class CuraApplication(QtApplication): self._quality_management_model = None self._discovered_printer_model = DiscoveredPrintersModel(self, parent = self) - self._first_start_machine_actions_model = FirstStartMachineActionsModel(self, parent = self) + self._first_start_machine_actions_model = None self._welcome_pages_model = WelcomePagesModel(self, parent = self) self._add_printer_pages_model = AddPrinterPagesModel(self, parent = self) self._whats_new_pages_model = WhatsNewPagesModel(self, parent = self) @@ -878,6 +878,8 @@ class CuraApplication(QtApplication): @pyqtSlot(result = QObject) def getFirstStartMachineActionsModel(self, *args) -> "FirstStartMachineActionsModel": + if self._first_start_machine_actions_model is None: + self._first_start_machine_actions_model = FirstStartMachineActionsModel(self, parent = self) return self._first_start_machine_actions_model @pyqtSlot(result = QObject) From 11bf91ae388fcea4325dc1a5d9880b8c10632252 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 13:52:45 +0200 Subject: [PATCH 02/13] Prevent type coercion in qml This should speed things up a tiny bit --- resources/qml/Settings/SettingView.qml | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index c2f23a6f1d..c917badb42 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -228,7 +228,7 @@ Item model: UM.SettingDefinitionsModel { id: definitionsModel - containerId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.definition.id: "" + containerId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.definition.id: "" visibilityHandler: UM.SettingPreferenceVisibilityHandler { } exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order", "cutting_mesh", "support_mesh", "anti_overhang_mesh"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false. expanded: CuraApplication.expandedCategories @@ -244,40 +244,40 @@ Item onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate() } - property var indexWithFocus: -1 + property int indexWithFocus: -1 delegate: Loader { id: delegate width: scrollView.width - height: provider.properties.enabled == "True" ? UM.Theme.getSize("section").height : - contents.spacing + height: provider.properties.enabled === "True" ? UM.Theme.getSize("section").height : - contents.spacing Behavior on height { NumberAnimation { duration: 100 } } - opacity: provider.properties.enabled == "True" ? 1 : 0 + opacity: provider.properties.enabled === "True" ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 100 } } enabled: { if (!Cura.ExtruderManager.activeExtruderStackId && machineExtruderCount.properties.value > 1) { // disable all controls on the global tab, except categories - return model.type == "category" + return model.type === "category" } - return provider.properties.enabled == "True" + return provider.properties.enabled === "True" } property var definition: model property var settingDefinitionsModel: definitionsModel property var propertyProvider: provider property var globalPropertyProvider: inheritStackProvider - property var externalResetHandler: false + property bool externalResetHandler: false property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. - asynchronous: model.type != "enum" && model.type != "extruder" && model.type != "optional_extruder" - active: model.type != undefined + asynchronous: model.type !== "enum" && model.type !== "extruder" && model.type !== "optional_extruder" + active: model.type !== undefined source: { @@ -313,7 +313,7 @@ Item { target: provider property: "containerStackId" - when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0); + when: model.settable_per_extruder || (inheritStackProvider.properties.limit_to_extruder !== null && inheritStackProvider.properties.limit_to_extruder >= 0); value: { // Associate this binding with Cura.MachineManager.activeMachine.id in the beginning so this @@ -326,7 +326,7 @@ Item //Not settable per extruder or there only is global, so we must pick global. return delegate.activeMachineId } - if (inheritStackProvider.properties.limit_to_extruder != null && inheritStackProvider.properties.limit_to_extruder >= 0) + if (inheritStackProvider.properties.limit_to_extruder !== null && inheritStackProvider.properties.limit_to_extruder >= 0) { //We have limit_to_extruder, so pick that stack. return Cura.ExtruderManager.extruderIds[String(inheritStackProvider.properties.limit_to_extruder)]; @@ -359,7 +359,7 @@ Item key: model.key ? model.key : "" watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ] storeIndex: 0 - removeUnusedValue: model.resolve == undefined + removeUnusedValue: model.resolve === undefined } Connections @@ -465,7 +465,7 @@ Item //: Settings context menu action text: catalog.i18nc("@action:menu", "Copy value to all extruders") visible: machineExtruderCount.properties.value > 1 - enabled: contextMenu.provider != undefined && contextMenu.provider.properties.settable_per_extruder != "False" + enabled: contextMenu.provider !== undefined && contextMenu.provider.properties.settable_per_extruder !== "False" onTriggered: Cura.MachineManager.copyValueToExtruders(contextMenu.key) } @@ -474,7 +474,7 @@ Item //: Settings context menu action text: catalog.i18nc("@action:menu", "Copy all changed values to all extruders") visible: machineExtruderCount.properties.value > 1 - enabled: contextMenu.provider != undefined + enabled: contextMenu.provider !== undefined onTriggered: Cura.MachineManager.copyAllValuesToExtruders() } From 624b8d87417ae55f050fdd2d194750ee84255b80 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 14:28:09 +0200 Subject: [PATCH 03/13] Prevent unneeded re-evaluation of ActiveMachine ID property --- resources/qml/Settings/SettingView.qml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index c917badb42..20e9af59db 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -245,7 +245,7 @@ Item } property int indexWithFocus: -1 - + property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" delegate: Loader { id: delegate @@ -271,8 +271,6 @@ Item property var globalPropertyProvider: inheritStackProvider property bool externalResetHandler: false - property string activeMachineId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id : "" - //Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989 //In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes, //causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely. @@ -324,7 +322,7 @@ Item if (!model.settable_per_extruder) { //Not settable per extruder or there only is global, so we must pick global. - return delegate.activeMachineId + return contents.activeMachineId } if (inheritStackProvider.properties.limit_to_extruder !== null && inheritStackProvider.properties.limit_to_extruder >= 0) { @@ -337,7 +335,7 @@ Item return Cura.ExtruderManager.activeExtruderStackId; } //No extruder tab is selected. Pick the global stack. Shouldn't happen any more since we removed the global tab. - return delegate.activeMachineId + return contents.activeMachineId } } @@ -346,7 +344,7 @@ Item UM.SettingPropertyProvider { id: inheritStackProvider - containerStackId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" + containerStackId: contents.activeMachineId key: model.key watchedProperties: [ "limit_to_extruder" ] } @@ -355,7 +353,7 @@ Item { id: provider - containerStackId: delegate.activeMachineId + containerStackId: contents.activeMachineId key: model.key ? model.key : "" watchedProperties: [ "value", "enabled", "state", "validationState", "settable_per_extruder", "resolve" ] storeIndex: 0 From f090b5898e93cd6b8204ed7ab793d0128cf59fcf Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:09:31 +0200 Subject: [PATCH 04/13] Small qml speed improvements for setting item --- cura/Settings/SettingInheritanceManager.py | 2 +- resources/qml/Settings/SettingItem.qml | 32 ++++++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 12b541c3d8..780b2c8705 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -89,7 +89,7 @@ class SettingInheritanceManager(QObject): @pyqtSlot() def forceUpdate(self) -> None: - self._update() + self._update_timer.start() def _onActiveExtruderChanged(self) -> None: new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack() diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index c851b7c042..e2e8d9fbad 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -23,17 +23,16 @@ Item property alias contents: controlContainer.children property alias hovered: mouse.containsMouse - property var showRevertButton: true - property var showInheritButton: true - property var showLinkedSettingIcon: true - property var doDepthIndentation: true - property var doQualityUserSettingEmphasis: true + property bool showRevertButton: true + property bool showInheritButton: true + property bool showLinkedSettingIcon: true + property bool doDepthIndentation: true + property bool doQualityUserSettingEmphasis: true property var settingKey: definition.key //Used to detect each individual setting more easily in Squish GUI tests. // Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise) property var state: propertyProvider.properties.state - // There is no resolve property if there is only one stack. - property var resolve: Cura.MachineManager.activeStackId !== Cura.MachineManager.activeMachine.id ? propertyProvider.properties.resolve : "None" + property var resolve: propertyProvider.properties.resolve property var stackLevels: propertyProvider.stackLevels property var stackLevel: stackLevels[0] // A list of stack levels that will trigger to show the revert button @@ -149,7 +148,7 @@ Item color: UM.Theme.getColor("setting_control_text") opacity: (definition.visible) ? 1 : 0.5 // emphasize the setting if it has a value in the user or quality profile - font: base.doQualityUserSettingEmphasis && base.stackLevel != undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default") + font: base.doQualityUserSettingEmphasis && base.stackLevel !== undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default") } Row @@ -170,10 +169,11 @@ Item { id: linkedSettingIcon; - visible: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon + visible: Cura.MachineManager.activeStack !== Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon - height: parent.height; - width: height; + anchors.top: parent.top + anchors.bottom: parent.bottom + width: height color: UM.Theme.getColor("setting_control_button") hoverColor: UM.Theme.getColor("setting_control_button") @@ -184,7 +184,7 @@ Item { hoverTimer.stop() var tooltipText = catalog.i18nc("@label", "This setting is always shared between all extruders. Changing it here will change the value for all extruders.") - if ((resolve != "None") && (stackLevel != 0)) + if ((resolve !== "None") && (stackLevel !== 0)) { // We come here if a setting has a resolve and the setting is not manually edited. tooltipText += " " + catalog.i18nc("@label", "The value is resolved from per-extruder values ") + "[" + Cura.ExtruderManager.getInstanceExtruderValues(definition.key) + "]." @@ -200,7 +200,8 @@ Item visible: base.resetButtonVisible - height: parent.height + anchors.top: parent.top + anchors.bottom: parent.bottom width: height color: UM.Theme.getColor("setting_control_button") @@ -278,7 +279,8 @@ Item return Cura.SettingInheritanceManager.getOverridesForExtruder(definition.key, String(globalPropertyProvider.properties.limit_to_extruder)).indexOf(definition.key) >= 0 } - height: parent.height + anchors.top: parent.top + anchors.bottom: parent.bottom width: height onClicked: @@ -296,7 +298,7 @@ Item break } } - if ((last_entry == 4 || last_entry == 11) && base.stackLevel == 0 && base.stackLevels.length == 2) + if ((last_entry === 4 || last_entry === 11) && base.stackLevel === 0 && base.stackLevels.length === 2) { // Special case of the inherit reset. If only the definition (4th or 11th) container) and the first // entry (user container) are set, we can simply remove the container. From 93e97c5dcef0d48f68b7162adaa02b6d42d32b8d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:15:21 +0200 Subject: [PATCH 05/13] Add update timer to intentCategory model --- cura/Machines/Models/IntentCategoryModel.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cura/Machines/Models/IntentCategoryModel.py b/cura/Machines/Models/IntentCategoryModel.py index add70f4c1a..0ff52b325a 100644 --- a/cura/Machines/Models/IntentCategoryModel.py +++ b/cura/Machines/Models/IntentCategoryModel.py @@ -1,7 +1,7 @@ #Copyright (c) 2019 Ultimaker B.V. #Cura is released under the terms of the LGPLv3 or higher. -from PyQt5.QtCore import Qt +from PyQt5.QtCore import Qt, QTimer import collections from typing import TYPE_CHECKING, Optional, Dict @@ -69,6 +69,11 @@ class IntentCategoryModel(ListModel): extruder_manager = application.getExtruderManager() extruder_manager.extrudersChanged.connect(self.update) + self._update_timer = QTimer() + self._update_timer.setInterval(500) + self._update_timer.setSingleShot(True) + self._update_timer.timeout.connect(self._update) + self.update() ## Updates the list of intents if an intent profile was added or removed. @@ -76,8 +81,11 @@ class IntentCategoryModel(ListModel): if container.getMetaDataEntry("type") == "intent": self.update() + def update(self): + self._update_timer.start() + ## Updates the list of intents. - def update(self) -> None: + def _update(self) -> None: available_categories = IntentManager.getInstance().currentAvailableIntentCategories() result = [] for category in available_categories: From 27701f765310bb58dc76373abe97a02f84ae5a2d Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:28:17 +0200 Subject: [PATCH 06/13] Add a few process events to setActiveMachine to make it react more smooth --- cura/Settings/MachineManager.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index aa48e39410..69fa907d8b 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -291,7 +291,8 @@ class MachineManager(QObject): @pyqtSlot(str) def setActiveMachine(self, stack_id: str) -> None: self.blurSettings.emit() # Ensure no-one has focus. - + self._application.processEvents() + container_registry = CuraContainerRegistry.getInstance() containers = container_registry.findContainerStacks(id = stack_id) if not containers: @@ -301,9 +302,11 @@ class MachineManager(QObject): # Make sure that the default machine actions for this machine have been added self._application.getMachineActionManager().addDefaultMachineActions(global_stack) + self._application.processEvents() extruder_manager = ExtruderManager.getInstance() extruder_manager.fixSingleExtrusionMachineExtruderDefinition(global_stack) + self._application.processEvents() if not global_stack.isValid(): # Mark global stack as invalid ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) @@ -313,8 +316,12 @@ class MachineManager(QObject): extruder_manager.addMachineExtruders(global_stack) self._application.setGlobalContainerStack(global_stack) + self._application.processEvents() + # Switch to the first enabled extruder self.updateDefaultExtruder() + + self._application.processEvents() default_extruder_position = int(self.defaultExtruderPosition) old_active_extruder_index = extruder_manager.activeExtruderIndex extruder_manager.setActiveExtruderIndex(default_extruder_position) From 7f1cc84eb4ffb88be0d1a5d4cbb43e2fde097e38 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:36:49 +0200 Subject: [PATCH 07/13] Simplify visible check for linkedSettings Icon It was checking for a statement that is never True --- resources/qml/Settings/SettingItem.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index e2e8d9fbad..3531b10244 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -169,7 +169,7 @@ Item { id: linkedSettingIcon; - visible: Cura.MachineManager.activeStack !== Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon + visible: (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon anchors.top: parent.top anchors.bottom: parent.bottom From 5f2984b77ea350a6d59425988dfb122647956ae2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:42:07 +0200 Subject: [PATCH 08/13] Remove unused catalog 20ms faster is 20ms faster... --- .../Recommended/RecommendedPrintSetup.qml | 6 ------ resources/qml/Settings/SettingView.qml | 2 -- 2 files changed, 8 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml index a180ad6324..22c4039063 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedPrintSetup.qml @@ -19,12 +19,6 @@ Item property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1 property real padding: UM.Theme.getSize("thick_margin").width - UM.I18nCatalog - { - id: catalog - name: "cura" - } - Column { spacing: UM.Theme.getSize("wide_margin").height diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 20e9af59db..53e432ecae 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -419,8 +419,6 @@ Item } } - UM.I18nCatalog { id: catalog; name: "cura"; } - NumberAnimation { id: animateContentY target: contents From 4cc8bf594688ff81f8cce668fd702c86ca714edb Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 25 Oct 2019 15:54:45 +0200 Subject: [PATCH 09/13] Create tooltips on demand instead of on creation. This makes the loading of setting items a *lot* more faster, as each string takes about 2.5 ms to create (and we load all of them in memory!). --- resources/qml/Settings/SettingItem.qml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/qml/Settings/SettingItem.qml b/resources/qml/Settings/SettingItem.qml index 3531b10244..e1b3f5a098 100644 --- a/resources/qml/Settings/SettingItem.qml +++ b/resources/qml/Settings/SettingItem.qml @@ -56,7 +56,8 @@ Item signal showTooltip(string text) signal hideTooltip() signal showAllHiddenInheritedSettings(string category_id) - property string tooltipText: + + function createTooltipText() { var affects = settingDefinitionsModel.getRequiredBy(definition.key, "value") var affected_by = settingDefinitionsModel.getRequires(definition.key, "value") @@ -127,7 +128,7 @@ Item onTriggered: { - base.showTooltip(base.tooltipText) + base.showTooltip(base.createTooltipText()) } } @@ -191,7 +192,7 @@ Item } base.showTooltip(tooltipText) } - onExited: base.showTooltip(base.tooltipText) + onExited: base.showTooltip(base.createTooltipText()) } UM.SimpleButton @@ -228,7 +229,7 @@ Item hoverTimer.stop() base.showTooltip(catalog.i18nc("@label", "This setting has a value that is different from the profile.\n\nClick to restore the value of the profile.")) } - onExited: base.showTooltip(base.tooltipText) + onExited: base.showTooltip(base.createTooltipText()) } UM.SimpleButton @@ -322,7 +323,7 @@ Item iconSource: UM.Theme.getIcon("formula") onEntered: { hoverTimer.stop(); base.showTooltip(catalog.i18nc("@label", "This setting is normally calculated, but it currently has an absolute value set.\n\nClick to restore the calculated value.")) } - onExited: base.showTooltip(base.tooltipText) + onExited: base.showTooltip(base.createTooltipText()) } } From 95350cda51f35a1b4552846dafb4ceef77edc6bd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Oct 2019 16:04:43 +0100 Subject: [PATCH 10/13] Revert "Add a few process events to setActiveMachine to make it react more smooth" This reverts commit 27701f765310bb58dc76373abe97a02f84ae5a2d. After discussion with Nallath we've decided that it wasn't that noticeable and could temporarily display wrong names in the interface. We've decided to undo it for now. Contributes to issue CURA-6932. --- cura/Settings/MachineManager.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 69fa907d8b..aa48e39410 100755 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -291,8 +291,7 @@ class MachineManager(QObject): @pyqtSlot(str) def setActiveMachine(self, stack_id: str) -> None: self.blurSettings.emit() # Ensure no-one has focus. - self._application.processEvents() - + container_registry = CuraContainerRegistry.getInstance() containers = container_registry.findContainerStacks(id = stack_id) if not containers: @@ -302,11 +301,9 @@ class MachineManager(QObject): # Make sure that the default machine actions for this machine have been added self._application.getMachineActionManager().addDefaultMachineActions(global_stack) - self._application.processEvents() extruder_manager = ExtruderManager.getInstance() extruder_manager.fixSingleExtrusionMachineExtruderDefinition(global_stack) - self._application.processEvents() if not global_stack.isValid(): # Mark global stack as invalid ConfigurationErrorMessage.getInstance().addFaultyContainers(global_stack.getId()) @@ -316,12 +313,8 @@ class MachineManager(QObject): extruder_manager.addMachineExtruders(global_stack) self._application.setGlobalContainerStack(global_stack) - self._application.processEvents() - # Switch to the first enabled extruder self.updateDefaultExtruder() - - self._application.processEvents() default_extruder_position = int(self.defaultExtruderPosition) old_active_extruder_index = extruder_manager.activeExtruderIndex extruder_manager.setActiveExtruderIndex(default_extruder_position) From 7204deac0ccc3b5f7bcd7dbe84f07d835225a4ff Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 28 Oct 2019 16:07:35 +0100 Subject: [PATCH 11/13] Rename function to beter reflect what it does CURA-6932 --- cura/Settings/SettingInheritanceManager.py | 2 +- resources/qml/Settings/SettingView.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 780b2c8705..8be0813d0a 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -88,7 +88,7 @@ class SettingInheritanceManager(QObject): self.settingsWithIntheritanceChanged.emit() @pyqtSlot() - def forceUpdate(self) -> None: + def scheduleUpdate(self) -> None: self._update_timer.start() def _onActiveExtruderChanged(self) -> None: diff --git a/resources/qml/Settings/SettingView.qml b/resources/qml/Settings/SettingView.qml index 53e432ecae..5aea939728 100644 --- a/resources/qml/Settings/SettingView.qml +++ b/resources/qml/Settings/SettingView.qml @@ -241,7 +241,7 @@ Item CuraApplication.setExpandedCategories(expanded) } } - onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate() + onVisibilityChanged: Cura.SettingInheritanceManager.scheduleUpdate() } property int indexWithFocus: -1 From 26ba0e645a973d051347902affc1baf3d43fe837 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 28 Oct 2019 16:33:08 +0100 Subject: [PATCH 12/13] Ensure that first start machine actions model gets initialized CURA-6932 --- cura/CuraApplication.py | 2 ++ cura/Machines/Models/FirstStartMachineActionsModel.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 4ce8eadaf8..f88467d651 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -880,6 +880,8 @@ class CuraApplication(QtApplication): def getFirstStartMachineActionsModel(self, *args) -> "FirstStartMachineActionsModel": if self._first_start_machine_actions_model is None: self._first_start_machine_actions_model = FirstStartMachineActionsModel(self, parent = self) + if self.started: + self._first_start_machine_actions_model.initialize() return self._first_start_machine_actions_model @pyqtSlot(result = QObject) diff --git a/cura/Machines/Models/FirstStartMachineActionsModel.py b/cura/Machines/Models/FirstStartMachineActionsModel.py index ce0e9bf856..92caed7b12 100644 --- a/cura/Machines/Models/FirstStartMachineActionsModel.py +++ b/cura/Machines/Models/FirstStartMachineActionsModel.py @@ -33,11 +33,11 @@ class FirstStartMachineActionsModel(ListModel): self._current_action_index = 0 self._application = application - self._application.initializationFinished.connect(self._initialize) + self._application.initializationFinished.connect(self.initialize) self._previous_global_stack = None - def _initialize(self) -> None: + def initialize(self) -> None: self._application.getMachineManager().globalContainerChanged.connect(self._update) self._update() From 8154ca5f7ced9a2a1ba96af2d627f3faef9f1f60 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 28 Oct 2019 16:42:24 +0100 Subject: [PATCH 13/13] Improve translations for option for heated build plate Eigenbouw is typisch zo'n woord bedacht door iemand die helemaal verzadigd is na een lange dag vertalen... Discovered while working on issue CURA-6932. --- resources/i18n/nl_NL/cura.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/nl_NL/cura.po b/resources/i18n/nl_NL/cura.po index d15742a101..3059e4aa1d 100644 --- a/resources/i18n/nl_NL/cura.po +++ b/resources/i18n/nl_NL/cura.po @@ -2795,7 +2795,7 @@ msgstr "Selecteer eventuele upgrades die op deze Ultimaker Original zijn uitgevo #: /home/ruben/Projects/Cura/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml:41 msgctxt "@label" msgid "Heated Build Plate (official kit or self-built)" -msgstr "Verwarmd Platform (officiƫle kit of eigenbouw)" +msgstr "Verwarmd Platform (officiƫle kit of zelf gebouwd)" #: /home/ruben/Projects/Cura/resources/qml/MonitorButton.qml:119 msgctxt "@label:MonitorStatus"