Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2021-07-14 17:58:05 +0300
committerGhostkeeper <rubend@tutanota.com>2021-07-14 18:05:44 +0300
commit399b378ba65499b04ccf25916f4b6d8d1dc23b38 (patch)
treee7fcbcb4b1eafeb00ab0a7a3aff16efed63272ba /plugins/CuraEngineBackend
parente9ecba13746482d0d1e183a641f9577a1a63085a (diff)
Show message when slicing failed with nonzero exit code
The slicing engine should never crash. If it does though, it's best to show something to the user. Otherwise the slicing process just halts and the user will wait a long time for it to never finish. Contributes to issue CURA-6568.
Diffstat (limited to 'plugins/CuraEngineBackend')
-rwxr-xr-xplugins/CuraEngineBackend/CuraEngineBackend.py28
1 files changed, 25 insertions, 3 deletions
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"""