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

rename defOutput posOutput

This commit is contained in:
eeeXun 2023-01-11 02:07:50 +08:00
parent 22f916f1f9
commit efff94b2ec
2 changed files with 15 additions and 15 deletions

View File

@ -16,8 +16,8 @@ var (
app = tview.NewApplication() app = tview.NewApplication()
srcInput = tview.NewTextArea() srcInput = tview.NewTextArea()
dstOutput = tview.NewTextView() dstOutput = tview.NewTextView()
definitionOutput = tview.NewTextArea() defOutput = tview.NewTextArea()
partOutput = tview.NewTextArea() posOutput = tview.NewTextArea()
srcLangDropDown = tview.NewDropDown() srcLangDropDown = tview.NewDropDown()
dstLangDropDown = tview.NewDropDown() dstLangDropDown = tview.NewDropDown()
langCycle = ui.NewUICycle(srcLangDropDown, dstLangDropDown) langCycle = ui.NewUICycle(srcLangDropDown, dstLangDropDown)

26
ui.go
View File

@ -48,12 +48,12 @@ func updateBackgroundColor() {
Background(style.BackgroundColor()). Background(style.BackgroundColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
dstOutput.SetBackgroundColor(style.BackgroundColor()) dstOutput.SetBackgroundColor(style.BackgroundColor())
definitionOutput.SetBackgroundColor(style.BackgroundColor()) defOutput.SetBackgroundColor(style.BackgroundColor())
definitionOutput.SetTextStyle(tcell.StyleDefault. defOutput.SetTextStyle(tcell.StyleDefault.
Background(style.BackgroundColor()). Background(style.BackgroundColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
partOutput.SetBackgroundColor(style.BackgroundColor()) posOutput.SetBackgroundColor(style.BackgroundColor())
partOutput.SetTextStyle(tcell.StyleDefault. posOutput.SetTextStyle(tcell.StyleDefault.
Background(style.BackgroundColor()). Background(style.BackgroundColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
@ -111,9 +111,9 @@ func updateBorderColor() {
SetTitleColor(style.SrcBorderColor()) SetTitleColor(style.SrcBorderColor())
dstOutput.SetBorderColor(style.DstBorderColor()). dstOutput.SetBorderColor(style.DstBorderColor()).
SetTitleColor(style.DstBorderColor()) SetTitleColor(style.DstBorderColor())
definitionOutput.SetBorderColor(style.SrcBorderColor()). defOutput.SetBorderColor(style.SrcBorderColor()).
SetTitleColor(style.SrcBorderColor()) SetTitleColor(style.SrcBorderColor())
partOutput.SetBorderColor(style.DstBorderColor()). posOutput.SetBorderColor(style.DstBorderColor()).
SetTitleColor(style.DstBorderColor()) SetTitleColor(style.DstBorderColor())
// dropdown // dropdown
@ -133,10 +133,10 @@ func updateNonConfigColor() {
Background(style.SelectedColor()). Background(style.SelectedColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
dstOutput.SetTextColor(style.ForegroundColor()) dstOutput.SetTextColor(style.ForegroundColor())
definitionOutput.SetSelectedStyle(tcell.StyleDefault. defOutput.SetSelectedStyle(tcell.StyleDefault.
Background(style.SelectedColor()). Background(style.SelectedColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
partOutput.SetSelectedStyle(tcell.StyleDefault. posOutput.SetSelectedStyle(tcell.StyleDefault.
Background(style.SelectedColor()). Background(style.SelectedColor()).
Foreground(style.ForegroundColor())) Foreground(style.ForegroundColor()))
@ -218,9 +218,9 @@ func uiInit() {
// input/output // input/output
srcInput.SetBorder(true) srcInput.SetBorder(true)
dstOutput.SetBorder(true) dstOutput.SetBorder(true)
definitionOutput.SetBorder(true). defOutput.SetBorder(true).
SetTitle("Definition") SetTitle("Definition")
partOutput.SetBorder(true). posOutput.SetBorder(true).
SetTitle("Part of speech") SetTitle("Part of speech")
// dropdown // dropdown
@ -256,11 +256,11 @@ func uiInit() {
translateWindow.SetDirection(tview.FlexColumn). translateWindow.SetDirection(tview.FlexColumn).
AddItem(tview.NewFlex().SetDirection(tview.FlexRow). AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(srcInput, 0, 1, true). AddItem(srcInput, 0, 1, true).
AddItem(definitionOutput, 0, 1, false), AddItem(defOutput, 0, 1, false),
0, 1, true). 0, 1, true).
AddItem(tview.NewFlex().SetDirection(tview.FlexRow). AddItem(tview.NewFlex().SetDirection(tview.FlexRow).
AddItem(dstOutput, 0, 1, false). AddItem(dstOutput, 0, 1, false).
AddItem(partOutput, 0, 1, false), AddItem(posOutput, 0, 1, false),
0, 1, false) 0, 1, false)
langWindow.SetDirection(tview.FlexRow). langWindow.SetDirection(tview.FlexRow).
AddItem(nil, 0, 1, false). AddItem(nil, 0, 1, false).
@ -402,7 +402,7 @@ func translatePageHandler(event *tcell.EventKey) *tcell.EventKey {
dstOutput.SetText(err.Error()) dstOutput.SetText(err.Error())
} else { } else {
dstOutput.SetText(translation) dstOutput.SetText(translation)
partOutput.SetText(partOfSpeech, false) posOutput.SetText(partOfSpeech, false)
} }
} }
case tcell.KeyCtrlQ: case tcell.KeyCtrlQ: