Report uncaught Python exceptions with a GUI popup

This commit is contained in:
miruka
2019-12-26 09:20:51 -04:00
parent eff64fabd6
commit 511681ae4d
6 changed files with 77 additions and 10 deletions

View File

@@ -21,8 +21,10 @@ HPopup {
property alias details: details
property string okText: qsTr("OK")
property string okIcon: "ok"
property bool okEnabled: true
property bool okClicked: false
property string cancelText: qsTr("Cancel")
Binding on height {
@@ -40,8 +42,8 @@ HPopup {
clickButtonOnEnter: "ok"
buttonModel: [
{ name: "ok", text: okText, iconName: "ok", enabled: okEnabled},
{ name: "cancel", text: qsTr("Cancel"), iconName: "cancel" },
{ name: "ok", text: okText, iconName: okIcon, enabled: okEnabled},
{ name: "cancel", text: cancelText, iconName: "cancel" },
]
buttonCallbacks: ({

View File

@@ -0,0 +1,39 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
BoxPopup {
summary.text: qsTr("Unexpected error occured: <i>%1</i>").arg(errorType)
summary.textFormat: Text.StyledText
okText: qsTr("Report")
okIcon: "report-error"
okEnabled: false // TODO
cancelText: qsTr("Ignore")
box.focusButton: "cancel"
property string errorType
property var errorArguments: []
property string traceback: ""
HScrollableTextArea {
text: traceback || qsTr("No traceback available")
area.readOnly: true
Layout.fillWidth: true
}
HCheckBox {
text: qsTr("Hide this type of error until restart")
onCheckedChanged:
checked ?
window.hideErrorTypes.add(errorType) :
window.hideErrorTypes.delete(errorType)
Layout.fillWidth: true
}
}