mirror of
https://github.com/issadarkthing/gomu.git
synced 2025-04-30 13:48:50 +08:00
minor refactor tageditor.go
This commit is contained in:
parent
ff531589e5
commit
887026a58d
29
tageditor.go
29
tageditor.go
@ -22,10 +22,9 @@ type lyricFlex struct {
|
|||||||
*tview.Flex
|
*tview.Flex
|
||||||
FocusedItem tview.Primitive
|
FocusedItem tview.Primitive
|
||||||
inputs []tview.Primitive
|
inputs []tview.Primitive
|
||||||
|
box *tview.Box
|
||||||
}
|
}
|
||||||
|
|
||||||
var box *tview.Box = tview.NewBox()
|
|
||||||
|
|
||||||
// tagPopup is used to edit tag, delete and fetch lyrics
|
// tagPopup is used to edit tag, delete and fetch lyrics
|
||||||
func tagPopup(node *AudioFile) (err error) {
|
func tagPopup(node *AudioFile) (err error) {
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ func tagPopup(node *AudioFile) (err error) {
|
|||||||
deleteLyricButton *tview.Button = tview.NewButton("Delete Lyric")
|
deleteLyricButton *tview.Button = tview.NewButton("Delete Lyric")
|
||||||
getLyricDropDown *tview.DropDown = tview.NewDropDown()
|
getLyricDropDown *tview.DropDown = tview.NewDropDown()
|
||||||
getLyricButton *tview.Button = tview.NewButton("Fetch Lyric")
|
getLyricButton *tview.Button = tview.NewButton("Fetch Lyric")
|
||||||
lyricTextView *tview.TextView
|
lyricTextView *tview.TextView = tview.NewTextView()
|
||||||
leftGrid *tview.Grid = tview.NewGrid()
|
leftGrid *tview.Grid = tview.NewGrid()
|
||||||
rightFlex *tview.Flex = tview.NewFlex()
|
rightFlex *tview.Flex = tview.NewFlex()
|
||||||
)
|
)
|
||||||
@ -292,7 +291,7 @@ func tagPopup(node *AudioFile) (err error) {
|
|||||||
lyricText = "No lyric embeded."
|
lyricText = "No lyric embeded."
|
||||||
langExt = ""
|
langExt = ""
|
||||||
}
|
}
|
||||||
lyricTextView = tview.NewTextView()
|
|
||||||
lyricTextView.
|
lyricTextView.
|
||||||
SetDynamicColors(true).
|
SetDynamicColors(true).
|
||||||
SetRegions(true).
|
SetRegions(true).
|
||||||
@ -323,15 +322,6 @@ func tagPopup(node *AudioFile) (err error) {
|
|||||||
AddItem(lyricDropDown, 10, 0, 1, 3, 1, 10, true).
|
AddItem(lyricDropDown, 10, 0, 1, 3, 1, 10, true).
|
||||||
AddItem(deleteLyricButton, 11, 0, 1, 3, 1, 10, true)
|
AddItem(deleteLyricButton, 11, 0, 1, 3, 1, 10, true)
|
||||||
|
|
||||||
box.SetBorder(true).
|
|
||||||
SetTitle(node.name).
|
|
||||||
SetBackgroundColor(gomu.colors.popup).
|
|
||||||
SetBorderColor(gomu.colors.accent).
|
|
||||||
SetTitleColor(gomu.colors.accent).
|
|
||||||
SetBorderPadding(1, 1, 2, 2)
|
|
||||||
|
|
||||||
leftGrid.Box = box
|
|
||||||
|
|
||||||
rightFlex.SetDirection(tview.FlexColumn).
|
rightFlex.SetDirection(tview.FlexColumn).
|
||||||
AddItem(lyricTextView, 0, 1, true)
|
AddItem(lyricTextView, 0, 1, true)
|
||||||
|
|
||||||
@ -341,8 +331,17 @@ func tagPopup(node *AudioFile) (err error) {
|
|||||||
AddItem(rightFlex, 0, 3, true),
|
AddItem(rightFlex, 0, 3, true),
|
||||||
nil,
|
nil,
|
||||||
nil,
|
nil,
|
||||||
|
tview.NewBox().
|
||||||
|
SetBorder(true).
|
||||||
|
SetTitle(node.name).
|
||||||
|
SetBackgroundColor(gomu.colors.popup).
|
||||||
|
SetBorderColor(gomu.colors.accent).
|
||||||
|
SetTitleColor(gomu.colors.accent).
|
||||||
|
SetBorderPadding(1, 1, 2, 2),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
leftGrid.Box = lyricFlex.box
|
||||||
|
|
||||||
lyricFlex.inputs = []tview.Primitive{
|
lyricFlex.inputs = []tview.Primitive{
|
||||||
getTagButton,
|
getTagButton,
|
||||||
artistInputField,
|
artistInputField,
|
||||||
@ -413,12 +412,12 @@ func (f *lyricFlex) cycleFocus(app *tview.Application, reverse bool) {
|
|||||||
if f.inputs[9].HasFocus() {
|
if f.inputs[9].HasFocus() {
|
||||||
f.inputs[9].(*tview.TextView).SetBorderColor(gomu.colors.accent).
|
f.inputs[9].(*tview.TextView).SetBorderColor(gomu.colors.accent).
|
||||||
SetTitleColor(gomu.colors.accent)
|
SetTitleColor(gomu.colors.accent)
|
||||||
box.SetBorderColor(gomu.colors.background).
|
f.box.SetBorderColor(gomu.colors.background).
|
||||||
SetTitleColor(gomu.colors.background)
|
SetTitleColor(gomu.colors.background)
|
||||||
} else {
|
} else {
|
||||||
f.inputs[9].(*tview.TextView).SetBorderColor(gomu.colors.background).
|
f.inputs[9].(*tview.TextView).SetBorderColor(gomu.colors.background).
|
||||||
SetTitleColor(gomu.colors.background)
|
SetTitleColor(gomu.colors.background)
|
||||||
box.SetBorderColor(gomu.colors.accent).
|
f.box.SetBorderColor(gomu.colors.accent).
|
||||||
SetTitleColor(gomu.colors.accent)
|
SetTitleColor(gomu.colors.accent)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user