Browse Source

Merge pull request #1 from Ultimaker/master

Catch Up
oducceu 5 years ago
parent
commit
7e672b6039

+ 8 - 4
cura/Settings/MachineManager.py

@@ -1523,10 +1523,14 @@ class MachineManager(QObject):
 
             # Yes, we can find this in a single line of code. This makes it easier to read and it has the benefit
             # that it doesn't lump key errors together for the crashlogs
-            machine_node = container_tree.machines[definition_id]
-            variant_node = machine_node.variants[variant_name]
-            material_node = variant_node.materials[material_base_file]
-            quality_node = material_node.qualities[quality_id]
+            try:
+                machine_node = container_tree.machines[definition_id]
+                variant_node = machine_node.variants[variant_name]
+                material_node = variant_node.materials[material_base_file]
+                quality_node = material_node.qualities[quality_id]
+            except KeyError as e:
+                Logger.error("Can't set the intent category '{category}' since the profile '{profile}' in the stack is not supported according to the container tree.".format(category = intent_category, profile = e))
+                continue
 
             for intent_node in quality_node.intents.values():
                 if intent_node.intent_category == intent_category:  # Found an intent with the correct category.

+ 9 - 3
plugins/AMFReader/AMFReader.py

@@ -118,7 +118,7 @@ class AMFReader(MeshReader):
                     mesh.merge_vertices()
                     mesh.remove_unreferenced_vertices()
                     mesh.fix_normals()
-                    mesh_data = self._toMeshData(mesh)
+                    mesh_data = self._toMeshData(mesh, file_name)
 
                     new_node = CuraSceneNode()
                     new_node.setSelectable(True)
@@ -147,7 +147,13 @@ class AMFReader(MeshReader):
 
         return group_node
 
-    def _toMeshData(self, tri_node: trimesh.base.Trimesh) -> MeshData:
+    ##  Converts a Trimesh to Uranium's MeshData.
+    #   \param tri_node A Trimesh containing the contents of a file that was
+    #   just read.
+    #   \param file_name The full original filename used to watch for changes
+    #   \return Mesh data from the Trimesh in a way that Uranium can understand
+    #   it.
+    def _toMeshData(self, tri_node: trimesh.base.Trimesh, file_name: str = "") -> MeshData:
         tri_faces = tri_node.faces
         tri_vertices = tri_node.vertices
 
@@ -169,5 +175,5 @@ class AMFReader(MeshReader):
         indices = numpy.asarray(indices, dtype = numpy.int32)
         normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count)
 
-        mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals)
+        mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals,file_name = file_name)
         return mesh_data

+ 1 - 0
plugins/FirmwareUpdateChecker/FirmwareUpdateCheckerJob.py

@@ -44,6 +44,7 @@ class FirmwareUpdateCheckerJob(Job):
         try:
             # CURA-6698 Create an SSL context and use certifi CA certificates for verification.
             context = ssl.SSLContext(protocol = ssl.PROTOCOL_TLSv1_2)
+            context.verify_mode = ssl.CERT_REQUIRED
             context.load_verify_locations(cafile = certifi.where())
 
             request = urllib.request.Request(url, headers = self._headers)

+ 6 - 6
plugins/ImageReader/ImageReader.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2015 Ultimaker B.V.
+# Copyright (c) 2020 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import numpy
@@ -96,7 +96,7 @@ class ImageReader(MeshReader):
         texel_width = 1.0 / (width_minus_one) * scale_vector.x
         texel_height = 1.0 / (height_minus_one) * scale_vector.z
 
-        height_data = numpy.zeros((height, width), dtype=numpy.float32)
+        height_data = numpy.zeros((height, width), dtype = numpy.float32)
 
         for x in range(0, width):
             for y in range(0, height):
@@ -112,7 +112,7 @@ class ImageReader(MeshReader):
             height_data = 1 - height_data
 
         for _ in range(0, blur_iterations):
-            copy = numpy.pad(height_data, ((1, 1), (1, 1)), mode= "edge")
+            copy = numpy.pad(height_data, ((1, 1), (1, 1)), mode = "edge")
 
             height_data += copy[1:-1, 2:]
             height_data += copy[1:-1, :-2]
@@ -165,7 +165,7 @@ class ImageReader(MeshReader):
         offsetsz = numpy.array(offsetsz, numpy.float32).reshape(-1, 1) * texel_height
 
         # offsets for each texel quad
-        heightmap_vertex_offsets = numpy.concatenate([offsetsx, numpy.zeros((offsetsx.shape[0], offsetsx.shape[1]), dtype=numpy.float32), offsetsz], 1)
+        heightmap_vertex_offsets = numpy.concatenate([offsetsx, numpy.zeros((offsetsx.shape[0], offsetsx.shape[1]), dtype = numpy.float32), offsetsz], 1)
         heightmap_vertices += heightmap_vertex_offsets.repeat(6, 0).reshape(-1, 6, 3)
 
         # apply height data to y values
@@ -174,7 +174,7 @@ class ImageReader(MeshReader):
         heightmap_vertices[:, 2, 1] = heightmap_vertices[:, 3, 1] = height_data[1:, 1:].reshape(-1)
         heightmap_vertices[:, 4, 1] = height_data[:-1, 1:].reshape(-1)
 
-        heightmap_indices = numpy.array(numpy.mgrid[0:heightmap_face_count * 3], dtype=numpy.int32).reshape(-1, 3)
+        heightmap_indices = numpy.array(numpy.mgrid[0:heightmap_face_count * 3], dtype = numpy.int32).reshape(-1, 3)
 
         mesh._vertices[0:(heightmap_vertices.size // 3), :] = heightmap_vertices.reshape(-1, 3)
         mesh._indices[0:(heightmap_indices.size // 3), :] = heightmap_indices
@@ -223,7 +223,7 @@ class ImageReader(MeshReader):
             mesh.addFaceByPoints(geo_width, 0, y, geo_width, 0, ny, geo_width, he1, ny)
             mesh.addFaceByPoints(geo_width, he1, ny, geo_width, he0, y, geo_width, 0, y)
 
-        mesh.calculateNormals(fast=True)
+        mesh.calculateNormals(fast = True)
 
         scene_node.setMeshData(mesh.build())
 

+ 5 - 5
plugins/ImageReader/ImageReaderUI.py

@@ -1,4 +1,4 @@
-# Copyright (c) 2015 Ultimaker B.V.
+# Copyright (c) 2020 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import os
@@ -33,9 +33,9 @@ class ImageReaderUI(QObject):
         self.base_height = 0.4
         self.peak_height = 2.5
         self.smoothing = 1
-        self.lighter_is_higher = False;
-        self.use_transparency_model = True;
-        self.transmittance_1mm = 50.0; # based on pearl PLA
+        self.lighter_is_higher = False
+        self.use_transparency_model = True
+        self.transmittance_1mm = 50.0  # based on pearl PLA
 
         self._ui_lock = threading.Lock()
         self._cancelled = False
@@ -85,7 +85,7 @@ class ImageReaderUI(QObject):
             Logger.log("d", "Creating ImageReader config UI")
             path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
             self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self})
-            self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint);
+            self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint)
             self._disable_size_callbacks = False
 
     @pyqtSlot()

+ 1 - 1
plugins/Toolbox/resources/qml/components/ToolboxFooter.qml

@@ -42,7 +42,7 @@ Item
             rightMargin: UM.Theme.getSize("wide_margin").width
         }
         height: UM.Theme.getSize("toolbox_footer_button").height
-        text: catalog.i18nc("@info:button", "Quit Ultimaker Cura")
+        text: catalog.i18nc("@info:button, %1 is the application name", "Quit %1").arg(CuraApplication.applicationDisplayName)
         onClicked: toolbox.restart()
     }
 

+ 4 - 3
plugins/TrimeshReader/TrimeshReader.py

@@ -108,7 +108,7 @@ class TrimeshReader(MeshReader):
             mesh.merge_vertices()
             mesh.remove_unreferenced_vertices()
             mesh.fix_normals()
-            mesh_data = self._toMeshData(mesh)
+            mesh_data = self._toMeshData(mesh, file_name)
 
             file_base_name = os.path.basename(file_name)
             new_node = CuraSceneNode()
@@ -133,9 +133,10 @@ class TrimeshReader(MeshReader):
     ##  Converts a Trimesh to Uranium's MeshData.
     #   \param tri_node A Trimesh containing the contents of a file that was
     #   just read.
+    #   \param file_name The full original filename used to watch for changes
     #   \return Mesh data from the Trimesh in a way that Uranium can understand
     #   it.
-    def _toMeshData(self, tri_node: trimesh.base.Trimesh) -> MeshData:
+    def _toMeshData(self, tri_node: trimesh.base.Trimesh, file_name: str = "") -> MeshData:
         tri_faces = tri_node.faces
         tri_vertices = tri_node.vertices
 
@@ -157,5 +158,5 @@ class TrimeshReader(MeshReader):
         indices = numpy.asarray(indices, dtype = numpy.int32)
         normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count)
 
-        mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals)
+        mesh_data = MeshData(vertices = vertices, indices = indices, normals = normals, file_name = file_name)
         return mesh_data

+ 32 - 0
requirements.txt

@@ -0,0 +1,32 @@
+colorlog
+PyQt5==5.10
+numpy==1.15.4
+scipy==1.2.0
+shapely[vectorized]==1.6.4.post2
+appdirs==1.4.3
+certifi==2019.11.28
+cffi==1.13.1
+chardet==3.0.4
+cryptography==2.8
+decorator==4.4.0
+idna==2.8
+netifaces==0.10.9
+networkx==2.3
+numpy-stl==2.10.1
+packaging==18.0
+pycollada==0.6
+pycparser==2.19
+pyparsing==2.4.2
+pyserial==3.4
+python-dateutil==2.8.0
+python-utils==2.3.0
+requests==2.22.0
+sentry-sdk==0.13.5
+six==1.12.0
+trimesh==3.2.33
+typing==3.7.4
+twisted==19.10.0
+urllib3==1.25.6
+PyYAML==5.1.2
+zeroconf==0.24.1
+comtypes==1.1.7

+ 3 - 3
resources/qml/Cura.qml

@@ -560,8 +560,8 @@ UM.MainWindow
     MessageDialog
     {
         id: exitConfirmationDialog
-        title: catalog.i18nc("@title:window", "Closing Cura")
-        text: catalog.i18nc("@label", "Are you sure you want to exit Cura?")
+        title: catalog.i18nc("@title:window %1 is the application name", "Closing %1").arg(CuraApplication.applicationDisplayName)
+        text: catalog.i18nc("@label %1 is the application name", "Are you sure you want to exit %1?").arg(CuraApplication.applicationDisplayName)
         icon: StandardIcon.Question
         modality: Qt.ApplicationModal
         standardButtons: StandardButton.Yes | StandardButton.No
@@ -573,7 +573,7 @@ UM.MainWindow
             if (!visible)
             {
                 // reset the text to default because other modules may change the message text.
-                text = catalog.i18nc("@label", "Are you sure you want to exit Cura?");
+                text = catalog.i18nc("@label %1 is the application name", "Are you sure you want to exit %1?").arg(CuraApplication.applicationDisplayName);
             }
         }
     }

+ 4 - 1
resources/qml/Preferences/MachinesPage.qml

@@ -118,7 +118,10 @@ UM.ManagementPage
         UM.Dialog
         {
             id: actionDialog
-
+            minimumWidth: UM.Theme.getSize("modal_window_minimum").width
+            minimumHeight: UM.Theme.getSize("modal_window_minimum").height
+            maximumWidth: minimumWidth * 3
+            maximumHeight: minimumHeight * 3
             rightButtons: Button
             {
                 text: catalog.i18nc("@action:button", "Close")

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