Browse Source

Merge branch '3.0'

Ghostkeeper 7 years ago
parent
commit
7e00914e38

+ 12 - 11
plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py

@@ -754,17 +754,6 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
                                                  )
             return
 
-        # Check if we're already writing
-        if not self._write_finished:
-            self._error_message = Message(
-                i18n_catalog.i18nc("@info:status",
-                                   "Sending new jobs (temporarily) blocked, still sending the previous print job."))
-            self._error_message.show()
-            return
-
-        # Indicate we're starting a new write action, is set back to True in the startPrint() method
-        self._write_finished = False
-
         self.startPrint()
 
     def _configurationMismatchMessageCallback(self, button):
@@ -855,6 +844,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
     #   This function can fail to actually start a print due to not being authenticated or another print already
     #   being in progress.
     def startPrint(self):
+
+        # Check if we're already writing
+        if not self._write_finished:
+            self._error_message = Message(
+                i18n_catalog.i18nc("@info:status",
+                                   "Sending new jobs (temporarily) blocked, still sending the previous print job."))
+            self._error_message.show()
+            return
+
+        # Indicate we're starting a new write action, is set back to True at the end of this method
+        self._write_finished = False
+
         try:
             self._send_gcode_start = time()
             self._progress_message = Message(i18n_catalog.i18nc("@info:status", "Sending data to printer"), 0, False, -1, i18n_catalog.i18nc("@info:title", "Sending Data"))

+ 36 - 0
plugins/VersionUpgrade/VersionUpgrade27to30/VersionUpgrade27to30.py

@@ -3,6 +3,7 @@
 
 import configparser #To parse preference files.
 import io #To serialise the preference files afterwards.
+import os
 
 from UM.VersionUpgrade import VersionUpgrade #We're inheriting from this.
 
@@ -93,6 +94,41 @@ class VersionUpgrade27to30(VersionUpgrade):
         parser.write(output)
         return [filename], [output.getvalue()]
 
+    ##  Upgrades the given quality changes container file from version 2.7 to 3.0.
+    #
+    #   \param serialised The serialised form of the container file.
+    #   \param filename The name of the file to upgrade.
+    def upgradeQualityChangesContainer(self, serialised, filename):
+        parser = configparser.ConfigParser(interpolation=None)
+        parser.read_string(serialised)
+
+        # Update the skin pre-shrink settings:
+        #  - Remove the old ones
+        #  - Do not add the new ones. The default values will be used for them.
+        if parser.has_section("values"):
+            for remove_key in ["expand_skins_into_infill", "expand_upper_skins", "expand_lower_skins"]:
+                if remove_key in parser["values"]:
+                    del parser["values"][remove_key]
+
+        for each_section in ("general", "metadata"):
+            if not parser.has_section(each_section):
+                parser.add_section(each_section)
+
+        # Set the definition to "ultimaker2" for Ultimaker 2 quality changes
+        if not parser.has_section("general"):
+            parser.add_section("general")
+        if os.path.basename(filename).startswith("ultimaker2_"):
+            parser["general"]["definition"] = "ultimaker2"
+
+        # Update version numbers
+        parser["general"]["version"] = "2"
+        parser["metadata"]["setting_version"] = "3"
+
+        # Re-serialise the file.
+        output = io.StringIO()
+        parser.write(output)
+        return [filename], [output.getvalue()]
+
     ##  Upgrades the given instance container file from version 2.7 to 3.0.
     #
     #   \param serialised The serialised form of the container file.

+ 1 - 1
plugins/VersionUpgrade/VersionUpgrade27to30/__init__.py

@@ -14,7 +14,7 @@ def getMetaData():
             ("machine_stack", 3000002):     ("machine_stack", 3000003,     upgrade.upgradeStack),
             ("extruder_train", 3000002):    ("extruder_train", 3000003,    upgrade.upgradeStack),
 
-            ("quality_changes", 2000002):    ("quality_changes", 2000003,    upgrade.upgradeOtherContainer),
+            ("quality_changes", 2000002):    ("quality_changes", 2000003,    upgrade.upgradeQualityChangesContainer),
             ("user", 2000002):               ("user", 2000003,               upgrade.upgradeOtherContainer),
             ("quality", 2000002):            ("quality", 2000003,            upgrade.upgradeOtherContainer),
             ("definition_changes", 2000002): ("definition_changes", 2000003, upgrade.upgradeOtherContainer),

+ 31 - 10
resources/qml/SidebarSimple.qml

@@ -393,12 +393,19 @@ Item
                     anchors.leftMargin: (infillSlider.value / infillSlider.stepSize) * (infillSlider.width / (infillSlider.maximumValue / infillSlider.stepSize)) - 10 * screenScaleFactor
                     anchors.right: parent.right
 
-                    text: infillSlider.value + "%"
+                    text: parseInt(infillDensity.properties.value) + "%"
                     horizontalAlignment: Text.AlignLeft
 
                     color: infillSlider.enabled ? UM.Theme.getColor("quality_slider_available") : UM.Theme.getColor("quality_slider_unavailable")
                 }
 
+                // We use a binding to make sure that after manually setting infillSlider.value it is still bound to the property provider
+                Binding {
+                    target: infillSlider
+                    property: "value"
+                    value: parseInt(infillDensity.properties.value)
+                }
+
                 Slider
                 {
                     id: infillSlider
@@ -413,7 +420,7 @@ Item
 
                     minimumValue: 0
                     maximumValue: 100
-                    stepSize: (parseInt(infillDensity.properties.value) % 10 == 0) ? 10 : 1
+                    stepSize: 1
                     tickmarksEnabled: true
 
                     // disable slider when gradual support is enabled
@@ -423,8 +430,20 @@ Item
                     value: parseInt(infillDensity.properties.value)
 
                     onValueChanged: {
+
+                        // Don't round the value if it's already the same
+                        if (parseInt(infillDensity.properties.value) == infillSlider.value) {
+                            return
+                        }
+
+                        // Round the slider value to the nearest multiple of 10 (simulate step size of 10)
+                        var roundedSliderValue = Math.round(infillSlider.value / 10) * 10
+
+                        // Update the slider value to represent the rounded value
+                        infillSlider.value = roundedSliderValue
+
                         // Explicitly cast to string to make sure the value passed to Python is an integer.
-                        infillDensity.setPropertyValue("value", String(parseInt(infillSlider.value)))
+                        infillDensity.setPropertyValue("value", String(roundedSliderValue))
                     }
 
                     style: SliderStyle
@@ -454,7 +473,7 @@ Item
 
                             // check if a tick should be shown based on it's index and wether the infill density is a multiple of 10 (slider step size)
                             function shouldShowTick (index) {
-                                if ((parseInt(infillDensity.properties.value) % 10 == 0) || (index % 10 == 0)) {
+                                if (index % 10 == 0) {
                                     return true
                                 }
                                 return false
@@ -548,11 +567,17 @@ Item
                         hoverEnabled: true
                         enabled: true
 
+                        property var previousInfillDensity: parseInt(infillDensity.properties.value)
+
                         onClicked: {
-                            // Restore to 90% only when enabling gradual infill
+                            // Set to 90% only when enabling gradual infill
                             if (parseInt(infillSteps.properties.value) == 0) {
-                                infillDensity.setPropertyValue("value", 90)
+                                previousInfillDensity = parseInt(infillDensity.properties.value)
+                                infillDensity.setPropertyValue("value", String(90))
+                            } else {
+                                infillDensity.setPropertyValue("value", String(previousInfillDensity))
                             }
+
                             infillSteps.setPropertyValue("value", (parseInt(infillSteps.properties.value) == 0) ? 5 : 0)
                         }
 
@@ -891,7 +916,6 @@ Item
             UM.SettingPropertyProvider
             {
                 id: platformAdhesionType
-
                 containerStackId: Cura.MachineManager.activeMachineId
                 key: "adhesion_type"
                 watchedProperties: [ "value", "enabled" ]
@@ -901,7 +925,6 @@ Item
             UM.SettingPropertyProvider
             {
                 id: supportEnabled
-
                 containerStackId: Cura.MachineManager.activeMachineId
                 key: "support_enable"
                 watchedProperties: [ "value", "enabled", "description" ]
@@ -911,7 +934,6 @@ Item
             UM.SettingPropertyProvider
             {
                 id: machineExtruderCount
-
                 containerStackId: Cura.MachineManager.activeMachineId
                 key: "machine_extruder_count"
                 watchedProperties: [ "value" ]
@@ -921,7 +943,6 @@ Item
             UM.SettingPropertyProvider
             {
                 id: supportExtruderNr
-
                 containerStackId: Cura.MachineManager.activeMachineId
                 key: "support_extruder_nr"
                 watchedProperties: [ "value" ]

+ 1 - 1
resources/quality/ultimaker3/um3_aa0.4_CPEP_Draft_Print.inst.cfg

@@ -39,7 +39,7 @@ retraction_hop_only_when_collides = True
 skin_overlap = 20
 speed_layer_0 = 20
 speed_print = 50
-speed_topbottom = =math.ceil(speed_print * 65 / 50)
+speed_topbottom = =math.ceil(speed_print * 40 / 50)
 speed_travel = 250
 speed_wall = =math.ceil(speed_print * 50 / 50)
 speed_wall_0 = =math.ceil(speed_wall * 40 / 50)

+ 1 - 1
resources/quality/ultimaker3/um3_aa0.4_CPEP_Fast_Print.inst.cfg

@@ -39,7 +39,7 @@ retraction_hop_only_when_collides = True
 skin_overlap = 20
 speed_layer_0 = 20
 speed_print = 45
-speed_topbottom = =math.ceil(speed_print * 55 / 45)
+speed_topbottom = =math.ceil(speed_print * 35 / 45)
 speed_travel = 250
 speed_wall = =math.ceil(speed_print * 45 / 45)
 speed_wall_0 = =math.ceil(speed_wall * 35 / 45)