2024-01-09 15:34:53 -06:00
|
|
|
package repostatus
|
|
|
|
|
2024-01-18 00:57:43 -06:00
|
|
|
import (
|
2024-01-18 05:01:54 -06:00
|
|
|
"go.wit.com/gui"
|
2024-01-18 00:57:43 -06:00
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/log"
|
2024-01-09 15:34:53 -06:00
|
|
|
)
|
|
|
|
|
2024-01-21 03:18:07 -06:00
|
|
|
var windowMap map[string]*RepoStatus
|
|
|
|
|
|
|
|
func ListAll() {
|
|
|
|
for path, rs := range windowMap {
|
|
|
|
log.Warn(rs.GetMasterVersion(), path)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewRepoStatusWindow(path string) *RepoStatus {
|
|
|
|
if windowMap[path] == nil {
|
|
|
|
log.Warn("This doesn't exist yet for path", path)
|
|
|
|
} else {
|
|
|
|
log.Warn("This already exists yet for path", path)
|
|
|
|
log.Warn("should return windowMap[path] here")
|
|
|
|
}
|
|
|
|
rs := New(gui.TreeRoot(), path)
|
|
|
|
windowMap[path] = rs
|
|
|
|
|
|
|
|
// todo check if a window already exists for this path
|
|
|
|
return rs
|
|
|
|
}
|
|
|
|
|
2024-01-09 15:34:53 -06:00
|
|
|
func New(p *gui.Node, path string) *RepoStatus {
|
2024-01-18 00:57:43 -06:00
|
|
|
rs := &RepoStatus{
|
|
|
|
hidden: true,
|
|
|
|
ready: false,
|
|
|
|
parent: p,
|
2024-01-09 15:34:53 -06:00
|
|
|
repopath: path,
|
|
|
|
}
|
|
|
|
rs.tags = make(map[string]string)
|
2024-01-18 00:57:43 -06:00
|
|
|
rs.window = gadgets.NewBasicWindow(p, "GO Repo Details "+path)
|
2024-01-14 10:00:42 -06:00
|
|
|
rs.window.Horizontal()
|
|
|
|
rs.window.Make()
|
2024-01-09 15:34:53 -06:00
|
|
|
rs.ready = true
|
2024-01-14 10:00:42 -06:00
|
|
|
rs.draw()
|
2024-01-14 22:14:02 -06:00
|
|
|
rs.window.Custom = func() {
|
2024-01-15 00:17:01 -06:00
|
|
|
// rs.hidden = true
|
|
|
|
rs.Hide()
|
2024-01-14 22:14:02 -06:00
|
|
|
log.Warn("repostatus user closed the window()")
|
|
|
|
}
|
2024-01-21 03:18:07 -06:00
|
|
|
windowMap[path] = rs
|
2024-01-11 15:56:50 -06:00
|
|
|
return rs
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
2024-01-21 03:18:07 -06:00
|
|
|
|
|
|
|
func init() {
|
|
|
|
windowMap = make(map[string]*RepoStatus)
|
|
|
|
}
|