v/GTT
1
0
mirror of https://github.com/eeeXun/GTT.git synced 2025-05-19 09:10:42 -07:00

add stylepage

This commit is contained in:
eeeXun 2022-10-23 16:13:13 +08:00
parent b4466dba03
commit b77ccc2e78
2 changed files with 9 additions and 11 deletions

View File

@ -38,6 +38,7 @@ func main() {
mainPage.AddPage("translatePage", translateWindow, true, true) mainPage.AddPage("translatePage", translateWindow, true, true)
mainPage.AddPage("langPage", langWindow, true, false) mainPage.AddPage("langPage", langWindow, true, false)
mainPage.AddPage("stylePage", styleWindow, true, true)
if err := app.SetRoot(mainPage, true). if err := app.SetRoot(mainPage, true).
EnableMouse(true).Run(); err != nil { EnableMouse(true).Run(); err != nil {

19
ui.go
View File

@ -11,7 +11,6 @@ func updateBackground() {
srcBox.SetTextStyle(tcell.StyleDefault. srcBox.SetTextStyle(tcell.StyleDefault.
Background(window.src.backgroundColor). Background(window.src.backgroundColor).
Foreground(window.src.foregroundColor)) Foreground(window.src.foregroundColor))
dstBox.SetBackgroundColor(window.dst.backgroundColor) dstBox.SetBackgroundColor(window.dst.backgroundColor)
// dropdown // dropdown
@ -22,7 +21,6 @@ func updateBackground() {
tcell.StyleDefault. tcell.StyleDefault.
Background(window.src.selectedColor). Background(window.src.selectedColor).
Foreground(window.src.prefixColor)) Foreground(window.src.prefixColor))
dstLangDropDown.SetBackgroundColor(window.dst.backgroundColor) dstLangDropDown.SetBackgroundColor(window.dst.backgroundColor)
dstLangDropDown.SetListStyles(tcell.StyleDefault. dstLangDropDown.SetListStyles(tcell.StyleDefault.
Background(window.src.backgroundColor). Background(window.src.backgroundColor).
@ -61,7 +59,6 @@ func uiInit() {
srcBox.SetSelectedStyle(tcell.StyleDefault. srcBox.SetSelectedStyle(tcell.StyleDefault.
Background(window.src.selectedColor). Background(window.src.selectedColor).
Foreground(window.src.foregroundColor)) Foreground(window.src.foregroundColor))
dstBox.SetBorder(true). dstBox.SetBorder(true).
SetBorderColor(window.dst.borderColor). SetBorderColor(window.dst.borderColor).
SetTitleColor(window.dst.borderColor) SetTitleColor(window.dst.borderColor)
@ -75,7 +72,6 @@ func uiInit() {
srcLangDropDown.SetBorder(true). srcLangDropDown.SetBorder(true).
SetBorderColor(window.src.borderColor). SetBorderColor(window.src.borderColor).
SetTitleColor(window.src.borderColor) SetTitleColor(window.src.borderColor)
dstLangDropDown.SetOptions(Lang, nil) dstLangDropDown.SetOptions(Lang, nil)
dstLangDropDown.SetFieldBackgroundColor(window.src.selectedColor). dstLangDropDown.SetFieldBackgroundColor(window.src.selectedColor).
SetFieldTextColor(window.src.foregroundColor). SetFieldTextColor(window.src.foregroundColor).
@ -83,6 +79,8 @@ func uiInit() {
dstLangDropDown.SetBorder(true). dstLangDropDown.SetBorder(true).
SetBorderColor(window.dst.borderColor). SetBorderColor(window.dst.borderColor).
SetTitleColor(window.dst.borderColor) SetTitleColor(window.dst.borderColor)
themeDropDown.SetOptions(themes_name, nil).SetLabel("Theme: ")
transparentDropDown.SetOptions([]string{"true", "false"}, nil).SetLabel("Transparent: ")
// button // button
langButton.SetLabelColor(window.src.foregroundColor). langButton.SetLabelColor(window.src.foregroundColor).
@ -116,13 +114,12 @@ func uiInit() {
AddItem(nil, 0, 1, false) AddItem(nil, 0, 1, false)
styleWindow.SetDirection(tview.FlexRow). styleWindow.SetDirection(tview.FlexRow).
AddItem(nil, 0, 1, false). AddItem(nil, 0, 1, false).
// AddItem(tview.NewFlex().SetDirection(tview.FlexRow). AddItem(tview.NewFlex().SetDirection(tview.FlexColumn).
// AddItem()) AddItem(nil, 0, 1, false).
// AddItem(tview.NewFlex().SetDirection(tview.FlexColumn). AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
// AddItem(nil, 0, 1, false). AddItem(themeDropDown, 1, 1, false).
// AddItem(srcDropDown, 32, 1, true). AddItem(transparentDropDown, 1, 1, false), 20, 1, false).
// AddItem(dstDropDown, 32, 1, false). AddItem(nil, 0, 1, false), 20, 1, true).
// AddItem(nil, 0, 1, false), 20, 1, true).
AddItem(attachButton(), 1, 1, true). AddItem(attachButton(), 1, 1, true).
AddItem(nil, 0, 1, false) AddItem(nil, 0, 1, false)