Browse Source

Merge branch 'master' of github.com:Ultimaker/Cura

Jack Ha 8 years ago
parent
commit
c76a1043b0

+ 4 - 1
cura/MultiMaterialDecorator.py

@@ -5,4 +5,7 @@ class MultiMaterialDecorator(SceneNodeDecorator):
         super().__init__()
         
     def isMultiMaterial(self):
-        return True
+        return True
+
+    def __deepcopy__(self, memo):
+        return MultiMaterialDecorator()

+ 75 - 70
plugins/SliceInfoPlugin/SliceInfo.py

@@ -45,74 +45,79 @@ class SliceInfo(Extension):
         Preferences.getInstance().setValue("info/asked_send_slice_info", True)
 
     def _onWriteStarted(self, output_device):
-        if not Preferences.getInstance().getValue("info/send_slice_info"):
-            Logger.log("d", "'info/send_slice_info' is turned off.")
-            return # Do nothing, user does not want to send data
-
-        global_container_stack = Application.getInstance().getGlobalContainerStack()
-
-        # Get total material used (in mm^3)
-        print_information = Application.getInstance().getPrintInformation()
-        material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value")
-
-        # TODO: Send material per extruder instead of mashing it on a pile
-        material_used = math.pi * material_radius * material_radius * sum(print_information.materialAmounts) #Volume of all materials used
-
-        # Get model information (bounding boxes, hashes and transformation matrix)
-        models_info = []
-        for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
-            if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None:
-                if not getattr(node, "_outside_buildarea", False):
-                    model_info = {}
-                    model_info["hash"] = node.getMeshData().getHash()
-                    model_info["bounding_box"] = {}
-                    model_info["bounding_box"]["minimum"] = {}
-                    model_info["bounding_box"]["minimum"]["x"] = node.getBoundingBox().minimum.x
-                    model_info["bounding_box"]["minimum"]["y"] = node.getBoundingBox().minimum.y
-                    model_info["bounding_box"]["minimum"]["z"] = node.getBoundingBox().minimum.z
-
-                    model_info["bounding_box"]["maximum"] = {}
-                    model_info["bounding_box"]["maximum"]["x"] = node.getBoundingBox().maximum.x
-                    model_info["bounding_box"]["maximum"]["y"] = node.getBoundingBox().maximum.y
-                    model_info["bounding_box"]["maximum"]["z"] = node.getBoundingBox().maximum.z
-                    model_info["transformation"] = str(node.getWorldTransformation().getData())
-
-                    models_info.append(model_info)
-
-        # Bundle the collected data
-        submitted_data = {
-            "processor": platform.processor(),
-            "machine": platform.machine(),
-            "platform": platform.platform(),
-            "settings": global_container_stack.serialize(), # global_container with references on used containers
-            "version": Application.getInstance().getVersion(),
-            "modelhash": "None",
-            "printtime": print_information.currentPrintTime.getDisplayString(),
-            "filament": material_used,
-            "language": Preferences.getInstance().getValue("general/language"),
-            "materials_profiles ": {}
-        }
-        for container in global_container_stack.getContainers():
-            container_id = container.getId()
-            try:
-                container_serialized = container.serialize()
-            except NotImplementedError:
-                Logger.log("w", "Container %s could not be serialized!", container_id)
-                continue
-
-            if container_serialized:
-                submitted_data["settings_%s" %(container_id)] = container_serialized # This can be anything, eg. INI, JSON, etc.
-            else:
-                Logger.log("i", "No data found in %s to be serialized!", container_id)
-
-        # Convert data to bytes
-        submitted_data = urllib.parse.urlencode(submitted_data)
-        binary_data = submitted_data.encode("utf-8")
-
-        # Submit data
         try:
-            f = urllib.request.urlopen(self.info_url, data = binary_data, timeout = 1)
-            Logger.log("i", "Sent anonymous slice info to %s", self.info_url)
-            f.close()
-        except Exception as e:
-            Logger.logException("e", e)
+            if not Preferences.getInstance().getValue("info/send_slice_info"):
+                Logger.log("d", "'info/send_slice_info' is turned off.")
+                return # Do nothing, user does not want to send data
+
+            global_container_stack = Application.getInstance().getGlobalContainerStack()
+
+            # Get total material used (in mm^3)
+            print_information = Application.getInstance().getPrintInformation()
+            material_radius = 0.5 * global_container_stack.getProperty("material_diameter", "value")
+
+            # TODO: Send material per extruder instead of mashing it on a pile
+            material_used = math.pi * material_radius * material_radius * sum(print_information.materialAmounts) #Volume of all materials used
+
+            # Get model information (bounding boxes, hashes and transformation matrix)
+            models_info = []
+            for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
+                if type(node) is SceneNode and node.getMeshData() and node.getMeshData().getVertices() is not None:
+                    if not getattr(node, "_outside_buildarea", False):
+                        model_info = {}
+                        model_info["hash"] = node.getMeshData().getHash()
+                        model_info["bounding_box"] = {}
+                        model_info["bounding_box"]["minimum"] = {}
+                        model_info["bounding_box"]["minimum"]["x"] = node.getBoundingBox().minimum.x
+                        model_info["bounding_box"]["minimum"]["y"] = node.getBoundingBox().minimum.y
+                        model_info["bounding_box"]["minimum"]["z"] = node.getBoundingBox().minimum.z
+
+                        model_info["bounding_box"]["maximum"] = {}
+                        model_info["bounding_box"]["maximum"]["x"] = node.getBoundingBox().maximum.x
+                        model_info["bounding_box"]["maximum"]["y"] = node.getBoundingBox().maximum.y
+                        model_info["bounding_box"]["maximum"]["z"] = node.getBoundingBox().maximum.z
+                        model_info["transformation"] = str(node.getWorldTransformation().getData())
+
+                        models_info.append(model_info)
+
+            # Bundle the collected data
+            submitted_data = {
+                "processor": platform.processor(),
+                "machine": platform.machine(),
+                "platform": platform.platform(),
+                "settings": global_container_stack.serialize(), # global_container with references on used containers
+                "version": Application.getInstance().getVersion(),
+                "modelhash": "None",
+                "printtime": print_information.currentPrintTime.getDisplayString(),
+                "filament": material_used,
+                "language": Preferences.getInstance().getValue("general/language"),
+                "materials_profiles ": {}
+            }
+            for container in global_container_stack.getContainers():
+                container_id = container.getId()
+                try:
+                    container_serialized = container.serialize()
+                except NotImplementedError:
+                    Logger.log("w", "Container %s could not be serialized!", container_id)
+                    continue
+
+                if container_serialized:
+                    submitted_data["settings_%s" %(container_id)] = container_serialized # This can be anything, eg. INI, JSON, etc.
+                else:
+                    Logger.log("i", "No data found in %s to be serialized!", container_id)
+
+            # Convert data to bytes
+            submitted_data = urllib.parse.urlencode(submitted_data)
+            binary_data = submitted_data.encode("utf-8")
+
+            # Submit data
+            try:
+                f = urllib.request.urlopen(self.info_url, data = binary_data, timeout = 1)
+                Logger.log("i", "Sent anonymous slice info to %s", self.info_url)
+                f.close()
+            except Exception as e:
+                Logger.logException("e", "An exception occurred while trying to send slice information")
+        except:
+            # We really can't afford to have a mistake here, as this would break the sending of g-code to a device
+            # (Either saving or directly to a printer). The functionality of the slice data is not *that* important.
+            pass

+ 0 - 1
plugins/UltimakerMachineActions/UMOCheckupMachineAction.py

@@ -79,7 +79,6 @@ class UMOCheckupMachineAction(MachineAction):
 
     @pyqtProperty(bool, notify = onBedTestCompleted)
     def bedTestCompleted(self):
-        print("zomg?")
         return self._bed_test_completed
 
     @pyqtProperty(bool, notify = onHotendTestCompleted)

+ 5 - 10
plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml

@@ -51,7 +51,6 @@ Cura.MachineAction
                 text: catalog.i18nc("@action:button","Start Printer Check");
                 onClicked:
                 {
-                    //checkupContent.visible = true
                     manager.startCheck()
                 }
             }
@@ -157,6 +156,7 @@ Cura.MachineAction
             {
                 id: nozzleTempLabel
                 width: checkupMachineAction.leftRow
+                height: nozzleTempButton.height
                 anchors.left: parent.left
                 anchors.top: endstopZLabel.bottom
                 wrapMode: Text.WordWrap
@@ -175,15 +175,12 @@ Cura.MachineAction
             {
                 id: nozzleTempButton
                 width: checkupMachineAction.rightRow * 0.3
-                height: nozzleTemp.height
+                height: childrenRect.height
                 anchors.top: nozzleTempLabel.top
                 anchors.left: bedTempStatus.right
                 anchors.leftMargin: UM.Theme.getSize("default_margin").width/2
                 Button
                 {
-                    height: nozzleTemp.height - 2
-                    anchors.verticalCenter: parent.verticalCenter
-                    anchors.horizontalCenter: parent.horizontalCenter
                     text: catalog.i18nc("@action:button","Start Heating")
                     onClicked:
                     {
@@ -207,10 +204,11 @@ Cura.MachineAction
             {
                 id: bedTempLabel
                 width: checkupMachineAction.leftRow
+                height: bedTempButton.height
                 anchors.left: parent.left
                 anchors.top: nozzleTempLabel.bottom
                 wrapMode: Text.WordWrap
-                text: catalog.i18nc("@label","bed temperature check:")
+                text: catalog.i18nc("@label","Bed temperature check:")
             }
 
             Label
@@ -226,15 +224,12 @@ Cura.MachineAction
             {
                 id: bedTempButton
                 width: checkupMachineAction.rightRow * 0.3
-                height: bedTemp.height
+                height: childrenRect.height
                 anchors.top: bedTempLabel.top
                 anchors.left: bedTempStatus.right
                 anchors.leftMargin: UM.Theme.getSize("default_margin").width/2
                 Button
                 {
-                    height: bedTemp.height - 2
-                    anchors.verticalCenter: parent.verticalCenter
-                    anchors.horizontalCenter: parent.horizontalCenter
                     text: catalog.i18nc("@action:button","Start Heating")
                     onClicked:
                     {

+ 1 - 1
resources/qml/MonitorButton.qml

@@ -24,7 +24,7 @@ Rectangle
             return UM.Theme.getColor("status_offline")
         else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print")
             return UM.Theme.getColor("status_busy")
-        else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready")
+        else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "")
             return UM.Theme.getColor("status_ready")
         else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
             return UM.Theme.getColor("status_paused")

+ 1 - 1
resources/qml/Sidebar.qml

@@ -103,7 +103,7 @@ Rectangle
                         return UM.Theme.getIcon("tab_monitor")
                     else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing" || Cura.MachineManager.printerOutputDevices[0].jobState == "pre_print")
                         return UM.Theme.getIcon("tab_monitor_busy")
-                    else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready")
+                    else if(Cura.MachineManager.printerOutputDevices[0].jobState == "ready" || Cura.MachineManager.printerOutputDevices[0].jobState == "")
                         return UM.Theme.getIcon("tab_monitor_connected")
                     else if(Cura.MachineManager.printerOutputDevices[0].jobState == "paused")
                         return UM.Theme.getIcon("tab_monitor_paused")