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

not write a select func

This commit is contained in:
eeeXun 2022-10-24 17:06:29 +08:00
parent f202de6d81
commit 9e8379d6a5

44
ui.go
View File

@ -253,13 +253,27 @@ func uiInit() {
styleWindow.SetInputCapture(styleWindowHandler)
translateWindow.SetInputCapture(translatePageHandler)
srcLangDropDown.SetDoneFunc(langDropDownHandler).
SetSelectedFunc(srcLangSelected)
SetSelectedFunc(func(text string, index int) {
translator.srcLang = text
srcBox.SetTitle(text)
srcLangDropDown.SetTitle(text)
})
dstLangDropDown.SetDoneFunc(langDropDownHandler).
SetSelectedFunc(dstLangSelected)
SetSelectedFunc(func(text string, index int) {
translator.dstLang = text
dstBox.SetTitle(text)
dstLangDropDown.SetTitle(text)
})
themeDropDown.SetDoneFunc(styleDropDownHandler).
SetSelectedFunc(themeSelected)
SetSelectedFunc(func(text string, index int) {
theme = text
updateAllColor()
})
transparentDropDown.SetDoneFunc(styleDropDownHandler).
SetSelectedFunc(transparentSelected)
SetSelectedFunc(func(text string, index int) {
transparent, _ = strconv.ParseBool(text)
updateBackgroundColor()
})
srcBorderDropDown.SetDoneFunc(styleDropDownHandler).
SetSelectedFunc(func(text string, index int) {
style.SetSrcBorderColor(text)
@ -401,18 +415,6 @@ func langDropDownHandler(key tcell.Key) {
}
}
func srcLangSelected(text string, index int) {
translator.srcLang = text
srcBox.SetTitle(text)
srcLangDropDown.SetTitle(text)
}
func dstLangSelected(text string, index int) {
translator.dstLang = text
dstBox.SetTitle(text)
dstLangDropDown.SetTitle(text)
}
func styleDropDownHandler(key tcell.Key) {
switch key {
case tcell.KeyTAB:
@ -422,13 +424,3 @@ func styleDropDownHandler(key tcell.Key) {
mainPage.HidePage("stylePage")
}
}
func themeSelected(text string, index int) {
theme = text
updateAllColor()
}
func transparentSelected(text string, index int) {
transparent, _ = strconv.ParseBool(text)
updateBackgroundColor()
}