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

camel case

This commit is contained in:
eeeXun 2022-10-21 23:27:10 +08:00
parent 099891c757
commit 54c044f1ff
2 changed files with 6 additions and 6 deletions

View File

@ -28,7 +28,7 @@ func main() {
// result, _ := translator.Translate("Hello world\nApple\nbumper") // result, _ := translator.Translate("Hello world\nApple\nbumper")
// fmt.Println(result) // fmt.Println(result)
window.colorInit() window.colorInit()
ui_init() uiInit()
translate_page.SetDirection(tview.FlexColumn). translate_page.SetDirection(tview.FlexColumn).
AddItem(src_box, 0, 1, true). AddItem(src_box, 0, 1, true).
AddItem(dst_box, 0, 1, false) AddItem(dst_box, 0, 1, false)

10
ui.go
View File

@ -4,7 +4,7 @@ import (
"github.com/gdamore/tcell/v2" "github.com/gdamore/tcell/v2"
) )
func update_background() { func updateBackground() {
// box // box
src_box.SetBackgroundColor(window.src.background_color) src_box.SetBackgroundColor(window.src.background_color)
src_box.SetTextStyle(tcell.StyleDefault. src_box.SetTextStyle(tcell.StyleDefault.
@ -31,8 +31,8 @@ func update_background() {
Foreground(window.src.prefix_color)) Foreground(window.src.prefix_color))
} }
func ui_init() { func uiInit() {
update_background() updateBackground()
// box // box
src_box.SetBorder(true). src_box.SetBorder(true).
@ -91,7 +91,7 @@ func PagesHandler(event *tcell.EventKey) *tcell.EventKey {
window.src.background_color = Transparent window.src.background_color = Transparent
window.dst.background_color = Transparent window.dst.background_color = Transparent
} }
update_background() updateBackground()
transparent = !transparent transparent = !transparent
} }
@ -118,7 +118,7 @@ func TranslatePageHandler(event *tcell.EventKey) *tcell.EventKey {
case tcell.KeyCtrlP: case tcell.KeyCtrlP:
translator.PlaySound(translator.dst_lang, dst_box.GetText(false)) translator.PlaySound(translator.dst_lang, dst_box.GetText(false))
case tcell.KeyCtrlS: case tcell.KeyCtrlS:
dst_box.SetText("SSS") translator.src_lang, translator.dst_lang = translator.dst_lang, translator.src_lang
} }
return event return event