mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Merge remote-tracking branch 'origin/qt6_beyond_the_splash' into qt6_beyond_the_splash
This commit is contained in:
commit
b3cd1fee09
14 changed files with 24 additions and 20 deletions
|
@ -206,7 +206,7 @@ class ContainerManager(QObject):
|
||||||
if os.path.exists(file_url):
|
if os.path.exists(file_url):
|
||||||
result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"),
|
result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"),
|
||||||
catalog.i18nc("@label Don't translate the XML tag <filename>!", "The file <filename>{0}</filename> already exists. Are you sure you want to overwrite it?").format(file_url))
|
catalog.i18nc("@label Don't translate the XML tag <filename>!", "The file <filename>{0}</filename> already exists. Are you sure you want to overwrite it?").format(file_url))
|
||||||
if result == QMessageBox.No:
|
if result == QMessageBox.ButtonRole.NoRole:
|
||||||
return {"status": "cancelled", "message": "User cancelled"}
|
return {"status": "cancelled", "message": "User cancelled"}
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -139,7 +139,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
if os.path.exists(file_name):
|
if os.path.exists(file_name):
|
||||||
result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"),
|
result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"),
|
||||||
catalog.i18nc("@label Don't translate the XML tag <filename>!", "The file <filename>{0}</filename> already exists. Are you sure you want to overwrite it?").format(file_name))
|
catalog.i18nc("@label Don't translate the XML tag <filename>!", "The file <filename>{0}</filename> already exists. Are you sure you want to overwrite it?").format(file_name))
|
||||||
if result == QMessageBox.No:
|
if result == QMessageBox.ButtonRole.NoRole:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
profile_writer = self._findProfileWriter(extension, description)
|
profile_writer = self._findProfileWriter(extension, description)
|
||||||
|
|
|
@ -6,6 +6,7 @@ from PyQt6 import QtCore
|
||||||
from PyQt6.QtCore import QCoreApplication
|
from PyQt6.QtCore import QCoreApplication
|
||||||
from PyQt6.QtGui import QImage
|
from PyQt6.QtGui import QImage
|
||||||
|
|
||||||
|
from UM.Logger import Logger
|
||||||
from cura.PreviewPass import PreviewPass
|
from cura.PreviewPass import PreviewPass
|
||||||
|
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
|
@ -20,7 +21,7 @@ class Snapshot:
|
||||||
def getImageBoundaries(image: QImage):
|
def getImageBoundaries(image: QImage):
|
||||||
# Look at the resulting image to get a good crop.
|
# Look at the resulting image to get a good crop.
|
||||||
# Get the pixels as byte array
|
# Get the pixels as byte array
|
||||||
pixel_array = image.bits().asarray(image.byteCount())
|
pixel_array = image.bits().asarray(image.sizeInBytes())
|
||||||
width, height = image.width(), image.height()
|
width, height = image.width(), image.height()
|
||||||
# Convert to numpy array, assume it's 32 bit (it should always be)
|
# Convert to numpy array, assume it's 32 bit (it should always be)
|
||||||
pixels = numpy.frombuffer(pixel_array, dtype=numpy.uint8).reshape([height, width, 4])
|
pixels = numpy.frombuffer(pixel_array, dtype=numpy.uint8).reshape([height, width, 4])
|
||||||
|
@ -64,6 +65,7 @@ class Snapshot:
|
||||||
bbox = bbox + node.getBoundingBox()
|
bbox = bbox + node.getBoundingBox()
|
||||||
# If there is no bounding box, it means that there is no model in the buildplate
|
# If there is no bounding box, it means that there is no model in the buildplate
|
||||||
if bbox is None:
|
if bbox is None:
|
||||||
|
Logger.log("w", "Unable to create snapshot as we seem to have an empty buildplate")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
look_at = bbox.center
|
look_at = bbox.center
|
||||||
|
@ -96,6 +98,7 @@ class Snapshot:
|
||||||
try:
|
try:
|
||||||
min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output)
|
min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output)
|
||||||
except (ValueError, AttributeError):
|
except (ValueError, AttributeError):
|
||||||
|
Logger.logException("w", "Failed to crop the snapshot!")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height)
|
size = max((max_x - min_x) / render_width, (max_y - min_y) / render_height)
|
||||||
|
@ -117,7 +120,7 @@ class Snapshot:
|
||||||
# Scale it to the correct size
|
# Scale it to the correct size
|
||||||
scaled_image = cropped_image.scaled(
|
scaled_image = cropped_image.scaled(
|
||||||
width, height,
|
width, height,
|
||||||
aspectRatioMode = QtCore.Qt.IgnoreAspectRatio,
|
aspectRatioMode = QtCore.Qt.AspectRatioMode.IgnoreAspectRatio,
|
||||||
transformMode = QtCore.Qt.SmoothTransformation)
|
transformMode = QtCore.Qt.TransformationMode.SmoothTransformation)
|
||||||
|
|
||||||
return scaled_image
|
return scaled_image
|
||||||
|
|
|
@ -76,7 +76,7 @@ class CuraSplashScreen(QSplashScreen):
|
||||||
if len(version) == 1:
|
if len(version) == 1:
|
||||||
painter.drawText(40, 104 + self._version_y_offset, round(330 * self._scale), round(230 * self._scale), Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, version[0] if not ApplicationMetadata.IsAlternateVersion else ApplicationMetadata.CuraBuildType)
|
painter.drawText(40, 104 + self._version_y_offset, round(330 * self._scale), round(230 * self._scale), Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, version[0] if not ApplicationMetadata.IsAlternateVersion else ApplicationMetadata.CuraBuildType)
|
||||||
elif len(version) > 1:
|
elif len(version) > 1:
|
||||||
painter.drawText(40, 104 + self._version_y_offset, round(330 * self._scale), round(230 * self._scale), Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, version[0] +" "+ version[1] if not ApplicationMetadata.IsAlternateVersion else ApplicationMetadata.CuraBuildType)
|
painter.drawText(40, 104 + self._version_y_offset, round(330 * self._scale), round(230 * self._scale), Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignTop, {"version[0]_version[1]"} if not ApplicationMetadata.IsAlternateVersion else ApplicationMetadata.CuraBuildType)
|
||||||
|
|
||||||
# Draw the loading image
|
# Draw the loading image
|
||||||
pen = QPen()
|
pen = QPen()
|
||||||
|
@ -93,7 +93,7 @@ class CuraSplashScreen(QSplashScreen):
|
||||||
pen.setColor(QColor(255, 255, 255, 255))
|
pen.setColor(QColor(255, 255, 255, 255))
|
||||||
painter.setPen(pen)
|
painter.setPen(pen)
|
||||||
painter.setFont(font)
|
painter.setFont(font)
|
||||||
painter.drawText(70, 320, 170, 24,
|
painter.drawText(70, 308, 170, 48,
|
||||||
Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter | Qt.TextFlag.TextWordWrap,
|
Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter | Qt.TextFlag.TextWordWrap,
|
||||||
self._current_message)
|
self._current_message)
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ class ThreeMFWriter(MeshWriter):
|
||||||
snapshot = self._createSnapshot()
|
snapshot = self._createSnapshot()
|
||||||
if snapshot:
|
if snapshot:
|
||||||
thumbnail_buffer = QBuffer()
|
thumbnail_buffer = QBuffer()
|
||||||
thumbnail_buffer.open(QBuffer.ReadWrite)
|
thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite)
|
||||||
snapshot.save(thumbnail_buffer, "PNG")
|
snapshot.save(thumbnail_buffer, "PNG")
|
||||||
|
|
||||||
thumbnail_file = zipfile.ZipInfo("Metadata/thumbnail.png")
|
thumbnail_file = zipfile.ZipInfo("Metadata/thumbnail.png")
|
||||||
|
|
|
@ -56,7 +56,7 @@ Item
|
||||||
id: createNewProjectButton
|
id: createNewProjectButton
|
||||||
|
|
||||||
text: "New Library project"
|
text: "New Library project"
|
||||||
visible: createNewProjectButtonVisible && manager.userAccountCanCreateNewLibraryProject && (manager.retrievingProjectsStatus == DF.RetrievalStatus.Success || manager.retrievingProjectsStatus == DF.RetrievalStatus.Failed)
|
visible: createNewProjectButtonVisible && manager.userAccountCanCreateNewLibraryProject && (manager.retrievingProjectsStatus == 2 || manager.retrievingProjectsStatus == 3) // Status is succeeded or failed
|
||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ImageReader(MeshReader):
|
||||||
aspect = height / width
|
aspect = height / width
|
||||||
|
|
||||||
if img.width() < 2 or img.height() < 2:
|
if img.width() < 2 or img.height() < 2:
|
||||||
img = img.scaled(width, height, Qt.IgnoreAspectRatio)
|
img = img.scaled(width, height, Qt.AspectRatioMode.IgnoreAspectRatio)
|
||||||
|
|
||||||
height_from_base = max(height_from_base, 0)
|
height_from_base = max(height_from_base, 0)
|
||||||
base_height = max(base_height, 0)
|
base_height = max(base_height, 0)
|
||||||
|
@ -84,15 +84,15 @@ class ImageReader(MeshReader):
|
||||||
|
|
||||||
width = int(max(round(width * scale_factor), 2))
|
width = int(max(round(width * scale_factor), 2))
|
||||||
height = int(max(round(height * scale_factor), 2))
|
height = int(max(round(height * scale_factor), 2))
|
||||||
img = img.scaled(width, height, Qt.IgnoreAspectRatio)
|
img = img.scaled(width, height, Qt.AspectRatioMode.IgnoreAspectRatio)
|
||||||
|
|
||||||
width_minus_one = width - 1
|
width_minus_one = width - 1
|
||||||
height_minus_one = height - 1
|
height_minus_one = height - 1
|
||||||
|
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
|
|
@ -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.WindowType.WindowCloseButtonHint & ~Qt.WindowType.WindowMinimizeButtonHint & ~Qt.WindowType.WindowMaximizeButtonHint)
|
||||||
self._disable_size_callbacks = False
|
self._disable_size_callbacks = False
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
|
@ -22,7 +22,7 @@ class CreateThumbnail(Script):
|
||||||
Logger.log("d", "Encoding thumbnail image...")
|
Logger.log("d", "Encoding thumbnail image...")
|
||||||
try:
|
try:
|
||||||
thumbnail_buffer = QBuffer()
|
thumbnail_buffer = QBuffer()
|
||||||
thumbnail_buffer.open(QBuffer.ReadWrite)
|
thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite)
|
||||||
thumbnail_image = snapshot
|
thumbnail_image = snapshot
|
||||||
thumbnail_image.save(thumbnail_buffer, "PNG")
|
thumbnail_image.save(thumbnail_buffer, "PNG")
|
||||||
base64_bytes = base64.b64encode(thumbnail_buffer.data())
|
base64_bytes = base64.b64encode(thumbnail_buffer.data())
|
||||||
|
|
|
@ -266,7 +266,7 @@ Item
|
||||||
anchors.bottom: parent.top
|
anchors.bottom: parent.top
|
||||||
anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
|
anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
target: Qt.point(parent.width / 2, parent.top)
|
target: Qt.point(parent.width / 2, 1)
|
||||||
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
|
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
|
||||||
|
|
||||||
// custom properties
|
// custom properties
|
||||||
|
@ -376,7 +376,7 @@ Item
|
||||||
anchors.top: parent.bottom
|
anchors.top: parent.bottom
|
||||||
anchors.topMargin: UM.Theme.getSize("narrow_margin").height
|
anchors.topMargin: UM.Theme.getSize("narrow_margin").height
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
target: Qt.point(parent.width / 2, parent.bottom)
|
target: Qt.point(parent.width / 2, -1)
|
||||||
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
|
visible: sliderRoot.activeHandle == parent || sliderRoot.activeHandle == rangeHandle
|
||||||
|
|
||||||
// custom properties
|
// custom properties
|
||||||
|
|
|
@ -83,7 +83,7 @@ class UFPWriter(MeshWriter):
|
||||||
thumbnail = archive.getStream("/Metadata/thumbnail.png")
|
thumbnail = archive.getStream("/Metadata/thumbnail.png")
|
||||||
|
|
||||||
thumbnail_buffer = QBuffer()
|
thumbnail_buffer = QBuffer()
|
||||||
thumbnail_buffer.open(QBuffer.ReadWrite)
|
thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite)
|
||||||
snapshot.save(thumbnail_buffer, "PNG")
|
snapshot.save(thumbnail_buffer, "PNG")
|
||||||
|
|
||||||
thumbnail.write(thumbnail_buffer.data())
|
thumbnail.write(thumbnail_buffer.data())
|
||||||
|
|
|
@ -480,7 +480,7 @@ class CloudOutputDeviceManager:
|
||||||
if remove_printers_ids == all_ids:
|
if remove_printers_ids == all_ids:
|
||||||
question_content = self.i18n_catalog.i18nc("@label", "You are about to remove all printers from Cura. This action cannot be undone.\nAre you sure you want to continue?")
|
question_content = self.i18n_catalog.i18nc("@label", "You are about to remove all printers from Cura. This action cannot be undone.\nAre you sure you want to continue?")
|
||||||
result = QMessageBox.question(None, question_title, question_content)
|
result = QMessageBox.question(None, question_title, question_content)
|
||||||
if result == QMessageBox.No:
|
if result == QMessageBox.ButtonRole.NoRole:
|
||||||
return
|
return
|
||||||
|
|
||||||
for machine_cloud_id in self.reported_device_ids:
|
for machine_cloud_id in self.reported_device_ids:
|
||||||
|
|
|
@ -119,6 +119,7 @@ Column
|
||||||
|
|
||||||
text: widget.waitingForSliceToStart ? catalog.i18nc("@button", "Processing"): catalog.i18nc("@button", "Slice")
|
text: widget.waitingForSliceToStart ? catalog.i18nc("@button", "Processing"): catalog.i18nc("@button", "Slice")
|
||||||
tooltip: catalog.i18nc("@label", "Start the slicing process")
|
tooltip: catalog.i18nc("@label", "Start the slicing process")
|
||||||
|
hoverEnabled: !widget.waitingForSliceToStart
|
||||||
enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart
|
enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart
|
||||||
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
|
visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
|
@ -157,7 +157,7 @@ Item
|
||||||
anchors.topMargin: base.activeY
|
anchors.topMargin: base.activeY
|
||||||
z: buttons.z - 1
|
z: buttons.z - 1
|
||||||
|
|
||||||
target: Qt.point(parent.right, base.activeY + Math.round(UM.Theme.getSize("button").height/2))
|
target: Qt.point(-1, base.activeY + Math.round(UM.Theme.getSize("button").height / 2))
|
||||||
arrowSize: UM.Theme.getSize("default_arrow").width
|
arrowSize: UM.Theme.getSize("default_arrow").width
|
||||||
|
|
||||||
width:
|
width:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue