mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-15 17:38:52 +01:00
download_process bug
This commit is contained in:
parent
ef691a92e7
commit
8b18259b4c
@ -24,6 +24,7 @@ type DownloadProcessPage struct {
|
||||
DST_DIR string
|
||||
Value int
|
||||
PngSize map[string][2]int
|
||||
Doing bool
|
||||
|
||||
FileNameLabel LabelInterface
|
||||
SizeLabel LabelInterface
|
||||
@ -121,6 +122,7 @@ Loop:
|
||||
self.resp.BytesComplete(),
|
||||
self.resp.Size,
|
||||
100*self.resp.Progress())
|
||||
|
||||
self.Value = int(100.0*self.resp.Progress())
|
||||
total := float64(self.resp.Size)/1000.0/1000.0
|
||||
downloaded := float64(self.resp.BytesComplete())/1000.0/1000.0
|
||||
@ -129,8 +131,6 @@ Loop:
|
||||
self.SizeLabel.SetText(lb_str)
|
||||
|
||||
self.FileNameLabel.SetText(filepath.Base(self.resp.Filename))
|
||||
|
||||
|
||||
self.Screen.Draw()
|
||||
self.Screen.SwapAndShow()
|
||||
|
||||
@ -139,11 +139,13 @@ Loop:
|
||||
fmt.Println("download is complete ",self.Value)
|
||||
self.Value = 0
|
||||
self.TheTicker.Stop()
|
||||
|
||||
self.Doing=false
|
||||
break Loop
|
||||
}
|
||||
}
|
||||
|
||||
self.Doing=false
|
||||
|
||||
if err := self.resp.Err(); err != nil {
|
||||
self.DownloadErr()
|
||||
fmt.Fprintf(os.Stderr, "Download failed: %v\n", err)
|
||||
@ -224,8 +226,10 @@ func (self *DownloadProcessPage) StartDownload(_url,dst_dir string) {
|
||||
|
||||
self.TheTicker = gotime.NewTicker(100 * gotime.Millisecond)
|
||||
|
||||
if self.Doing = false {
|
||||
go self.UpdateProcessInterval()
|
||||
|
||||
self.Doing = true
|
||||
}
|
||||
}
|
||||
|
||||
func (self *DownloadProcessPage) StopDownload() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user