Report uncaught Python exceptions with a GUI popup
This commit is contained in:
@@ -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: ({
|
||||
|
39
src/gui/Popups/UnexpectedErrorPopup.qml
Normal file
39
src/gui/Popups/UnexpectedErrorPopup.qml
Normal 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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user