avoid unnecessary status line refreshes
This commit is contained in:
@@ -125,6 +125,7 @@ func (a *NowPlayingPage) OnPlayTimeUpdate(_, _ float64) {
|
|||||||
func (a *NowPlayingPage) formatStatusLine() {
|
func (a *NowPlayingPage) formatStatusLine() {
|
||||||
playerStats := a.p.GetStatus()
|
playerStats := a.p.GetStatus()
|
||||||
ts := a.statusLabel.Segments[0].(*widget.TextSegment)
|
ts := a.statusLabel.Segments[0].(*widget.TextSegment)
|
||||||
|
lastStatus := ts.Text
|
||||||
state := "Stopped"
|
state := "Stopped"
|
||||||
switch playerStats.State {
|
switch playerStats.State {
|
||||||
case player.Paused:
|
case player.Paused:
|
||||||
@@ -169,7 +170,9 @@ func (a *NowPlayingPage) formatStatusLine() {
|
|||||||
audioInfo.Bitrate/1000,
|
audioInfo.Bitrate/1000,
|
||||||
util.SecondsToTimeString(a.totalTime))
|
util.SecondsToTimeString(a.totalTime))
|
||||||
}
|
}
|
||||||
a.statusLabel.Refresh()
|
if lastStatus != ts.Text {
|
||||||
|
a.statusLabel.Refresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *NowPlayingPage) Reload() {
|
func (a *NowPlayingPage) Reload() {
|
||||||
|
|||||||
Reference in New Issue
Block a user