download all button
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7b34a318e5
commit
8034921c7d
|
@ -34,6 +34,7 @@ type section struct {
|
||||||
group *gui.Node
|
group *gui.Node
|
||||||
grid *gui.Node // where the repos are listed
|
grid *gui.Node // where the repos are listed
|
||||||
hideCB *gui.Node
|
hideCB *gui.Node
|
||||||
|
downloadAllB *gui.Node
|
||||||
witRepos []*witRepo
|
witRepos []*witRepo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +107,27 @@ func downloadRepo(path string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *witRepo) doDownload() bool {
|
||||||
|
if me.autoDryRun.Checked() {
|
||||||
|
r.downloadB.SetLabel("uncheck --dry-run")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if r.downloadB.String() == "downloaded" {
|
||||||
|
log.Info("skipping already downloaded", r.path.String())
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if downloadRepo(r.path.String()) {
|
||||||
|
log.Info("download", r.path.String(), "worked")
|
||||||
|
r.downloadB.SetLabel("downloaded")
|
||||||
|
r.downloadB.Disable()
|
||||||
|
} else {
|
||||||
|
r.downloadB.SetLabel("failed")
|
||||||
|
log.Info("download", r.path.String(), "failed")
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (s *section) add(path string) {
|
func (s *section) add(path string) {
|
||||||
if s == nil {
|
if s == nil {
|
||||||
return
|
return
|
||||||
|
@ -115,16 +137,7 @@ func (s *section) add(path string) {
|
||||||
tmp.path = s.grid.NewLabel(path)
|
tmp.path = s.grid.NewLabel(path)
|
||||||
tmp.downloadB = s.grid.NewButton("download", func() {
|
tmp.downloadB = s.grid.NewButton("download", func() {
|
||||||
lw.Disable()
|
lw.Disable()
|
||||||
if me.autoDryRun.Checked() {
|
tmp.doDownload()
|
||||||
tmp.downloadB.SetLabel("uncheck --dry-run")
|
|
||||||
}
|
|
||||||
if downloadRepo(tmp.path.String()) {
|
|
||||||
log.Info("download", tmp.path.String(), "worked")
|
|
||||||
tmp.downloadB.SetLabel("downloaded")
|
|
||||||
tmp.downloadB.Disable()
|
|
||||||
} else {
|
|
||||||
log.Info("download", tmp.path.String(), "failed")
|
|
||||||
}
|
|
||||||
lw.Enable()
|
lw.Enable()
|
||||||
})
|
})
|
||||||
if repostatus.VerifyLocalGoRepo(path) {
|
if repostatus.VerifyLocalGoRepo(path) {
|
||||||
|
@ -146,6 +159,17 @@ func NewSection(parent *gui.Node, desc string) *section {
|
||||||
news.hideCB.Custom = func() {
|
news.hideCB.Custom = func() {
|
||||||
news.toggle()
|
news.toggle()
|
||||||
}
|
}
|
||||||
|
news.downloadAllB = news.box.NewButton("download all", func() {
|
||||||
|
lw.Disable()
|
||||||
|
log.Warn("Download all here")
|
||||||
|
for i, wrepo := range news.witRepos {
|
||||||
|
log.Warn("download:", i, wrepo.path.String())
|
||||||
|
wrepo.doDownload()
|
||||||
|
//wrepo.path.Show()
|
||||||
|
//wrepo.downloadB.Show()
|
||||||
|
}
|
||||||
|
lw.Enable()
|
||||||
|
})
|
||||||
news.grid = news.parent.NewGrid("sections", 2, 1)
|
news.grid = news.parent.NewGrid("sections", 2, 1)
|
||||||
allsections = append(allsections, news)
|
allsections = append(allsections, news)
|
||||||
return news
|
return news
|
||||||
|
|
Loading…
Reference in New Issue