mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-24 06:39:38 +08:00
Fix crash in image reader and ensure it actually works
CURA-9125
This commit is contained in:
parent
50954552d2
commit
ddb3ed1693
@ -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)
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user