Skip to content

Commit

Permalink
Merge pull request #40 from issadarkthing/fix-border-color
Browse files Browse the repository at this point in the history
fix border background color
  • Loading branch information
issadarkthing committed Mar 15, 2021
2 parents f36ed15 + bc4b9a7 commit d23f56b
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 30 deletions.
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/asmcos/requests v0.0.0-20210118082303-cb8f46dd3767
github.com/bogem/id3v2 v1.2.0
github.com/faiface/beep v1.0.2
github.com/gdamore/tcell/v2 v2.1.0
github.com/gdamore/tcell/v2 v2.2.0
github.com/gobwas/glob v0.2.3 // indirect
github.com/gocolly/colly v1.2.0
github.com/hajimehoshi/go-mp3 v0.3.1 // indirect
Expand All @@ -19,7 +19,7 @@ require (
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mattn/anko v0.1.8
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598
github.com/sahilm/fuzzy v0.1.0
github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca // indirect
github.com/stretchr/testify v1.7.0
Expand All @@ -29,5 +29,6 @@ require (
golang.org/x/exp v0.0.0-20201229011636-eab1b5eb1a03 // indirect
golang.org/x/image v0.0.0-20201208152932-35266b937fa6 // indirect
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c // indirect
google.golang.org/appengine v1.6.7 // indirect
)
12 changes: 12 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ github.com/gdamore/tcell v1.4.0/go.mod h1:vxEiSDZdW3L+Uhjii9c3375IlDmR05bzxY404Z
github.com/gdamore/tcell/v2 v2.0.1-0.20201017141208-acf90d56d591/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gdamore/tcell/v2 v2.1.0 h1:UnSmozHgBkQi2PGsFr+rpdXuAPRRucMegpQp3Z3kDro=
github.com/gdamore/tcell/v2 v2.1.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
github.com/gdamore/tcell/v2 v2.2.0 h1:vSyEgKwraXPSOkvCk7IwOSyX+Pv3V2cV9CikJMXg4U4=
github.com/gdamore/tcell/v2 v2.2.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y=
github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8=
Expand Down Expand Up @@ -61,6 +63,8 @@ github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/z
github.com/lucasb-eyer/go-colorful v0.0.0-20181028223441-12d3b2882a08/go.mod h1:NXg0ArsFk0Y01623LgUqoqcouGDB+PwCCQlrwrG6xJ4=
github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac=
github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
github.com/mattn/anko v0.1.8 h1:wDGM0Rwgbzhk1h8xE6qAR4n+PO/9clzf3tLGtrwsqJg=
github.com/mattn/anko v0.1.8/go.mod h1:C5D2zw4NIv/sB2SrQ3qs5wqPw0wKiA2GZqexy4ctNH0=
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
Expand All @@ -75,6 +79,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0 h1:WCfp+Jq9Mx156zIf9X6Frd6F19rf7wIRlm54UPxUfcU=
github.com/rivo/tview v0.0.0-20210125085121-dbc1f32bb1d0/go.mod h1:1QW7hX7RQzOqyGgx8O64bRPQBrFtPflioPPX5gFPV3A=
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598 h1:AbRrGXhagPRDItERv7nauBUUPi7Ma3IGIj9FqkQKW6k=
github.com/rivo/tview v0.0.0-20210312174852-ae9464cc3598/go.mod h1:VzCN9WX13RF88iH2CaGkmdHOlsy1ZZQcTmNwROqC+LI=
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
Expand Down Expand Up @@ -137,7 +143,13 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78 h1:nVuTkr9L6Bq62qpUqKo/RnZCFfzDBL0bYo6w9OJUqZY=
golang.org/x/sys v0.0.0-20210113181707-4bcb84eeeb78/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c h1:coiPEfMv+ThsjULRDygLrJVlNE1gDdL2g65s0LhV2os=
golang.org/x/sys v0.0.0-20210313202042-bd2e13477e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d h1:SZxvLBoTP5yHO3Frd4z4vrF+DBX9vMVanchswa69toE=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
Expand Down
3 changes: 3 additions & 0 deletions playingbar.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,11 @@ func (p *PlayingBar) help() []string {
func newPlayingBar() *PlayingBar {

textView := tview.NewTextView().SetTextAlign(tview.AlignCenter)
textView.SetBackgroundColor(gomu.colors.background)

frame := tview.NewFrame(textView).SetBorders(1, 1, 1, 1, 1, 1)
frame.SetBorder(true).SetTitle(" Now Playing ")
frame.SetBackgroundColor(gomu.colors.background)

p := &PlayingBar{
Frame: frame,
Expand Down
1 change: 1 addition & 0 deletions playlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func newPlaylist(args Args) *Playlist {
SetColor(gomu.colors.accent)

tree := tview.NewTreeView().SetRoot(root)
tree.SetBackgroundColor(gomu.colors.background)

playlist := &Playlist{
TreeView: tree,
Expand Down
9 changes: 7 additions & 2 deletions popup.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ func searchPopup(title string, stringsToMatch []string, handler func(selected st
list := tview.NewList().ShowSecondaryText(false)
list.SetSelectedBackgroundColor(gomu.colors.accent)
list.SetHighlightFullLine(true)
list.SetBackgroundColor(gomu.colors.popup)

for _, v := range stringsToMatch {
list.AddItem(v, v, 0, nil)
Expand Down Expand Up @@ -501,11 +502,13 @@ func searchPopup(title string, stringsToMatch []string, handler func(selected st
AddItem(input, 2, 1, true).
AddItem(list, 0, 1, false)

popup.SetBorder(true).
popupBox := tview.NewBox().SetBorder(true).
SetBackgroundColor(gomu.colors.popup).
SetBorderPadding(1, 1, 2, 2).
SetTitle(" " + title + " ")

popup.Box = popupBox

gomu.pages.AddPage("search-input-popup", center(popup, 70, 40), true, true)
gomu.popups.push(popup)
}
Expand Down Expand Up @@ -709,12 +712,14 @@ func replPopup() {
AddItem(input, 3, 1, true).
AddItem(textview, 0, 1, false)

flex.
flexBox := tview.NewBox().
SetBackgroundColor(gomu.colors.popup).
SetBorder(true).
SetBorderPadding(1, 1, 2, 2).
SetTitle(" REPL ")

flex.Box = flexBox

gomu.pages.AddPage(popupId, center(flex, 90, 30), true, true)
gomu.popups.push(flex)
}
Expand Down
2 changes: 2 additions & 0 deletions queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ func newQueue() *Queue {
list := tview.NewList().
ShowSecondaryText(false)

list.SetBackgroundColor(gomu.colors.background)

queue := &Queue{
List: list,
savedQueuePath: cacheQueuePath,
Expand Down
2 changes: 1 addition & 1 deletion start.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ func start(application *tview.Application, args Args) {
tview.Borders.TopRightFocus = tview.Borders.TopRight
tview.Borders.BottomLeftFocus = tview.Borders.BottomLeft
tview.Borders.BottomRightFocus = tview.Borders.BottomRight
tview.Styles.PrimitiveBackgroundColor = gomu.colors.background
tview.Styles.PrimitiveBackgroundColor = gomu.colors.popup

gomu.initPanels(application, args)

Expand Down
58 changes: 33 additions & 25 deletions tageditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,22 @@ func tagPopup(node *AudioFile) (err error) {
leftGrid *tview.Grid = tview.NewGrid()
rightFlex *tview.Flex = tview.NewFlex()
)

artistInputField.SetLabel("Artist: ").
SetFieldWidth(20).
SetText(tag.Artist()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)

titleInputField.SetLabel("Title: ").
SetFieldWidth(20).
SetText(tag.Title()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)

albumInputField.SetLabel("Album: ").
SetFieldWidth(20).
SetText(tag.Album()).
SetFieldBackgroundColor(gomu.colors.popup).
SetBackgroundColor(gomu.colors.background)
SetFieldBackgroundColor(gomu.colors.popup)

getTagButton.SetSelectedFunc(func() {
var titles []string
audioFile := node
Expand Down Expand Up @@ -105,9 +106,13 @@ func tagPopup(node *AudioFile) (err error) {
}
})
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.accent)


saveTagButton.SetSelectedFunc(func() {
tag, err = id3v2.Open(node.path, id3v2.Options{Parse: true})
if err != nil {
Expand All @@ -124,13 +129,15 @@ func tagPopup(node *AudioFile) (err error) {
defaultTimedPopup(" Success ", "Tag update successfully")
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.foreground)

lyricDropDown.SetOptions(options, nil).
SetCurrentOption(0).
SetFieldBackgroundColor(gomu.colors.background).
SetFieldBackgroundColor(gomu.colors.popup).
SetFieldTextColor(gomu.colors.accent).
SetPrefixTextColor(gomu.colors.accent).
SetSelectedFunc(func(text string, _ int) {
Expand Down Expand Up @@ -182,17 +189,21 @@ func tagPopup(node *AudioFile) (err error) {
infoPopup("No lyric embeded.")
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetBackgroundColor(gomu.colors.popup).
SetTitleColor(gomu.colors.accent)

getLyricDropDownOptions := []string{"en", "zh-CN"}
getLyricDropDown.SetOptions(getLyricDropDownOptions, nil).
SetCurrentOption(0).
SetFieldBackgroundColor(gomu.colors.background).
SetFieldBackgroundColor(gomu.colors.popup).
SetFieldTextColor(gomu.colors.accent).
SetPrefixTextColor(gomu.colors.accent).
SetLabel("Fetch Lyrics: ")
SetLabel("Fetch Lyrics: ").
SetBackgroundColor(gomu.colors.popup)

lyricDropDown.SetBackgroundColor(gomu.colors.popup)

getLyricButton.SetSelectedFunc(func() {
Expand Down Expand Up @@ -279,9 +290,11 @@ func tagPopup(node *AudioFile) (err error) {
gomu.app.Draw()
}
}).
SetBackgroundColorActivated(gomu.colors.popup).
SetLabelColorActivated(gomu.colors.accent).
SetBorder(true).
SetBackgroundColor(gomu.colors.background).
SetTitleColor(gomu.colors.accent)
SetTitleColor(gomu.colors.accent).
SetBackgroundColor(gomu.colors.popup)

var lyricText string
_, langExt := lyricDropDown.GetCurrentOption()
Expand All @@ -302,7 +315,6 @@ func tagPopup(node *AudioFile) (err error) {
SetScrollable(true).
SetWordWrap(true).
SetWrap(true).
SetBackgroundColor(gomu.colors.popup).
SetBorder(true)

leftGrid.SetRows(3, 3, 3, 3, 3, 0, 3, 3, 3, 3, 3).
Expand All @@ -316,10 +328,13 @@ func tagPopup(node *AudioFile) (err error) {
AddItem(deleteLyricButton, 7, 0, 1, 3, 1, 10, true).
AddItem(getLyricDropDown, 9, 0, 1, 3, 1, 20, true).
AddItem(getLyricButton, 10, 0, 1, 3, 1, 10, true)
leftGrid.SetBorder(true).

box := tview.NewBox().SetBorder(true).
SetTitle(node.name).
SetBorderPadding(1, 1, 2, 2)

leftGrid.Box = box

rightFlex.SetDirection(tview.FlexColumn).
AddItem(lyricTextView, 0, 1, true)

Expand All @@ -332,8 +347,7 @@ func tagPopup(node *AudioFile) (err error) {

lyricFlex.
SetTitle(node.name).
SetBorderPadding(1, 1, 1, 1).
SetBackgroundColor(gomu.colors.popup)
SetBorderPadding(1, 1, 1, 1)

inputs := []tview.Primitive{
artistInputField,
Expand All @@ -348,8 +362,7 @@ func tagPopup(node *AudioFile) (err error) {
lyricTextView,
}

gomu.pages.
AddPage(popupID, center(lyricFlex, 90, 40), true, true)
gomu.pages.AddPage(popupID, center(lyricFlex, 90, 40), true, true)
gomu.popups.push(lyricFlex)

lyricFlex.SetInputCapture(func(e *tcell.EventKey) *tcell.EventKey {
Expand All @@ -369,11 +382,6 @@ func tagPopup(node *AudioFile) (err error) {
lyricFlex.cycleFocus(gomu.app, inputs, true)
}

switch e.Rune() {
case '1':
case '2':
case '3':
}
return e
})

Expand Down

0 comments on commit d23f56b

Please sign in to comment.