From 91ad5b84615a3c3b026786e98937561c7df91230 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Fri, 1 Jul 2022 14:53:35 +0200 Subject: [PATCH 01/64] Hide some very difficult to explain (even to experts) settings. It'll just confuse users. It confused _us_ (both developers and materials experts) a lot of the time :-D CURA-9357 --- resources/definitions/fdmprinter.def.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index c33723ddfd..aec1103fb3 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -1236,7 +1236,8 @@ "default_value": 50, "value": "max(1, min(99, 100 * (2 * min_even_wall_line_width - wall_line_width_0) / wall_line_width_0))", "minimum_value": "1", - "maximum_value": "99" + "maximum_value": "99", + "enabled": false } } }, @@ -1261,7 +1262,8 @@ "default_value": 75, "value": "max(1, min(99, 100 * min_odd_wall_line_width / wall_line_width_x))", "minimum_value": "1", - "maximum_value": "99" + "maximum_value": "99", + "enabled": false } } } From 5c81904aeeb70643a17d7514d88d4a01a54b440a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Tue, 5 Jul 2022 17:58:57 +0200 Subject: [PATCH 02/64] Don't hide, just remove. Also updated in the engine, so anyone needs the corresponding branch there as well. CURA-9357 --- resources/definitions/fdmprinter.def.json | 34 ++--------------------- 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index aec1103fb3..8f6e5cc037 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -1225,21 +1225,7 @@ "default_value": 0.3, "value": "min_wall_line_width", "type": "float", - "settable_per_mesh": true, - "children": - { - "wall_split_middle_threshold": { - "label": "Split Middle Line Threshold", - "description": "The smallest line width, as a factor of the normal line width, above which the middle line (if there is one) will be split into two. Reduce this setting to use more, thinner lines. Increase to use fewer, wider lines. Note that this applies -as if- the entire shape should be filled with wall, so the middle here refers to the middle of the object between two outer edges of the shape, even if there actually is fill or (other) skin in the print instead of wall.", - "type": "float", - "unit": "%", - "default_value": 50, - "value": "max(1, min(99, 100 * (2 * min_even_wall_line_width - wall_line_width_0) / wall_line_width_0))", - "minimum_value": "1", - "maximum_value": "99", - "enabled": false - } - } + "settable_per_mesh": true }, "min_odd_wall_line_width": { @@ -1251,21 +1237,7 @@ "default_value": 0.3, "value": "min_wall_line_width", "type": "float", - "settable_per_mesh": true, - "children": - { - "wall_add_middle_threshold": { - "label": "Add Middle Line Threshold", - "description": "The smallest line width, as a factor of the normal line width, above which a middle line (if there wasn't one already) will be added. Reduce this setting to use more, thinner lines. Increase to use fewer, wider lines. Note that this applies -as if- the entire shape should be filled with wall, so the middle here refers to the middle of the object between two outer edges of the shape, even if there actually is fill or (other) skin in the print instead of wall.", - "type": "float", - "unit": "%", - "default_value": 75, - "value": "max(1, min(99, 100 * min_odd_wall_line_width / wall_line_width_x))", - "minimum_value": "1", - "maximum_value": "99", - "enabled": false - } - } + "settable_per_mesh": true } } }, @@ -8051,7 +8023,7 @@ "label": "Remove Raft Inside Corners", "description": "Remove inside corners from the raft, causing the raft to become convex.", "type": "bool", - "default_value": false, + "default_value": true, "resolve": "any(extruderValues('raft_remove_inside_corners'))", "enabled": "resolveOrValue('adhesion_type') == 'raft'", "settable_per_mesh": false, From cfeab2e6c0a51b9b6490927cb6a801ac0a7271c6 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Sun, 31 Jul 2022 11:46:03 +0200 Subject: [PATCH 03/64] Use dataclasses for Peripheral Since Peripheral is a data class use dataclasses --- cura/PrinterOutput/Peripheral.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cura/PrinterOutput/Peripheral.py b/cura/PrinterOutput/Peripheral.py index 27d127832b..4613506978 100644 --- a/cura/PrinterOutput/Peripheral.py +++ b/cura/PrinterOutput/Peripheral.py @@ -1,20 +1,19 @@ # Copyright (c) 2019 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +from dataclasses import dataclass +@dataclass class Peripheral: """Data class that represents a peripheral for a printer. Output device plug-ins may specify that the printer has a certain set of peripherals. This set is then possibly shown in the interface of the monitor stage. + + Args: + type (string): A unique ID for the type of peripheral. + name (string): A human-readable name for the peripheral. """ - - def __init__(self, peripheral_type: str, name: str) -> None: - """Constructs the peripheral. - - :param peripheral_type: A unique ID for the type of peripheral. - :param name: A human-readable name for the peripheral. - """ - self.type = peripheral_type - self.name = name + type: str + name: str From b13b7a892d4a4fe59bbfb30f668a885694204b11 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Tue, 2 Aug 2022 08:30:08 +0200 Subject: [PATCH 04/64] Move _error_check_timer initialization to a separate function This simplifies understanding the class __init__ function --- cura/Machines/MachineErrorChecker.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cura/Machines/MachineErrorChecker.py b/cura/Machines/MachineErrorChecker.py index 2cb333d157..b4614089d9 100644 --- a/cura/Machines/MachineErrorChecker.py +++ b/cura/Machines/MachineErrorChecker.py @@ -45,16 +45,12 @@ class MachineErrorChecker(QObject): self._start_time = 0. # measure checking time - # This timer delays the starting of error check so we can react less frequently if the user is frequently - # changing settings. - self._error_check_timer = QTimer(self) - self._error_check_timer.setInterval(100) - self._error_check_timer.setSingleShot(True) + self._setCheckTimer() self._keys_to_check = set() # type: Set[str] self._num_keys_to_check_per_update = 10 - + def initialize(self) -> None: self._error_check_timer.timeout.connect(self._rescheduleCheck) @@ -66,6 +62,18 @@ class MachineErrorChecker(QObject): self._onMachineChanged() + def _setCheckTimer(self) -> None: + """A QTimer to regulate error check frequency + + This timer delays the starting of error check + so we can react less frequently if the user is frequently + changing settings. + """ + + self._error_check_timer = QTimer(self) + self._error_check_timer.setInterval(100) + self._error_check_timer.setSingleShot(True) + def _onMachineChanged(self) -> None: if self._global_stack: self._global_stack.propertyChanged.disconnect(self.startErrorCheckPropertyChanged) From cba2e07adc7e93b08c7bb1864a0308ff7289ba15 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Tue, 2 Aug 2022 09:08:46 +0200 Subject: [PATCH 05/64] Remove extra spaces --- cura/Machines/MachineErrorChecker.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Machines/MachineErrorChecker.py b/cura/Machines/MachineErrorChecker.py index b4614089d9..b113bd6dd7 100644 --- a/cura/Machines/MachineErrorChecker.py +++ b/cura/Machines/MachineErrorChecker.py @@ -50,7 +50,7 @@ class MachineErrorChecker(QObject): self._keys_to_check = set() # type: Set[str] self._num_keys_to_check_per_update = 10 - + def initialize(self) -> None: self._error_check_timer.timeout.connect(self._rescheduleCheck) From 60c8712b10cd5612c09412c2d7405a8ffe070005 Mon Sep 17 00:00:00 2001 From: digitalfrost Date: Tue, 9 Aug 2022 11:42:18 +0200 Subject: [PATCH 06/64] CuraContainerStack.py: improve TypeIndexMap Cleaner and more idiomatic way to reverse a dictionary --- cura/Settings/CuraContainerStack.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/CuraContainerStack.py b/cura/Settings/CuraContainerStack.py index 5348deb4bd..a8a1d780ea 100755 --- a/cura/Settings/CuraContainerStack.py +++ b/cura/Settings/CuraContainerStack.py @@ -427,4 +427,4 @@ class _ContainerIndexes: } # Reverse lookup: type -> index - TypeIndexMap = dict([(v, k) for k, v in IndexTypeMap.items()]) + TypeIndexMap = {v: k for k, v in IndexTypeMap.items()} From fd8d6498ee0f84f49996a427fdb4680ea3216ea2 Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Wed, 10 Aug 2022 16:45:16 +0200 Subject: [PATCH 07/64] When changing to an intent with infillDensity > 100 in recommended settings the RecommendedInfillDensitySelector would set infillDensity=100. This is because the onValueChanged function checks if the slider has a different value from the settings and updates the settings if it does. The slider has a max value of 100, so when setting the sliders value to 1000 the slider would update to have a value of 100. This would then update the setting to value to 100. The fix is as follows. When updating the slider value > 100 just ignore the first onValueChanged. Following onValueChanged, which are triggered by the user sliding the slider, will still trigger. CURA-9488 --- .../RecommendedInfillDensitySelector.qml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml index bb3b0cdbec..0317cb7814 100644 --- a/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml +++ b/resources/qml/PrintSetupSelector/Recommended/RecommendedInfillDensitySelector.qml @@ -51,7 +51,17 @@ Item { target: infillSlider property: "value" - value: parseInt(infillDensity.properties.value) + value: { + // The infill slider has a max value of 100. When it is given a value > 100 onValueChanged updates the setting to be 100. + // When changing to an intent with infillDensity > 100, it would always be clamped to 100. + // This will force the slider to ignore the first onValueChanged for values > 100 so higher values can be set. + var density = parseInt(infillDensity.properties.value) + if (density > 100) { + infillSlider.ignoreValueChange = true + } + + return density + } } // Here are the elements that are shown in the left column @@ -84,6 +94,8 @@ Item { id: infillSlider + property var ignoreValueChange: false + width: parent.width height: UM.Theme.getSize("print_setup_slider_handle").height // The handle is the widest element of the slider @@ -157,7 +169,13 @@ Item target: infillSlider function onValueChanged() { - // Don't round the value if it's already the same + if (infillSlider.ignoreValueChange) + { + infillSlider.ignoreValueChange = false + return + } + + // Don't update if the setting value, if the slider has the same value if (parseInt(infillDensity.properties.value) == infillSlider.value) { return From a0f32c403d8b41302316f5939de07fd5dfa6e88d Mon Sep 17 00:00:00 2001 From: joeydelarago Date: Thu, 11 Aug 2022 16:44:07 +0200 Subject: [PATCH 08/64] Move run configuration templates out of conan-config into this repo. Add extra test run configuration. CURA-8792 --- .run_templates/pycharm_cura_run.run.xml.jinja | 25 +++++++++++++++++++ .../pycharm_cura_test.run.xml.jinja | 25 +++++++++++++++++++ conanfile.py | 23 ++++++++++------- 3 files changed, 64 insertions(+), 9 deletions(-) create mode 100644 .run_templates/pycharm_cura_run.run.xml.jinja create mode 100644 .run_templates/pycharm_cura_test.run.xml.jinja diff --git a/.run_templates/pycharm_cura_run.run.xml.jinja b/.run_templates/pycharm_cura_run.run.xml.jinja new file mode 100644 index 0000000000..3c04c5eaef --- /dev/null +++ b/.run_templates/pycharm_cura_run.run.xml.jinja @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/.run_templates/pycharm_cura_test.run.xml.jinja b/.run_templates/pycharm_cura_test.run.xml.jinja new file mode 100644 index 0000000000..4f685b6d8c --- /dev/null +++ b/.run_templates/pycharm_cura_test.run.xml.jinja @@ -0,0 +1,25 @@ + + + + + \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index c59a22eef2..867e19abcd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,11 +1,6 @@ import os -import sys from pathlib import Path -from io import StringIO - -from platform import python_version - from jinja2 import Template from conans import tools @@ -58,16 +53,26 @@ class CuraConan(ConanFile): } # TODO: Add unit tests (but they need a different jinja template - _pycharm_targets = [{ + _pycharm_targets = [ + { "name": "cura", "module_name": "Cura", "script_name": "cura_app.py", - }, { + "jinja_path": ".run_templates/pycharm_cura_run.run.xml.jinja" + }, + { "name": "cura_external_engine", "module_name": "Cura", "script_name": "cura_app.py", - "parameters": "--external-backend" - } + "parameters": "--external-backend", + "jinja_path": ".run_templates/pycharm_cura_run.run.xml.jinja" + }, + { + "name": "cura_test", + "module_name": "Cura", + "script_name": "run_coverage.py", + "jinja_path": ".run_templates/pycharm_cura_test.run.xml.jinja" + }, ] # FIXME: These env vars should be defined in the runenv. From c5acaa768b7155661198a9afb271a57a441139b8 Mon Sep 17 00:00:00 2001 From: "j.spijker@ultimaker.com" Date: Thu, 11 Aug 2022 18:01:45 +0200 Subject: [PATCH 09/64] Moved pycharm_targets to conandata Added individual tests. Still not everything Contributes to CURA-8827 --- .../pycharm_cura_test.run.xml.jinja | 14 +-- conandata.yml | 110 ++++++++++++++++++ conanfile.py | 25 +--- 3 files changed, 119 insertions(+), 30 deletions(-) diff --git a/.run_templates/pycharm_cura_test.run.xml.jinja b/.run_templates/pycharm_cura_test.run.xml.jinja index 4f685b6d8c..428876ee52 100644 --- a/.run_templates/pycharm_cura_test.run.xml.jinja +++ b/.run_templates/pycharm_cura_test.run.xml.jinja @@ -13,13 +13,11 @@