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

style(ui): language dropdown should focus prior to translator dropdown

This commit is contained in:
eeeXun 2023-02-08 18:02:42 +08:00
parent f9bf291d0c
commit 06fa80ef1b
2 changed files with 12 additions and 12 deletions

View File

@ -26,7 +26,7 @@ var (
translatorDropDown = tview.NewDropDown()
srcLangDropDown = tview.NewDropDown()
dstLangDropDown = tview.NewDropDown()
langCycle = ui.NewUICycle(translatorDropDown, srcLangDropDown, dstLangDropDown)
langCycle = ui.NewUICycle(srcLangDropDown, dstLangDropDown, translatorDropDown)
themeDropDown = tview.NewDropDown()
transparentDropDown = tview.NewDropDown()
hideBelowDropDown = tview.NewDropDown()

22
ui.go
View File

@ -173,6 +173,12 @@ func updateNonConfigColor() {
SetTitleColor(style.HighLightColor())
}
func updateAllColor() {
updateBackgroundColor()
updateBorderColor()
updateNonConfigColor()
}
// SetSelectedFunc of DropDown need to update when options change
func updateLangDropDown() {
srcLangDropDown.SetOptions(translator.GetAllLang(),
@ -189,12 +195,6 @@ func updateLangDropDown() {
})
}
func updateAllColor() {
updateBackgroundColor()
updateBorderColor()
updateNonConfigColor()
}
// Update language title and option
func updateCurrentLang() {
srcInput.SetTitle(translator.GetSrcLang())
@ -295,13 +295,13 @@ func uiInit() {
Item{item: attachItems(false, tview.FlexRow,
Item{item: attachItems(true, tview.FlexColumn,
Item{item: attachItems(false, tview.FlexRow,
Item{item: translatorDropDown, fixedSize: 0, proportion: 1, focus: true}),
fixedSize: 0, proportion: 2, focus: true}),
fixedSize: 1, proportion: 1, focus: true},
Item{item: translatorDropDown, fixedSize: 0, proportion: 1, focus: false}),
fixedSize: 0, proportion: 2, focus: false}),
fixedSize: 1, proportion: 1, focus: false},
Item{item: attachItems(false, tview.FlexColumn,
Item{item: srcLangDropDown, fixedSize: 0, proportion: 1, focus: false},
Item{item: srcLangDropDown, fixedSize: 0, proportion: 1, focus: true},
Item{item: dstLangDropDown, fixedSize: 0, proportion: 1, focus: false}),
fixedSize: 0, proportion: 1, focus: false}),
fixedSize: 0, proportion: 1, focus: true}),
fixedSize: 2 * langStrMaxLength, proportion: 1, focus: true}),
popOutWindowHeight, 1, true).
AddItem(attachButton(), 1, 1, false).