v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-27 21:11:11 -07:00

focus theme in stylePage

This commit is contained in:
eeeXun 2022-10-23 22:04:09 +08:00
parent 4d80c1f06a
commit 297d523925

28
ui.go
View File

@ -154,17 +154,17 @@ func uiInit() {
AddItem(srcLangDropDown, 32, 1, true).
AddItem(dstLangDropDown, 32, 1, false).
AddItem(nil, 0, 1, false), 20, 1, true).
AddItem(attachButton(), 1, 1, true).
AddItem(attachButton(), 1, 1, false).
AddItem(nil, 0, 1, false)
styleWindow.SetDirection(tview.FlexRow).
AddItem(nil, 0, 1, false).
AddItem(tview.NewFlex().SetDirection(tview.FlexColumn).
AddItem(nil, 0, 1, false).
AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(themeDropDown, 1, 1, false).
AddItem(transparentDropDown, 1, 1, false), 20, 1, false).
AddItem(themeDropDown, 1, 1, true).
AddItem(transparentDropDown, 1, 1, false), 20, 1, true).
AddItem(nil, 0, 1, false), 20, 1, true).
AddItem(attachButton(), 1, 1, true).
AddItem(attachButton(), 1, 1, false).
AddItem(nil, 0, 1, false)
updateAllColor()
@ -177,6 +177,8 @@ func uiInit() {
SetSelectedFunc(srcLangSelected)
dstLangDropDown.SetDoneFunc(dstDropDownHandler).
SetSelectedFunc(dstLangSelected)
themeDropDown.SetSelectedFunc(themeSelected)
transparentDropDown.SetSelectedFunc(transparentSelected)
langButton.SetSelectedFunc(func() {
mainPage.HidePage("stylePage")
mainPage.ShowPage("langPage")
@ -285,6 +287,24 @@ func dstLangSelected(text string, index int) {
dstLangDropDown.SetTitle(text)
}
func themeSelected(text string, index int) {
theme = text
window.colorInit()
updateAllColor()
}
func transparentSelected(text string, index int) {
transparent, _ = strconv.ParseBool(text)
if transparent {
window.src.backgroundColor = Transparent
window.dst.backgroundColor = Transparent
} else {
window.src.backgroundColor = Themes[theme]["bg"]
window.dst.backgroundColor = Themes[theme]["bg"]
}
updateBackgroundColor()
}
func srcDropDownHandler(key tcell.Key) {
switch key {
case tcell.KeyTAB: