Add preference to disable sentry engine crash reporting

CURA-11364
This commit is contained in:
Jaime van Kessel 2023-11-21 14:01:58 +01:00
parent f22d82c1e0
commit 60bf2fbc2c
No known key found for this signature in database
GPG key ID: C85F7A3AF1BAA7C4
2 changed files with 35 additions and 4 deletions

View file

@ -163,6 +163,7 @@ class CuraEngineBackend(QObject, Backend):
self._is_disabled: bool = False
application.getPreferences().addPreference("general/auto_slice", False)
application.getPreferences().addPreference("info/send_engine_crash", True)
self._use_timer: bool = False
@ -173,6 +174,8 @@ class CuraEngineBackend(QObject, Backend):
self._change_timer.setSingleShot(True)
self._change_timer.setInterval(500)
self.determineAutoSlicing()
application.getPreferences().preferenceChanged.connect(self._onPreferencesChanged)
self._slicing_error_message = Message(
@ -193,6 +196,9 @@ class CuraEngineBackend(QObject, Backend):
application.initializationFinished.connect(self.initialize)
# Ensure that the initial value for send_engine_crash is handled correctly.
application.callLater(self._onPreferencesChanged, "info/send_engine_crash")
def startPlugins(self) -> None:
"""
Ensure that all backend plugins are started
@ -1088,11 +1094,17 @@ class CuraEngineBackend(QObject, Backend):
self._change_timer.timeout.disconnect(self.slice)
def _onPreferencesChanged(self, preference: str) -> None:
if preference != "general/auto_slice":
if preference != "general/auto_slice" and preference != "info/send_engine_crash":
return
if preference == "general/auto_slice":
auto_slice = self.determineAutoSlicing()
if auto_slice:
self._change_timer.start()
elif preference == "info/send_engine_crash":
if CuraApplication.getInstance().getPreferences().getValue("info/send_engine_crash"):
os.environ["use_sentry"] = str(1)
else:
os.environ["use_sentry"] = str(0)
def tickle(self) -> None:
"""Tickle the backend so in case of auto slicing, it starts the timer."""

View file

@ -120,6 +120,10 @@ UM.PreferencesPage
UM.Preferences.resetPreference("info/send_slice_info")
sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
UM.Preferences.resetPreference("info/send_engine_crash")
sendEngineCrashCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_engine_crash"))
UM.Preferences.resetPreference("info/automatic_update_check")
checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
@ -855,6 +859,21 @@ UM.PreferencesPage
font: UM.Theme.getFont("medium_bold")
text: catalog.i18nc("@label", "Privacy")
}
UM.TooltipArea
{
width: childrenRect.width
height: visible ? childrenRect.height : 0
text: catalog.i18nc("@info:tooltip", "Should slicing crashes be automatically reported to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
UM.CheckBox
{
id: sendEngineCrashCheckbox
text: catalog.i18nc("@option:check","Send (anonymous) engine crash reports")
checked: boolCheck(UM.Preferences.getValue("info/send_engine_crash"))
onCheckedChanged: UM.Preferences.setValue("info/send_engine_crash", checked)
}
}
UM.TooltipArea
{
width: childrenRect.width