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