Browse Source

Merge remote-tracking branch 'origin/master' into WIP_improve_initialization

Lipu Fei 6 years ago
parent
commit
eb949472e8

+ 4 - 1
CMakeLists.txt

@@ -19,7 +19,10 @@ endif()
 
 set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
 set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
-set(CURA_PACKAGES_VERSION "" CACHE STRING "Packages version of Cura")
+set(CURA_SDK_VERSION "" CACHE STRING "SDK version of Cura")
+set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
+set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
+
 configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
 configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
 

+ 3 - 0
cura/Arranging/ArrangeObjectsJob.py

@@ -43,6 +43,9 @@ class ArrangeObjectsJob(Job):
         nodes_arr = []  # fill with (size, node, offset_shape_arr, hull_shape_arr)
         for node in self._nodes:
             offset_shape_arr, hull_shape_arr = ShapeArray.fromNode(node, min_offset = self._min_offset)
+            if offset_shape_arr is None:
+                Logger.log("w", "Node [%s] could not be converted to an array for arranging...", str(node))
+                continue
             nodes_arr.append((offset_shape_arr.arr.shape[0] * offset_shape_arr.arr.shape[1], node, offset_shape_arr, hull_shape_arr))
 
         # Sort the nodes with the biggest area first.

+ 9 - 5
cura/CuraApplication.py

@@ -539,7 +539,7 @@ class CuraApplication(QtApplication):
 
     ## A reusable dialogbox
     #
-    showMessageBox = pyqtSignal(str, str, str, str, str, int, int, arguments = ["title", "footer", "text", "informativeText", "detailedText", "buttons", "icon"])
+    showMessageBox = pyqtSignal(str, str, str, str, int, int, arguments = ["title", "text", "informativeText", "detailedText", "buttons", "icon"])
 
     def messageBox(self, title, text, informativeText = "", detailedText = "", buttons = QMessageBox.Ok, icon = QMessageBox.NoIcon, callback = None, callback_arguments = []):
         self._message_box_callback = callback
@@ -1464,11 +1464,15 @@ class CuraApplication(QtApplication):
 
     def _reloadMeshFinished(self, job):
         # TODO; This needs to be fixed properly. We now make the assumption that we only load a single mesh!
-        mesh_data = job.getResult()[0].getMeshData()
-        if mesh_data:
-            job._node.setMeshData(mesh_data)
-        else:
+        job_result = job.getResult()
+        if len(job_result) == 0:
+            Logger.log("e", "Reloading the mesh failed.")
+            return
+        mesh_data = job_result[0].getMeshData()
+        if not mesh_data:
             Logger.log("w", "Could not find a mesh in reloaded node.")
+            return
+        job._node.setMeshData(mesh_data)
 
     def _openFile(self, filename):
         self.readLocalFile(QUrl.fromLocalFile(filename))

+ 3 - 1
cura/CuraVersion.py.in

@@ -4,4 +4,6 @@
 CuraVersion = "@CURA_VERSION@"
 CuraBuildType = "@CURA_BUILDTYPE@"
 CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False
-CuraPackagesVersion = "@CURA_PACKAGES_VERSION@"
+CuraSDKVersion = "@CURA_SDK_VERSION@"
+CuraCloudAPIRoot = "@CURA_CLOUD_API_ROOT@"
+CuraCloudAPIVersion = "@CURA_CLOUD_API_VERSION@"

+ 3 - 2
cura/Machines/MaterialManager.py

@@ -291,9 +291,10 @@ class MaterialManager(QObject):
         material_id_metadata_dict = dict()
         for node in nodes_to_check:
             if node is not None:
+                # Only exclude the materials that are explicitly specified in the "exclude_materials" field.
+                # Do not exclude other materials that are of the same type.
                 for material_id, node in node.material_map.items():
-                    fallback_id = self.getFallbackMaterialIdByMaterialType(node.metadata["material"])
-                    if fallback_id in machine_exclude_materials:
+                    if material_id in machine_exclude_materials:
                         Logger.log("d", "Exclude material [%s] for machine [%s]",
                                    material_id, machine_definition.getId())
                         continue

+ 5 - 1
cura/MultiplyObjectsJob.py

@@ -1,6 +1,8 @@
-# Copyright (c) 2017 Ultimaker B.V.
+# Copyright (c) 2018 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
+import copy
+
 from UM.Job import Job
 from UM.Operations.GroupedOperation import GroupedOperation
 from UM.Message import Message
@@ -64,6 +66,8 @@ class MultiplyObjectsJob(Job):
                 # We do place the nodes one by one, as we want to yield in between.
                 if not node_too_big:
                     new_node, solution_found = arranger.findNodePlacement(current_node, offset_shape_arr, hull_shape_arr)
+                else:
+                    new_node = copy.deepcopy(node)
                 if node_too_big or not solution_found:
                     found_solution_for_all = False
                     new_location = new_node.getPosition()

+ 2 - 0
cura/PrintInformation.py

@@ -329,6 +329,8 @@ class PrintInformation(QObject):
     baseNameChanged = pyqtSignal()
 
     def setBaseName(self, base_name: str, is_project_file: bool = False):
+        self._is_user_specified_job_name = False
+
         # Ensure that we don't use entire path but only filename
         name = os.path.basename(base_name)
 

+ 12 - 4
cura/Settings/MachineManager.py

@@ -1031,6 +1031,10 @@ class MachineManager(QObject):
         self.activeQualityChangesGroupChanged.emit()
 
     def _setQualityGroup(self, quality_group, empty_quality_changes: bool = True) -> None:
+        if quality_group is None:
+            self._setEmptyQuality()
+            return
+
         if quality_group.node_for_global.getContainer() is None:
             return
         for node in quality_group.nodes_for_extruders.values():
@@ -1041,10 +1045,6 @@ class MachineManager(QObject):
         if empty_quality_changes:
             self._current_quality_changes_group = None
 
-        if quality_group is None:
-            self._setEmptyQuality()
-            return
-
         # Set quality and quality_changes for the GlobalStack
         self._global_container_stack.quality = quality_group.node_for_global.getContainer()
         if empty_quality_changes:
@@ -1330,6 +1330,10 @@ class MachineManager(QObject):
             self._setMaterial(position, container_node)
             self._updateQualityWithMaterial()
 
+        # See if we need to show the Discard or Keep changes screen
+        if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
+            self._application.discardOrKeepProfileChanges()
+
     @pyqtSlot(str, str)
     def setVariantByName(self, position: str, variant_name: str) -> None:
         machine_definition_id = self._global_container_stack.definition.id
@@ -1345,6 +1349,10 @@ class MachineManager(QObject):
             self._updateMaterialWithVariant(position)
             self._updateQualityWithMaterial()
 
+        # See if we need to show the Discard or Keep changes screen
+        if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
+            self._application.discardOrKeepProfileChanges()
+
     @pyqtSlot(str)
     def setQualityGroupByQualityType(self, quality_type: str) -> None:
         if self._global_container_stack is None:

+ 17 - 4
plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py

@@ -62,13 +62,26 @@ class FirmwareUpdateCheckerJob(Job):
                 # notify the user when no new firmware version is available.
                 if (checked_version != "") and (checked_version != current_version):
                     Logger.log("i", "SHOWING FIRMWARE UPDATE MESSAGE")
-                    message = Message(i18n_catalog.i18nc("@info Don't translate {machine_name}, since it gets replaced by a printer name!", "New features are available for your {machine_name}! It is recommended to update the firmware on your printer.").format(machine_name = machine_name),
-                                      title = i18n_catalog.i18nc("@info:title The %s gets replaced with the printer name.", "New %s firmware available") % machine_name)
-                    message.addAction("download", i18n_catalog.i18nc("@action:button", "How to update"), "[no_icon]", "[no_description]")
+
+                    message = Message(i18n_catalog.i18nc(
+                        "@info Don't translate {machine_name}, since it gets replaced by a printer name!",
+                        "New features are available for your {machine_name}! It is recommended to update the firmware on your printer.").format(
+                        machine_name=machine_name),
+                        title=i18n_catalog.i18nc(
+                                          "@info:title The %s gets replaced with the printer name.",
+                                          "New %s firmware available") % machine_name)
+
+                    message.addAction("download",
+                                      i18n_catalog.i18nc("@action:button", "How to update"),
+                                      "[no_icon]",
+                                      "[no_description]",
+                                      button_style=Message.ActionButtonStyle.LINK,
+                                      button_align=Message.ActionButtonStyle.BUTTON_ALIGN_LEFT)
+
 
                     # If we do this in a cool way, the download url should be available in the JSON file
                     if self._set_download_url_callback:
-                        self._set_download_url_callback("https://ultimaker.com/en/resources/23129-updating-the-firmware?utm_source=cura&utm_medium=software&utm_campaign=hw-update")
+                        self._set_download_url_callback("https://ultimaker.com/en/resources/20500-upgrade-firmware")
                     message.actionTriggered.connect(self._callback)
                     message.show()
 

+ 1 - 1
plugins/ModelChecker/ModelChecker.py

@@ -27,7 +27,7 @@ class ModelChecker(QObject, Extension):
 
         self._caution_message = Message("", #Message text gets set when the message gets shown, to display the models in question.
             lifetime = 0,
-            title = catalog.i18nc("@info:title", "Model Checker Warning"))
+            title = catalog.i18nc("@info:title", "3D Model Assistant"))
 
         Application.getInstance().initializationFinished.connect(self._pluginsInitialized)
         Application.getInstance().getController().getScene().sceneChanged.connect(self._onChanged)

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