mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:16:04 +08:00
review comments fixing
CURA-11650
This commit is contained in:
parent
28997b0b14
commit
c4881641c3
@ -193,13 +193,10 @@ class Snapshot:
|
|||||||
preview_pass.setCamera(camera)
|
preview_pass.setCamera(camera)
|
||||||
preview_pass.render()
|
preview_pass.render()
|
||||||
pixel_output = preview_pass.getOutput()
|
pixel_output = preview_pass.getOutput()
|
||||||
if Snapshot._prereadSnapshot(pixel_output):
|
|
||||||
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) as e:
|
except (ValueError, AttributeError) as e:
|
||||||
Logger.logException("w", f"Failed to crop the snapshot! {e}")
|
if number_of_attempts == 0:
|
||||||
return None
|
|
||||||
elif number_of_attempts == 0:
|
|
||||||
Logger.warning( f"Failed to crop the snapshot even after {Snapshot.ATTEMPTS_FOR_SNAPSHOT} attempts!")
|
Logger.warning( f"Failed to crop the snapshot even after {Snapshot.ATTEMPTS_FOR_SNAPSHOT} attempts!")
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@ -230,8 +227,3 @@ class Snapshot:
|
|||||||
transformMode = QtCore.Qt.TransformationMode.SmoothTransformation)
|
transformMode = QtCore.Qt.TransformationMode.SmoothTransformation)
|
||||||
|
|
||||||
return scaled_image
|
return scaled_image
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _prereadSnapshot(snap = QImage):
|
|
||||||
nonzero_pixels = Snapshot.getNonZeroPixels(snap)
|
|
||||||
return all(len(nonzero_pixels[i]) != 0 for i in range(3))
|
|
Loading…
x
Reference in New Issue
Block a user