refactor dialog palette
This commit is contained in:
1 parent
68c8f12f9d
commit
4b3d1340df
10 files changed
+42
-27
No files matched your search
@@ -1,7 +1,6 @@
|
|||||||
function DialogShowError(message as object, bulletText as object, bottomMessage as object)
|
function DialogShowError(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")
|
||||||
DialogSetPalette(msgDialog)
|
|
||||||
msgDialog.message = message
|
msgDialog.message = message
|
||||||
msgDialog.bulletText = bulletText
|
msgDialog.bulletText = bulletText
|
||||||
msgDialog.bottomMessage = bottomMessage
|
msgDialog.bottomMessage = bottomMessage
|
||||||
@@ -16,19 +15,6 @@ function DialogShowError(message as object, bulletText as object, bottomMessage
|
|||||||
m.top.getScene().dialog = msgDialog
|
m.top.getScene().dialog = msgDialog
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function DialogSetPalette(msgDialog as object)
|
|
||||||
palette = createObject("roSGNode", "RSGPalette")
|
|
||||||
palette.colors = {
|
|
||||||
DialogBackgroundColor: "#242424FF"
|
|
||||||
DialogFocusColor: "#CECECEFF"
|
|
||||||
DialogFocusItemColor: "#202020FF"
|
|
||||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
|
||||||
DialogSecondaryItemColor: "#FF1C30FF"
|
|
||||||
DialogTextColor: "#EBEBEBFF"
|
|
||||||
}
|
|
||||||
msgDialog.palette = palette
|
|
||||||
end function
|
|
||||||
|
|
||||||
function DialogOnButtonSelected()
|
function DialogOnButtonSelected()
|
||||||
m.top.getScene().dialog.close = true
|
m.top.getScene().dialog.close = true
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ function Main(args as object) as void
|
|||||||
scene = screen.CreateScene("BootstrapScene")
|
scene = screen.CreateScene("BootstrapScene")
|
||||||
screen.show()
|
screen.show()
|
||||||
|
|
||||||
|
SetScenePalette(scene)
|
||||||
scene.ObserveField("exitChannel", port)
|
scene.ObserveField("exitChannel", port)
|
||||||
scene.launchArgs = args
|
scene.launchArgs = args
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
function SetPalette(dialog as object)
|
function SetScenePalette(scene as object)
|
||||||
palette = createObject("roSGNode", "RSGPalette")
|
palette = CreateObject("roSGNode", "RSGPalette")
|
||||||
palette.colors = {
|
palette.colors = {
|
||||||
DialogBackgroundColor: "#242424FF"
|
DialogBackgroundColor: "#242424FF"
|
||||||
DialogFocusColor: "#CECECEFF"
|
DialogFocusColor: "#CECECEFF"
|
||||||
@@ -8,5 +8,5 @@ function SetPalette(dialog as object)
|
|||||||
DialogSecondaryItemColor: "#FF1C30FF"
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
DialogTextColor: "#EBEBEBFF"
|
DialogTextColor: "#EBEBEBFF"
|
||||||
}
|
}
|
||||||
dialog.palette = palette
|
scene.palette = palette
|
||||||
end function
|
end function
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
import "DialogPalette.bs"
|
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
SetPalette(m.top)
|
|
||||||
m.urlLabel = m.top.findNode("urlLabel")
|
m.urlLabel = m.top.findNode("urlLabel")
|
||||||
m.qrCode = m.top.findNode("QrCodePoster")
|
m.qrCode = m.top.findNode("QrCodePoster")
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import "DialogPalette.bs"
|
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
SetPalette(m.top)
|
|
||||||
m.top.observeField("buttonSelected", FuncName(CloseDialog))
|
m.top.observeField("buttonSelected", FuncName(CloseDialog))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import "DialogPalette.bs"
|
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
SetPalette(m.top)
|
|
||||||
m.top.observeField("buttonSelected", FuncName(OnButtonSelected))
|
m.top.observeField("buttonSelected", FuncName(OnButtonSelected))
|
||||||
m.top.observeField("wasClosed", FuncName(OnDialogClosed))
|
m.top.observeField("wasClosed", FuncName(OnDialogClosed))
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -7,12 +7,32 @@ import "pkg:/source/utils/Locale.bs"
|
|||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.scene = m.top.getScene()
|
m.scene = m.top.getScene()
|
||||||
|
SetScenePalette(m.scene)
|
||||||
|
|
||||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||||
' Let's wait until it has one.
|
' Let's wait until it has one.
|
||||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
||||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function SetScenePalette(scene as object) as void
|
||||||
|
palette = scene.palette
|
||||||
|
if palette <> invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
palette = CreateObject("roSGNode", "RSGPalette")
|
||||||
|
palette.colors = {
|
||||||
|
DialogBackgroundColor: "#242424FF"
|
||||||
|
DialogFocusColor: "#CECECEFF"
|
||||||
|
DialogFocusItemColor: "#202020FF"
|
||||||
|
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||||
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
|
DialogTextColor: "#EBEBEBFF"
|
||||||
|
}
|
||||||
|
scene.palette = palette
|
||||||
|
end function
|
||||||
|
|
||||||
function MainSceneContainerChanged()
|
function MainSceneContainerChanged()
|
||||||
AutoBindSceneGraph()
|
AutoBindSceneGraph()
|
||||||
StartWebServer()
|
StartWebServer()
|
||||||
|
|||||||
@@ -8,12 +8,30 @@
|
|||||||
function Init()
|
function Init()
|
||||||
InitializeBindings() ' auto-generated!
|
InitializeBindings() ' auto-generated!
|
||||||
m.scene = m.top.getScene()
|
m.scene = m.top.getScene()
|
||||||
|
SetScenePalette(m.scene)
|
||||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||||
' Let's wait until it has one.
|
' Let's wait until it has one.
|
||||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
||||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function SetScenePalette(scene as object) as void
|
||||||
|
palette = scene.palette
|
||||||
|
if palette <> invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
palette = CreateObject("roSGNode", "RSGPalette")
|
||||||
|
palette.colors = {
|
||||||
|
DialogBackgroundColor: "#242424FF"
|
||||||
|
DialogFocusColor: "#CECECEFF"
|
||||||
|
DialogFocusItemColor: "#202020FF"
|
||||||
|
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||||
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
|
DialogTextColor: "#EBEBEBFF"
|
||||||
|
}
|
||||||
|
scene.palette = palette
|
||||||
|
end function
|
||||||
|
|
||||||
function MainSceneContainerChanged()
|
function MainSceneContainerChanged()
|
||||||
AutoBindSceneGraph()
|
AutoBindSceneGraph()
|
||||||
StartWebServer()
|
StartWebServer()
|
||||||
|
|||||||
-2
@@ -1,4 +1,3 @@
|
|||||||
import "pkg:/components/Dialog/DialogPalette.bs"
|
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||||
@@ -102,7 +101,6 @@ end function
|
|||||||
|
|
||||||
function OnEditButtonSelected()
|
function OnEditButtonSelected()
|
||||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||||
SetPalette(keyboardDialog)
|
|
||||||
' TODO:P2 localize
|
' TODO:P2 localize
|
||||||
keyboardDialog.title = "Edit Instance"
|
keyboardDialog.title = "Edit Instance"
|
||||||
' TODO:P2 localize
|
' TODO:P2 localize
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import "pkg:/components/Dialog/DialogPalette.bs"
|
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Locale.bs"
|
import "pkg:/source/utils/Locale.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
@@ -67,7 +66,6 @@ end function
|
|||||||
|
|
||||||
function ShowEditKeyboard()
|
function ShowEditKeyboard()
|
||||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||||
SetPalette(keyboardDialog)
|
|
||||||
keyboardDialog.title = m.top.displayText
|
keyboardDialog.title = m.top.displayText
|
||||||
keyboardDialog.message = [m.top.description]
|
keyboardDialog.message = [m.top.description]
|
||||||
keyboardDialog.text = m.top.value
|
keyboardDialog.text = m.top.value
|
||||||
|
|||||||
Reference in new issue
Block a user