Browse Source

Merge branch 'master' into feature_extruder_buttons

CURA-4211

Resolve merge conflicts.
Lipu Fei 7 years ago
parent
commit
d0740158b1

+ 2 - 0
CMakeLists.txt

@@ -52,6 +52,8 @@ if(NOT APPLE AND NOT WIN32)
             DESTINATION lib/python${PYTHON_VERSION_MAJOR}/dist-packages/cura)
     install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
             DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+    install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
+            DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
     install(FILES cura.appdata.xml
             DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata)
     install(FILES cura.sharedmimeinfo

+ 2 - 0
cura/CuraApplication.py

@@ -205,6 +205,8 @@ class CuraApplication(QtApplication):
         super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType,
                          tray_icon_name = "cura-icon-32.png")
 
+        self.default_theme = "cura-light"
+
         self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
 
         self.setRequiredPlugins([

+ 17 - 0
cura/Settings/MachineManager.py

@@ -649,6 +649,23 @@ class MachineManager(QObject):
                 return Util.parseBool(quality.getMetaDataEntry("supported", True))
         return False
 
+    ##  Returns whether there is anything unsupported in the current set-up.
+    #
+    #   The current set-up signifies the global stack and all extruder stacks,
+    #   so this indicates whether there is any container in any of the container
+    #   stacks that is not marked as supported.
+    @pyqtProperty(bool, notify = activeQualityChanged)
+    def isCurrentSetupSupported(self) -> bool:
+        if not self._global_container_stack:
+            return False
+        for stack in [self._global_container_stack] + list(self._global_container_stack.extruders.values()):
+            for container in stack.getContainers():
+                if not container:
+                    return False
+                if not Util.parseBool(container.getMetaDataEntry("supported", True)):
+                    return False
+        return True
+
     ##  Get the Quality ID associated with the currently active extruder
     #   Note that this only returns the "quality", not the "quality_changes"
     #   \returns QualityID (string) if found, empty string otherwise

+ 14 - 1
plugins/CuraEngineBackend/StartSliceJob.py

@@ -224,7 +224,18 @@ class StartSliceJob(Job):
 
         material_instance_container = stack.findContainer({"type": "material"})
 
+        settings = {}
         for key in stack.getAllKeys():
+            settings[key] = stack.getProperty(key, "value")
+            Job.yieldThread()
+
+        settings["print_bed_temperature"] = settings["material_bed_temperature"] #Renamed settings.
+        settings["print_temperature"] = settings["material_print_temperature"]
+        settings["time"] = time.strftime("%H:%M:%S") #Some extra settings.
+        settings["date"] = time.strftime("%d-%m-%Y")
+        settings["day"] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"][int(time.strftime("%w"))]
+
+        for key, value in settings.items():
             # Do not send settings that are not settable_per_extruder.
             if not stack.getProperty(key, "settable_per_extruder"):
                 continue
@@ -233,6 +244,8 @@ class StartSliceJob(Job):
             if key == "material_guid" and material_instance_container:
                 # Also send the material GUID. This is a setting in fdmprinter, but we have no interface for it.
                 setting.value = str(material_instance_container.getMetaDataEntry("GUID", "")).encode("utf-8")
+            elif key == "machine_extruder_start_code" or key == "machine_extruder_end_code":
+                setting.value = self._expandGcodeTokens(key, value, settings)
             else:
                 setting.value = str(stack.getProperty(key, "value")).encode("utf-8")
             Job.yieldThread()
@@ -278,7 +291,7 @@ class StartSliceJob(Job):
         for key, value in settings.items(): #Add all submessages for each individual setting.
             setting_message = self._slice_message.getMessage("global_settings").addRepeatedMessage("settings")
             setting_message.name = key
-            if key == "machine_start_gcode" or key == "machine_end_gcode" or key == "machine_extruder_start_code" or key == "machine_extruder_end_code": #If it's a g-code message, use special formatting.
+            if key == "machine_start_gcode" or key == "machine_end_gcode": #If it's a g-code message, use special formatting.
                 setting_message.value = self._expandGcodeTokens(key, value, settings)
             else:
                 setting_message.value = str(value).encode("utf-8")

+ 5 - 1
plugins/LayerView/LayerView.qml

@@ -1,4 +1,4 @@
-// Copyright (c) 2015 Ultimaker B.V.
+// Copyright (c) 2017 Ultimaker B.V.
 // Cura is released under the terms of the AGPLv3 or higher.
 
 import QtQuick 2.2
@@ -492,6 +492,8 @@ Item
                 anchors.horizontalCenter: parent.horizontalCenter
                 radius: parent.handleRadius
                 color: parent.upperHandleColor
+                border.width: UM.Theme.getSize("default_lining").width
+                border.color: UM.Theme.getColor("slider_handle_border")
 
                 visible: slider.layersVisible
 
@@ -531,6 +533,8 @@ Item
                 anchors.horizontalCenter: parent.horizontalCenter
                 radius: parent.handleRadius
                 color: parent.lowerHandleColor
+                border.width: UM.Theme.getSize("default_lining").width
+                border.color: UM.Theme.getColor("slider_handle_border")
 
                 visible: slider.layersVisible
 

+ 1 - 1
plugins/MachineSettingsAction/MachineSettingsAction.qml

@@ -824,7 +824,7 @@ Cura.MachineAction
                             polygon.push([-printHeadPolygon["x"]["min"], printHeadPolygon["y"]["max"]]);
                             polygon.push([-printHeadPolygon["x"]["min"],-printHeadPolygon["y"]["min"]]);
                             polygon.push([ printHeadPolygon["x"]["max"], printHeadPolygon["y"]["max"]]);
-                            polygon.push([ printHeadPolygon["x"]["max"],-printHeadPolygon["y"]["mìn"]]);
+                            polygon.push([ printHeadPolygon["x"]["max"],-printHeadPolygon["y"]["min"]]);
                             var polygon_string = JSON.stringify(polygon);
                             if(polygon_string != machineHeadPolygonProvider.properties.value)
                             {

+ 2 - 2
plugins/PluginBrowser/PluginBrowser.qml

@@ -198,8 +198,8 @@ UM.Dialog
             id: licenseDialog
             title: catalog.i18nc("@title:window", "Plugin License Agreement")
 
-            minimumWidth: UM.Theme.getSize("modal_window_minimum").width
-            minimumHeight: UM.Theme.getSize("modal_window_minimum").height
+            minimumWidth: UM.Theme.getSize("license_window_minimum").width
+            minimumHeight: UM.Theme.getSize("license_window_minimum").height
             width: minimumWidth
             height: minimumHeight
 

+ 11 - 2
plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py

@@ -123,8 +123,17 @@ class RemovableDriveOutputDevice(OutputDevice):
     def _onFinished(self, job):
         if self._stream:
             # Explicitly closing the stream flushes the write-buffer
-            self._stream.close()
-            self._stream = None
+            try:
+                self._stream.close()
+                self._stream = None
+            except:
+                Logger.logException("w", "An execption occured while trying to write to removable drive.")
+                message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(),
+                                                                                                       str(
+                                                                                                           job.getError())))
+                message.show()
+                self.writeError.emit(self)
+                return
 
         self._writing = False
         self.writeFinished.emit(self)

+ 2 - 0
plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py

@@ -756,6 +756,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
 
         self._createNetworkManager()
 
+        self._last_response_time = time()  # Ensure we reset the time when trying to connect (again)
+
         self.setConnectionState(ConnectionState.connecting)
         self._update()  # Manually trigger the first update, as we don't want to wait a few secs before it starts.
         if not self._use_stream:

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

@@ -0,0 +1,56 @@
+# Copyright (c) 2017 Ultimaker B.V.
+# Cura is released under the terms of the AGPLv3 or higher.
+
+import configparser #To parse preference files.
+import io #To serialise the preference files afterwards.
+
+from UM.VersionUpgrade import VersionUpgrade #We're inheriting from this.
+
+_renamed_themes = {
+    "cura": "cura-light"
+}
+
+class VersionUpgrade27to30(VersionUpgrade):
+    ##  Gets the version number from a CFG file in Uranium's 2.7 format.
+    #
+    #   Since the format may change, this is implemented for the 2.7 format only
+    #   and needs to be included in the version upgrade system rather than
+    #   globally in Uranium.
+    #
+    #   \param serialised The serialised form of a CFG file.
+    #   \return The version number stored in the CFG file.
+    #   \raises ValueError The format of the version number in the file is
+    #   incorrect.
+    #   \raises KeyError The format of the file is incorrect.
+    def getCfgVersion(self, serialised):
+        parser = configparser.ConfigParser(interpolation = None)
+        parser.read_string(serialised)
+        format_version = int(parser.get("general", "version")) #Explicitly give an exception when this fails. That means that the file format is not recognised.
+        setting_version = int(parser.get("metadata", "setting_version", fallback = 0))
+        return format_version * 1000000 + setting_version
+
+    ##  Upgrades a preferences file from version 2.7 to 3.0.
+    #
+    #   \param serialised The serialised form of a preferences file.
+    #   \param filename The name of the file to upgrade.
+    def upgradePreferences(self, serialised, filename):
+        parser = configparser.ConfigParser(interpolation=None)
+        parser.read_string(serialised)
+
+        # Update version numbers
+        if "general" not in parser:
+            parser["general"] = {}
+        parser["general"]["version"] = "5"
+        if "metadata" not in parser:
+            parser["metadata"] = {}
+        parser["metadata"]["setting_version"] = "2"
+
+        #Renamed themes.
+        if "theme" in parser["general"]:
+            if parser["general"]["theme"] in _renamed_themes:
+                parser["general"]["theme"] = _renamed_themes[parser["general"]["theme"]]
+
+        # Re-serialise the file.
+        output = io.StringIO()
+        parser.write(output)
+        return [filename], [output.getvalue()]

Some files were not shown because too many files changed in this diff