From 0e979faf5b6ef2d8b37fd63835824bf5405cbc08 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 26 Jan 2024 13:45:27 -0600 Subject: [PATCH] disable state works Signed-off-by: Jeff Carr --- Makefile | 2 +- globalTestingOptions.go | 75 +++++++++++++++++++++-------------------- listWindow.go | 40 ++++++++++++++++++++-- 3 files changed, 77 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index 113f2a9..b621b93 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ goimports: build: echo "build it!" -rm resources/*.so - cp ~/go/src/go.wit.com/toolkits/*.so resources/ + cp -a ~/go/src/go.wit.com/toolkits/*.so resources/ go build -v -x install: diff --git a/globalTestingOptions.go b/globalTestingOptions.go index 3db2727..1631db1 100644 --- a/globalTestingOptions.go +++ b/globalTestingOptions.go @@ -2,10 +2,8 @@ package main import ( "os" - "strings" "go.wit.com/lib/gui/repostatus" - "go.wit.com/log" "go.wit.com/gui" ) @@ -21,42 +19,47 @@ func globalTestingOptions(box *gui.Node) { me.autoRebuildButton.SetLabel("rebuild autotypist") }) - me.downloadEverythingButton = test1.NewButton("go get go.wit.com", func() { - me.downloadEverythingButton.Disable() - me.autoWorkingPwd.SetValue("/home/jcarr/go/src") - var perfect bool = true - repos := myrepolist() - for _, line := range repos { - log.Verbose("repo =", line) - path, _, _, _ := splitLine(line) - path = strings.TrimSpace(path) - if path == "#" { - // skip comment lines - continue - } - if doesExist("/home/jcarr/go/src/" + path) { - continue - } - // attempt to download it - quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path}) - perfect = false - } - - if perfect { - var notes string - notes = "you have already downloaded\neverything on go.wit.com" - me.autoWorkingPwd.SetValue(notes) + /* + me.downloadEverythingButton = test1.NewButton("go get go.wit.com", func() { me.downloadEverythingButton.Disable() - return - } else { - var notes string - notes = "download everything failed" - me.autoWorkingPwd.SetValue(notes) - me.downloadEverythingButton.Enable() - } - }) - test1.NewButton("go.wit.com/list", func() { + me.autoWorkingPwd.SetValue("/home/jcarr/go/src") + var perfect bool = true + repos := myrepolist() + for _, line := range repos { + log.Verbose("repo =", line) + path, _, _, _ := splitLine(line) + path = strings.TrimSpace(path) + if path == "#" { + // skip comment lines + continue + } + if doesExist("/home/jcarr/go/src/" + path) { + continue + } + // attempt to download it + quickCmd("/home/jcarr/go/src/go.wit.com", []string{"go", "get", "-v", path}) + perfect = false + } + + if perfect { + var notes string + notes = "you have already downloaded\neverything on go.wit.com" + me.autoWorkingPwd.SetValue(notes) + me.downloadEverythingButton.Disable() + return + } else { + var notes string + notes = "download everything failed" + me.autoWorkingPwd.SetValue(notes) + me.downloadEverythingButton.Enable() + } + }) + */ + var listallB *gui.Node + listallB = test1.NewButton("go.wit.com/list", func() { + listallB.Disable() listWindow() + listallB.Enable() }) test1.NewButton("repostatus.ListAll()", func() { repostatus.ListAll() diff --git a/listWindow.go b/listWindow.go index 3f87050..c883bd2 100644 --- a/listWindow.go +++ b/listWindow.go @@ -11,6 +11,7 @@ import ( "go.wit.com/log" "go.wit.com/lib/gadgets" + "go.wit.com/lib/gui/repostatus" ) var lw *gadgets.BasicWindow @@ -23,7 +24,9 @@ type witRepo struct { } type section struct { - name string + name string + hidden bool + parent *gui.Node box *gui.Node group *gui.Node @@ -68,6 +71,16 @@ func listWindow() { curs.add(parts[0]) } } + for i, sec := range allsections { + log.Info("section name:", sec.name, "hidden:", sec.hidden, i) + parts := strings.Split(sec.name, " ") + if len(parts) > 1 { + if parts[1] != "Applications" { + sec.Hide() + } + } + } + // lw.Toggle() } func (s *section) add(path string) { @@ -85,15 +98,21 @@ func (s *section) add(path string) { quickCmd(fullpath, []string{"go", "get", "-v", tmp.path.String()}) lw.Enable() }) + if repostatus.VerifyLocalGoRepo(path) { + log.Verbose("newRepo actually exists", path) + tmp.downloadB.SetLabel("downloaded") + tmp.downloadB.Disable() + } s.witRepos = append(s.witRepos, tmp) } -func NewSection(parent *gui.Node, path string) *section { +func NewSection(parent *gui.Node, desc string) *section { news := new(section) + news.name = desc news.parent = parent news.box = news.parent.NewBox("bw vbox", true) - news.group = news.box.NewGroup(path) + news.group = news.box.NewGroup(desc) news.hideCB = news.box.NewCheckbox("hide") news.hideCB.Custom = func() { news.toggle() @@ -105,6 +124,21 @@ func NewSection(parent *gui.Node, path string) *section { func (s *section) toggle() { log.Warn(s.name) + if s.hidden { + s.hidden = false + for i, wrepo := range s.witRepos { + log.Warn(i, wrepo.path.String()) + wrepo.path.Show() + wrepo.downloadB.Show() + } + } else { + s.Hide() + } +} + +func (s *section) Hide() { + s.hidden = true + s.hideCB.SetChecked(true) for i, wrepo := range s.witRepos { log.Warn(i, wrepo.path.String()) wrepo.path.Hide()