work on making a map of the windows

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-21 03:18:07 -06:00
parent 696b58744c
commit 7546209d24
2 changed files with 31 additions and 10 deletions

14
git.go
View File

@ -175,34 +175,28 @@ func (rs *RepoStatus) SetUserBranchName(s string) {
// returns "master", "devel", os.Username, etc // returns "master", "devel", os.Username, etc
func (rs *RepoStatus) GetMasterBranchName() string { func (rs *RepoStatus) GetMasterBranchName() string {
name := rs.masterDrop.String() name := rs.masterDrop.String()
log.Warn("GetMasterName() =", name)
return name return name
} }
func (rs *RepoStatus) GetDevelBranchName() string { func (rs *RepoStatus) GetDevelBranchName() string {
name := rs.develDrop.String() name := rs.develDrop.String()
log.Warn("GetDevelName() =", name)
return name return name
} }
func (rs *RepoStatus) GetUserBranchName() string { func (rs *RepoStatus) GetUserBranchName() string {
name := rs.userDrop.String() name := rs.userDrop.String()
log.Warn("GetUserBranchName() =", name)
return name return name
} }
// returns the git versions like "1.3-2-laksdjf" or whatever // returns the git versions like "1.3-2-laksdjf" or whatever
func (rs *RepoStatus) GetMasterVersion() string { func (rs *RepoStatus) GetMasterVersion() string {
name := rs.masterBranchVersion.String() name := rs.masterBranchVersion.String()
log.Warn("GetMasterVersion() =", name)
return name return name
} }
func (rs *RepoStatus) GetDevelVersion() string { func (rs *RepoStatus) GetDevelVersion() string {
name := rs.develBranchVersion.String() name := rs.develBranchVersion.String()
log.Warn("GetBranchVersion() =", name)
return name return name
} }
func (rs *RepoStatus) GetUserVersion() string { func (rs *RepoStatus) GetUserVersion() string {
name := rs.userBranchVersion.String() name := rs.userBranchVersion.String()
log.Warn("GetUserVersion() =", name)
return name return name
} }
@ -211,7 +205,7 @@ func (rs *RepoStatus) SetMasterVersion(s string) {
return return
} }
rs.changed = true rs.changed = true
log.Warn("git", rs.GetMasterBranchName(), "version now =", s) log.Verbose("git", rs.GetMasterBranchName(), "is now version =", s)
rs.masterBranchVersion.SetValue(s) rs.masterBranchVersion.SetValue(s)
} }
@ -220,8 +214,8 @@ func (rs *RepoStatus) SetDevelVersion(s string) {
return return
} }
rs.changed = true rs.changed = true
log.Warn("git", rs.GetDevelBranchName(), "version now =", s)
rs.develBranchVersion.SetValue(s) rs.develBranchVersion.SetValue(s)
log.Verbose("git", rs.GetDevelBranchName(), "s now version =", s)
} }
func (rs *RepoStatus) SetUserVersion(s string) { func (rs *RepoStatus) SetUserVersion(s string) {
@ -229,8 +223,8 @@ func (rs *RepoStatus) SetUserVersion(s string) {
return return
} }
rs.changed = true rs.changed = true
log.Warn("git", rs.GetUserBranchName(), "version now =", s)
rs.userBranchVersion.SetValue(s) rs.userBranchVersion.SetValue(s)
log.Verbose("git", rs.GetUserBranchName(), "is now version =", s)
} }
func (rs *RepoStatus) GetStatus() string { func (rs *RepoStatus) GetStatus() string {
@ -250,7 +244,7 @@ func (rs *RepoStatus) GetStatus() string {
} }
if rs.CheckBranches() { if rs.CheckBranches() {
log.Warn("Branches are Perfect") log.Info("Branches are Perfect")
return "PERFECT" return "PERFECT"
} }
log.Warn(rs.GetPath(), "Branches are not Perfect") log.Warn(rs.GetPath(), "Branches are not Perfect")

27
new.go
View File

@ -6,6 +6,28 @@ import (
"go.wit.com/log" "go.wit.com/log"
) )
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
}
func New(p *gui.Node, path string) *RepoStatus { func New(p *gui.Node, path string) *RepoStatus {
rs := &RepoStatus{ rs := &RepoStatus{
hidden: true, hidden: true,
@ -24,5 +46,10 @@ func New(p *gui.Node, path string) *RepoStatus {
rs.Hide() rs.Hide()
log.Warn("repostatus user closed the window()") log.Warn("repostatus user closed the window()")
} }
windowMap[path] = rs
return rs return rs
} }
func init() {
windowMap = make(map[string]*RepoStatus)
}