mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 11:19:04 +08:00
Add extra warnings if it failed to create snapshot
CURA-9120
This commit is contained in:
parent
c9e625767b
commit
204eeaf272
@ -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
|
||||||
@ -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.log("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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user