Break transfer loops after refreshing progress bar
This commit is contained in:
parent
5bc63b7864
commit
9b2507de4c
@ -95,14 +95,14 @@ var upgradeCmd = &cobra.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal().Err(err).Msg("Error decoding response data")
|
log.Fatal().Err(err).Msg("Error decoding response data")
|
||||||
}
|
}
|
||||||
// If transfer finished, break
|
|
||||||
if event.Received == event.Total {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// Set total bytes in progress bar
|
// Set total bytes in progress bar
|
||||||
bar.SetTotal(event.Total)
|
bar.SetTotal(event.Total)
|
||||||
// Set amount of bytes received in progress bar
|
// Set amount of bytes received in progress bar
|
||||||
bar.SetCurrent(event.Received)
|
bar.SetCurrent(event.Received)
|
||||||
|
// If transfer finished, break
|
||||||
|
if event.Received == event.Total {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Finish progress bar
|
// Finish progress bar
|
||||||
bar.Finish()
|
bar.Finish()
|
||||||
|
@ -164,10 +164,6 @@ func upgradeTab(parent fyne.Window) *fyne.Container {
|
|||||||
guiErr(err, "Error decoding response value", false, parent)
|
guiErr(err, "Error decoding response value", false, parent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// If transfer finished, break
|
|
||||||
if event.Received == event.Total {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// Set label text to received / total B
|
// Set label text to received / total B
|
||||||
progressLbl.SetText(fmt.Sprintf("%d / %d B", event.Received, event.Total))
|
progressLbl.SetText(fmt.Sprintf("%d / %d B", event.Received, event.Total))
|
||||||
// Set progress bar values
|
// Set progress bar values
|
||||||
@ -175,6 +171,10 @@ func upgradeTab(parent fyne.Window) *fyne.Container {
|
|||||||
progressBar.Value = float64(event.Received)
|
progressBar.Value = float64(event.Received)
|
||||||
// Refresh progress bar
|
// Refresh progress bar
|
||||||
progressBar.Refresh()
|
progressBar.Refresh()
|
||||||
|
// If transfer finished, break
|
||||||
|
if event.Received == event.Total {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user