diff options
| author | Jeff Carr <[email protected]> | 2024-01-26 13:45:27 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-26 13:45:27 -0600 |
| commit | 0e979faf5b6ef2d8b37fd63835824bf5405cbc08 (patch) | |
| tree | 67d969b24f77b2fa6d6fd16ddc3741e59eefe23a /listWindow.go | |
| parent | 1a459d6f6ff8ed77f41bba1cceea92035415aa0b (diff) | |
disable state works
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'listWindow.go')
| -rw-r--r-- | listWindow.go | 40 |
1 files changed, 37 insertions, 3 deletions
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() |
