mirror of
https://github.com/clockworkpi/LauncherGoDev.git
synced 2025-12-16 09:58: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
|
DST_DIR string
|
||||||
Value int
|
Value int
|
||||||
PngSize map[string][2]int
|
PngSize map[string][2]int
|
||||||
|
Doing bool
|
||||||
|
|
||||||
FileNameLabel LabelInterface
|
FileNameLabel LabelInterface
|
||||||
SizeLabel LabelInterface
|
SizeLabel LabelInterface
|
||||||
@ -121,6 +122,7 @@ Loop:
|
|||||||
self.resp.BytesComplete(),
|
self.resp.BytesComplete(),
|
||||||
self.resp.Size,
|
self.resp.Size,
|
||||||
100*self.resp.Progress())
|
100*self.resp.Progress())
|
||||||
|
|
||||||
self.Value = int(100.0*self.resp.Progress())
|
self.Value = int(100.0*self.resp.Progress())
|
||||||
total := float64(self.resp.Size)/1000.0/1000.0
|
total := float64(self.resp.Size)/1000.0/1000.0
|
||||||
downloaded := float64(self.resp.BytesComplete())/1000.0/1000.0
|
downloaded := float64(self.resp.BytesComplete())/1000.0/1000.0
|
||||||
@ -129,8 +131,6 @@ Loop:
|
|||||||
self.SizeLabel.SetText(lb_str)
|
self.SizeLabel.SetText(lb_str)
|
||||||
|
|
||||||
self.FileNameLabel.SetText(filepath.Base(self.resp.Filename))
|
self.FileNameLabel.SetText(filepath.Base(self.resp.Filename))
|
||||||
|
|
||||||
|
|
||||||
self.Screen.Draw()
|
self.Screen.Draw()
|
||||||
self.Screen.SwapAndShow()
|
self.Screen.SwapAndShow()
|
||||||
|
|
||||||
@ -139,11 +139,13 @@ Loop:
|
|||||||
fmt.Println("download is complete ",self.Value)
|
fmt.Println("download is complete ",self.Value)
|
||||||
self.Value = 0
|
self.Value = 0
|
||||||
self.TheTicker.Stop()
|
self.TheTicker.Stop()
|
||||||
|
self.Doing=false
|
||||||
break Loop
|
break Loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.Doing=false
|
||||||
|
|
||||||
if err := self.resp.Err(); err != nil {
|
if err := self.resp.Err(); err != nil {
|
||||||
self.DownloadErr()
|
self.DownloadErr()
|
||||||
fmt.Fprintf(os.Stderr, "Download failed: %v\n", err)
|
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)
|
self.TheTicker = gotime.NewTicker(100 * gotime.Millisecond)
|
||||||
|
|
||||||
|
if self.Doing = false {
|
||||||
go self.UpdateProcessInterval()
|
go self.UpdateProcessInterval()
|
||||||
|
self.Doing = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *DownloadProcessPage) StopDownload() {
|
func (self *DownloadProcessPage) StopDownload() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user