mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix crash in image reader and ensure it actually works
CURA-9125
This commit is contained in:
parent
50954552d2
commit
ddb3ed1693
2 changed files with 5 additions and 5 deletions
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue