Merge pull request #1 from Ultimaker/master

Catch Up
This commit is contained in:
oducceu 2020-03-08 18:36:47 +03:00 committed by GitHub
commit 7e672b6039
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 75 additions and 28 deletions

View File

@ -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 # 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 # that it doesn't lump key errors together for the crashlogs
machine_node = container_tree.machines[definition_id] try:
variant_node = machine_node.variants[variant_name] machine_node = container_tree.machines[definition_id]
material_node = variant_node.materials[material_base_file] variant_node = machine_node.variants[variant_name]
quality_node = material_node.qualities[quality_id] 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(): for intent_node in quality_node.intents.values():
if intent_node.intent_category == intent_category: # Found an intent with the correct category. if intent_node.intent_category == intent_category: # Found an intent with the correct category.

View File

@ -118,7 +118,7 @@ class AMFReader(MeshReader):
mesh.merge_vertices() mesh.merge_vertices()
mesh.remove_unreferenced_vertices() mesh.remove_unreferenced_vertices()
mesh.fix_normals() mesh.fix_normals()
mesh_data = self._toMeshData(mesh) mesh_data = self._toMeshData(mesh, file_name)
new_node = CuraSceneNode() new_node = CuraSceneNode()
new_node.setSelectable(True) new_node.setSelectable(True)
@ -147,7 +147,13 @@ class AMFReader(MeshReader):
return group_node 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_faces = tri_node.faces
tri_vertices = tri_node.vertices tri_vertices = tri_node.vertices
@ -169,5 +175,5 @@ class AMFReader(MeshReader):
indices = numpy.asarray(indices, dtype = numpy.int32) indices = numpy.asarray(indices, dtype = numpy.int32)
normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count) 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 return mesh_data

View File

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

View File

@ -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. # Cura is released under the terms of the LGPLv3 or higher.
import numpy import numpy
@ -96,7 +96,7 @@ class ImageReader(MeshReader):
texel_width = 1.0 / (width_minus_one) * scale_vector.x texel_width = 1.0 / (width_minus_one) * scale_vector.x
texel_height = 1.0 / (height_minus_one) * scale_vector.z 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 x in range(0, width):
for y in range(0, height): for y in range(0, height):
@ -112,7 +112,7 @@ class ImageReader(MeshReader):
height_data = 1 - height_data height_data = 1 - height_data
for _ in range(0, blur_iterations): 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:]
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 offsetsz = numpy.array(offsetsz, numpy.float32).reshape(-1, 1) * texel_height
# offsets for each texel quad # 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) heightmap_vertices += heightmap_vertex_offsets.repeat(6, 0).reshape(-1, 6, 3)
# apply height data to y values # 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[:, 2, 1] = heightmap_vertices[:, 3, 1] = height_data[1:, 1:].reshape(-1)
heightmap_vertices[:, 4, 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._vertices[0:(heightmap_vertices.size // 3), :] = heightmap_vertices.reshape(-1, 3)
mesh._indices[0:(heightmap_indices.size // 3), :] = heightmap_indices 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, 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.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()) scene_node.setMeshData(mesh.build())

View File

@ -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. # Cura is released under the terms of the LGPLv3 or higher.
import os import os
@ -33,9 +33,9 @@ class ImageReaderUI(QObject):
self.base_height = 0.4 self.base_height = 0.4
self.peak_height = 2.5 self.peak_height = 2.5
self.smoothing = 1 self.smoothing = 1
self.lighter_is_higher = False; self.lighter_is_higher = False
self.use_transparency_model = True; self.use_transparency_model = True
self.transmittance_1mm = 50.0; # based on pearl PLA self.transmittance_1mm = 50.0 # based on pearl PLA
self._ui_lock = threading.Lock() self._ui_lock = threading.Lock()
self._cancelled = False self._cancelled = False
@ -85,7 +85,7 @@ class ImageReaderUI(QObject):
Logger.log("d", "Creating ImageReader config UI") Logger.log("d", "Creating ImageReader config UI")
path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml") path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self}) 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 self._disable_size_callbacks = False
@pyqtSlot() @pyqtSlot()

View File

@ -42,7 +42,7 @@ Item
rightMargin: UM.Theme.getSize("wide_margin").width rightMargin: UM.Theme.getSize("wide_margin").width
} }
height: UM.Theme.getSize("toolbox_footer_button").height 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() onClicked: toolbox.restart()
} }

View File

@ -108,7 +108,7 @@ class TrimeshReader(MeshReader):
mesh.merge_vertices() mesh.merge_vertices()
mesh.remove_unreferenced_vertices() mesh.remove_unreferenced_vertices()
mesh.fix_normals() mesh.fix_normals()
mesh_data = self._toMeshData(mesh) mesh_data = self._toMeshData(mesh, file_name)
file_base_name = os.path.basename(file_name) file_base_name = os.path.basename(file_name)
new_node = CuraSceneNode() new_node = CuraSceneNode()
@ -133,9 +133,10 @@ class TrimeshReader(MeshReader):
## Converts a Trimesh to Uranium's MeshData. ## Converts a Trimesh to Uranium's MeshData.
# \param tri_node A Trimesh containing the contents of a file that was # \param tri_node A Trimesh containing the contents of a file that was
# just read. # 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 # \return Mesh data from the Trimesh in a way that Uranium can understand
# it. # 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_faces = tri_node.faces
tri_vertices = tri_node.vertices tri_vertices = tri_node.vertices
@ -157,5 +158,5 @@ class TrimeshReader(MeshReader):
indices = numpy.asarray(indices, dtype = numpy.int32) indices = numpy.asarray(indices, dtype = numpy.int32)
normals = calculateNormalsFromIndexedVertices(vertices, indices, face_count) 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 return mesh_data

32
requirements.txt Normal file
View File

@ -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

View File

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

View File

@ -118,7 +118,10 @@ UM.ManagementPage
UM.Dialog UM.Dialog
{ {
id: actionDialog 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 rightButtons: Button
{ {
text: catalog.i18nc("@action:button", "Close") text: catalog.i18nc("@action:button", "Close")

View File

@ -22,8 +22,8 @@ Window
flags: Qt.Dialog flags: Qt.Dialog
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
minimumWidth: 580 * screenScaleFactor minimumWidth: UM.Theme.getSize("modal_window_minimum").width
minimumHeight: 600 * screenScaleFactor minimumHeight: UM.Theme.getSize("modal_window_minimum").height
color: UM.Theme.getColor("main_background") color: UM.Theme.getColor("main_background")