diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 420c1c0afc..c1b0ceeaae 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -206,7 +206,7 @@ class ContainerManager(QObject): if os.path.exists(file_url): result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"), catalog.i18nc("@label Don't translate the XML tag !", "The file {0} 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"} try: diff --git a/cura/Settings/CuraContainerRegistry.py b/cura/Settings/CuraContainerRegistry.py index 6a0b8c0cd0..a72828708b 100644 --- a/cura/Settings/CuraContainerRegistry.py +++ b/cura/Settings/CuraContainerRegistry.py @@ -139,7 +139,7 @@ class CuraContainerRegistry(ContainerRegistry): if os.path.exists(file_name): result = QMessageBox.question(None, catalog.i18nc("@title:window", "File Already Exists"), catalog.i18nc("@label Don't translate the XML tag !", "The file {0} already exists. Are you sure you want to overwrite it?").format(file_name)) - if result == QMessageBox.No: + if result == QMessageBox.ButtonRole.NoRole: return False profile_writer = self._findProfileWriter(extension, description) diff --git a/cura/Snapshot.py b/cura/Snapshot.py index 97306fb371..1266d3dcb1 100644 --- a/cura/Snapshot.py +++ b/cura/Snapshot.py @@ -6,6 +6,7 @@ from PyQt6 import QtCore from PyQt6.QtCore import QCoreApplication from PyQt6.QtGui import QImage +from UM.Logger import Logger from cura.PreviewPass import PreviewPass from UM.Application import Application @@ -20,7 +21,7 @@ class Snapshot: def getImageBoundaries(image: QImage): # Look at the resulting image to get a good crop. # 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() # 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]) @@ -64,6 +65,7 @@ class Snapshot: bbox = bbox + node.getBoundingBox() # If there is no bounding box, it means that there is no model in the buildplate if bbox is None: + Logger.log("w", "Unable to create snapshot as we seem to have an empty buildplate") return None look_at = bbox.center @@ -96,6 +98,7 @@ class Snapshot: try: min_x, max_x, min_y, max_y = Snapshot.getImageBoundaries(pixel_output) except (ValueError, AttributeError): + Logger.logException("w", "Failed to crop the snapshot!") return None 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 scaled_image = cropped_image.scaled( width, height, - aspectRatioMode = QtCore.Qt.IgnoreAspectRatio, - transformMode = QtCore.Qt.SmoothTransformation) + aspectRatioMode = QtCore.Qt.AspectRatioMode.IgnoreAspectRatio, + transformMode = QtCore.Qt.TransformationMode.SmoothTransformation) return scaled_image diff --git a/cura/UI/CuraSplashScreen.py b/cura/UI/CuraSplashScreen.py index c609f9a44f..a6130e4d00 100644 --- a/cura/UI/CuraSplashScreen.py +++ b/cura/UI/CuraSplashScreen.py @@ -76,7 +76,7 @@ class CuraSplashScreen(QSplashScreen): 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) 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 pen = QPen() @@ -93,7 +93,7 @@ class CuraSplashScreen(QSplashScreen): pen.setColor(QColor(255, 255, 255, 255)) painter.setPen(pen) painter.setFont(font) - painter.drawText(70, 320, 170, 24, + painter.drawText(70, 308, 170, 48, Qt.AlignmentFlag.AlignLeft | Qt.AlignmentFlag.AlignVCenter | Qt.TextFlag.TextWordWrap, self._current_message) diff --git a/plugins/3MFWriter/ThreeMFWriter.py b/plugins/3MFWriter/ThreeMFWriter.py index a1eb969338..853aa08513 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -157,7 +157,7 @@ class ThreeMFWriter(MeshWriter): snapshot = self._createSnapshot() if snapshot: thumbnail_buffer = QBuffer() - thumbnail_buffer.open(QBuffer.ReadWrite) + thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite) snapshot.save(thumbnail_buffer, "PNG") thumbnail_file = zipfile.ZipInfo("Metadata/thumbnail.png") diff --git a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml index 89ebd0f215..ed632124e5 100644 --- a/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml +++ b/plugins/DigitalLibrary/resources/qml/SelectProjectPage.qml @@ -56,7 +56,7 @@ Item id: createNewProjectButton 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: { diff --git a/plugins/ImageReader/ImageReader.py b/plugins/ImageReader/ImageReader.py index 21833177ed..b6895f5554 100644 --- a/plugins/ImageReader/ImageReader.py +++ b/plugins/ImageReader/ImageReader.py @@ -63,7 +63,7 @@ class ImageReader(MeshReader): aspect = height / width 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) base_height = max(base_height, 0) @@ -84,15 +84,15 @@ class ImageReader(MeshReader): width = int(max(round(width * 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 height_minus_one = height - 1 Job.yieldThread() - texel_width = 1.0 / (width_minus_one) * scale_vector.x - texel_height = 1.0 / (height_minus_one) * scale_vector.z + 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) diff --git a/plugins/ImageReader/ImageReaderUI.py b/plugins/ImageReader/ImageReaderUI.py index 86d990c566..54aa8eadc0 100644 --- a/plugins/ImageReader/ImageReaderUI.py +++ b/plugins/ImageReader/ImageReaderUI.py @@ -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.WindowType.WindowCloseButtonHint & ~Qt.WindowType.WindowMinimizeButtonHint & ~Qt.WindowType.WindowMaximizeButtonHint) self._disable_size_callbacks = False @pyqtSlot() diff --git a/plugins/PostProcessingPlugin/scripts/CreateThumbnail.py b/plugins/PostProcessingPlugin/scripts/CreateThumbnail.py index c3d1cc28c6..fef66915bf 100644 --- a/plugins/PostProcessingPlugin/scripts/CreateThumbnail.py +++ b/plugins/PostProcessingPlugin/scripts/CreateThumbnail.py @@ -22,7 +22,7 @@ class CreateThumbnail(Script): Logger.log("d", "Encoding thumbnail image...") try: thumbnail_buffer = QBuffer() - thumbnail_buffer.open(QBuffer.ReadWrite) + thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite) thumbnail_image = snapshot thumbnail_image.save(thumbnail_buffer, "PNG") base64_bytes = base64.b64encode(thumbnail_buffer.data()) diff --git a/plugins/SimulationView/LayerSlider.qml b/plugins/SimulationView/LayerSlider.qml index 0a24ca9023..f08c72c1f7 100644 --- a/plugins/SimulationView/LayerSlider.qml +++ b/plugins/SimulationView/LayerSlider.qml @@ -266,7 +266,7 @@ Item anchors.bottom: parent.top anchors.bottomMargin: UM.Theme.getSize("narrow_margin").height 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 // custom properties @@ -376,7 +376,7 @@ Item anchors.top: parent.bottom anchors.topMargin: UM.Theme.getSize("narrow_margin").height 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 // custom properties diff --git a/plugins/UFPWriter/UFPWriter.py b/plugins/UFPWriter/UFPWriter.py index fdd8fd98ea..52dab1efc7 100644 --- a/plugins/UFPWriter/UFPWriter.py +++ b/plugins/UFPWriter/UFPWriter.py @@ -83,7 +83,7 @@ class UFPWriter(MeshWriter): thumbnail = archive.getStream("/Metadata/thumbnail.png") thumbnail_buffer = QBuffer() - thumbnail_buffer.open(QBuffer.ReadWrite) + thumbnail_buffer.open(QBuffer.OpenModeFlag.ReadWrite) snapshot.save(thumbnail_buffer, "PNG") thumbnail.write(thumbnail_buffer.data()) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 931fdee154..004c9bc656 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -480,7 +480,7 @@ class CloudOutputDeviceManager: 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?") result = QMessageBox.question(None, question_title, question_content) - if result == QMessageBox.No: + if result == QMessageBox.ButtonRole.NoRole: return for machine_cloud_id in self.reported_device_ids: diff --git a/resources/qml/ActionPanel/SliceProcessWidget.qml b/resources/qml/ActionPanel/SliceProcessWidget.qml index 868f23d242..58bf736575 100644 --- a/resources/qml/ActionPanel/SliceProcessWidget.qml +++ b/resources/qml/ActionPanel/SliceProcessWidget.qml @@ -119,6 +119,7 @@ Column text: widget.waitingForSliceToStart ? catalog.i18nc("@button", "Processing"): catalog.i18nc("@button", "Slice") tooltip: catalog.i18nc("@label", "Start the slicing process") + hoverEnabled: !widget.waitingForSliceToStart enabled: widget.backendState != UM.Backend.Error && !widget.waitingForSliceToStart visible: widget.backendState == UM.Backend.NotStarted || widget.backendState == UM.Backend.Error onClicked: { diff --git a/resources/qml/Toolbar.qml b/resources/qml/Toolbar.qml index c931a9f882..9c1abd31b7 100644 --- a/resources/qml/Toolbar.qml +++ b/resources/qml/Toolbar.qml @@ -157,7 +157,7 @@ Item anchors.topMargin: base.activeY 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 width: