diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 1aa6c86dcb..4c0ed55bfe 100755 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -4,12 +4,12 @@ import argparse #To run the engine in debug mode if the front-end is in debug mode. from collections import defaultdict import os -from PyQt5.QtCore import QObject, QTimer, pyqtSlot +from PyQt5.QtCore import QObject, QTimer, QUrl, pyqtSlot import sys from time import time from typing import Any, cast, Dict, List, Optional, Set, TYPE_CHECKING -from PyQt5.QtGui import QImage +from PyQt5.QtGui import QDesktopServices, QImage from UM.Backend.Backend import Backend, BackendState from UM.Scene.SceneNode import SceneNode @@ -922,9 +922,31 @@ class CuraEngineBackend(QObject, Backend): if not self._restart: if self._process: # type: ignore - Logger.log("d", "Backend quit with return code %s. Resetting process and socket.", self._process.wait()) # type: ignore + return_code = self._process.wait() + if return_code != 0: + Logger.log("e", f"Backend exited abnormally with return code {return_code}!") + message = Message( + text = catalog.i18nc("@message", "Slicing failed with an unexpected error. Please consider reporting a bug on our issue tracker."), + title = catalog.i18nc("@message:title", "Slicing failed") + ) + message.addAction( + action_id = "report_bug", + name = catalog.i18nc("@message:button", "Report a bug"), + description = catalog.i18nc("@message:description", "Report a bug on Ultimaker Cura's issue tracker."), + icon = "[no_icon]" + ) + message.actionTriggered.connect(self._reportBackendError) + message.show() + else: + Logger.log("d", "Backend finished slicing. Resetting process and socket.") self._process = None # type: ignore + def _reportBackendError(self, _message_id: str, _action_id: str) -> None: + """ + Triggered when the user wants to report an error in the back-end. + """ + QDesktopServices.openUrl(QUrl("https://github.com/Ultimaker/Cura/issues/new/choose")) + def _onGlobalStackChanged(self) -> None: """Called when the global container stack changes"""