Fix dialog not closing on load failure

This commit is contained in:
Brahim Hadriche committed 2024-01-24 16:29:22 -05:00
1 parent b1a373f98d
commit d9b8aaa222
2 files changed
+8 -15

No files matched your search

@@ -109,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
"If the problem persist, contact Playlet authors." "If the problem persist, contact Playlet authors."
] ]
Dialog.ShowError(message, bulletText, bottomText) DialogShowError(message, bulletText, bottomText)
end function end function
+7 -14
View File
@@ -1,9 +1,7 @@
namespace Dialog function DialogShowError(message as object, bulletText as object, bottomMessage as object)
function ShowError(message as object, bulletText as object, bottomMessage as object)
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later ' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
msgDialog = CreateObject("roSGNode", "StandardMessageDialog") msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
SetPalette(msgDialog) DialogSetPalette(msgDialog)
msgDialog.message = message msgDialog.message = message
msgDialog.bulletText = bulletText msgDialog.bulletText = bulletText
msgDialog.bottomMessage = bottomMessage msgDialog.bottomMessage = bottomMessage
@@ -11,14 +9,14 @@ namespace Dialog
msgDialog.buttons = ["Exit"] msgDialog.buttons = ["Exit"]
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK ' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("buttonSelected", "OnButtonSelected") msgDialog.observeField("buttonSelected", "DialogOnButtonSelected")
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK ' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
msgDialog.observeField("wasClosed", "OnDialogClosed") msgDialog.observeField("wasClosed", "DialogOnClosed")
m.top.getScene().dialog = msgDialog m.top.getScene().dialog = msgDialog
end function end function
function SetPalette(msgDialog as object) function DialogSetPalette(msgDialog as object)
palette = createObject("roSGNode", "RSGPalette") palette = createObject("roSGNode", "RSGPalette")
palette.colors = { palette.colors = {
DialogBackgroundColor: "#242424FF" DialogBackgroundColor: "#242424FF"
@@ -31,15 +29,10 @@ namespace Dialog
msgDialog.palette = palette msgDialog.palette = palette
end function end function
function OnButtonSelected() function DialogOnButtonSelected()
m.top.getScene().dialog.close = true m.top.getScene().dialog.close = true
end function end function
function OnDialogClosed() function DialogOnClosed()
' TODO:P1 throw an exception to cause a crash report to be generated
' Should include which playlet lib failed to load
m.top.getScene().exitChannel = true m.top.getScene().exitChannel = true
end function end function
end namespace