Browse Source

Close "Finding Location" message if arrange crashes

CURA-7780
Kostas Karmas 4 years ago
parent
commit
148dd26b67
1 changed files with 7 additions and 2 deletions
  1. 7 2
      cura/Arranging/ArrangeObjectsJob.py

+ 7 - 2
cura/Arranging/ArrangeObjectsJob.py

@@ -4,6 +4,7 @@ from typing import List
 
 from UM.Application import Application
 from UM.Job import Job
+from UM.Logger import Logger
 from UM.Message import Message
 from UM.Scene.SceneNode import SceneNode
 from UM.i18n import i18nCatalog
@@ -27,10 +28,14 @@ class ArrangeObjectsJob(Job):
                                  title = i18n_catalog.i18nc("@info:title", "Finding Location"))
         status_message.show()
 
-        found_solution_for_all = arrange(self._nodes, Application.getInstance().getBuildVolume(), self._fixed_nodes)
+        found_solution_for_all = None
+        try:
+            found_solution_for_all = arrange(self._nodes, Application.getInstance().getBuildVolume(), self._fixed_nodes)
+        except:  # If the thread crashes, the message should still close
+            Logger.logException("e", "Unable to arrange the objects on the buildplate. The arrange algorithm has crashed.")
 
         status_message.hide()
-        if not found_solution_for_all:
+        if found_solution_for_all is not None and not found_solution_for_all:
             no_full_solution_message = Message(
                     i18n_catalog.i18nc("@info:status",
                                        "Unable to find a location within the build volume for all objects"),