mirror of
https://github.com/eeeXun/GTT.git
synced 2025-05-16 15:50:52 -07:00
style(ui): language dropdown should focus prior to translator dropdown
This commit is contained in:
parent
f9bf291d0c
commit
06fa80ef1b
2
main.go
2
main.go
@ -26,7 +26,7 @@ var (
|
|||||||
translatorDropDown = tview.NewDropDown()
|
translatorDropDown = tview.NewDropDown()
|
||||||
srcLangDropDown = tview.NewDropDown()
|
srcLangDropDown = tview.NewDropDown()
|
||||||
dstLangDropDown = tview.NewDropDown()
|
dstLangDropDown = tview.NewDropDown()
|
||||||
langCycle = ui.NewUICycle(translatorDropDown, srcLangDropDown, dstLangDropDown)
|
langCycle = ui.NewUICycle(srcLangDropDown, dstLangDropDown, translatorDropDown)
|
||||||
themeDropDown = tview.NewDropDown()
|
themeDropDown = tview.NewDropDown()
|
||||||
transparentDropDown = tview.NewDropDown()
|
transparentDropDown = tview.NewDropDown()
|
||||||
hideBelowDropDown = tview.NewDropDown()
|
hideBelowDropDown = tview.NewDropDown()
|
||||||
|
22
ui.go
22
ui.go
@ -173,6 +173,12 @@ func updateNonConfigColor() {
|
|||||||
SetTitleColor(style.HighLightColor())
|
SetTitleColor(style.HighLightColor())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAllColor() {
|
||||||
|
updateBackgroundColor()
|
||||||
|
updateBorderColor()
|
||||||
|
updateNonConfigColor()
|
||||||
|
}
|
||||||
|
|
||||||
// SetSelectedFunc of DropDown need to update when options change
|
// SetSelectedFunc of DropDown need to update when options change
|
||||||
func updateLangDropDown() {
|
func updateLangDropDown() {
|
||||||
srcLangDropDown.SetOptions(translator.GetAllLang(),
|
srcLangDropDown.SetOptions(translator.GetAllLang(),
|
||||||
@ -189,12 +195,6 @@ func updateLangDropDown() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateAllColor() {
|
|
||||||
updateBackgroundColor()
|
|
||||||
updateBorderColor()
|
|
||||||
updateNonConfigColor()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update language title and option
|
// Update language title and option
|
||||||
func updateCurrentLang() {
|
func updateCurrentLang() {
|
||||||
srcInput.SetTitle(translator.GetSrcLang())
|
srcInput.SetTitle(translator.GetSrcLang())
|
||||||
@ -295,13 +295,13 @@ func uiInit() {
|
|||||||
Item{item: attachItems(false, tview.FlexRow,
|
Item{item: attachItems(false, tview.FlexRow,
|
||||||
Item{item: attachItems(true, tview.FlexColumn,
|
Item{item: attachItems(true, tview.FlexColumn,
|
||||||
Item{item: attachItems(false, tview.FlexRow,
|
Item{item: attachItems(false, tview.FlexRow,
|
||||||
Item{item: translatorDropDown, fixedSize: 0, proportion: 1, focus: true}),
|
Item{item: translatorDropDown, fixedSize: 0, proportion: 1, focus: false}),
|
||||||
fixedSize: 0, proportion: 2, focus: true}),
|
fixedSize: 0, proportion: 2, focus: false}),
|
||||||
fixedSize: 1, proportion: 1, focus: true},
|
fixedSize: 1, proportion: 1, focus: false},
|
||||||
Item{item: attachItems(false, tview.FlexColumn,
|
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}),
|
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}),
|
fixedSize: 2 * langStrMaxLength, proportion: 1, focus: true}),
|
||||||
popOutWindowHeight, 1, true).
|
popOutWindowHeight, 1, true).
|
||||||
AddItem(attachButton(), 1, 1, false).
|
AddItem(attachButton(), 1, 1, false).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user