Using QueueUpdateDraw() instead of Draw()
The Draw() function still seems to slow down the App Hence Using QueueUpdateDraw() this makes it a little faster The Problem now is that the ProgressBar constantly makes request to mpd which in turn causes the slow down.
This commit is contained in:
parent
79841c1b91
commit
06da246c3a
3
main.go
3
main.go
|
@ -338,8 +338,9 @@ func main() {
|
|||
})
|
||||
|
||||
go func() {
|
||||
drawFunc := func() { ui.ProgressFunction() }
|
||||
for {
|
||||
ui.Ui.App.Draw()
|
||||
ui.Ui.App.QueueUpdateDraw(drawFunc)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
|
|
|
@ -25,7 +25,7 @@ type Application struct {
|
|||
func NewApplication() *Application {
|
||||
|
||||
pBar := NewProgressBar()
|
||||
pBar.SetProgressFunc(progressFunction)
|
||||
pBar.SetProgressFunc(ProgressFunction)
|
||||
expandedView := tview.NewTable()
|
||||
Navbar := tview.NewTable()
|
||||
searchBar := tview.NewInputField()
|
||||
|
|
|
@ -82,7 +82,7 @@ func (self *ProgressBar) Draw(screen tcell.Screen) {
|
|||
x, y+2, _width-OFFSET, tview.AlignRight, tcell.ColorWhite)
|
||||
}
|
||||
|
||||
func progressFunction() (string, string, string, float64) {
|
||||
func ProgressFunction() (string, string, string, float64) {
|
||||
_currentAttributes, err := CONN.CurrentSong()
|
||||
var song, top, text string
|
||||
var percentage float64
|
||||
|
|
Loading…
Reference in New Issue