testGui example is starting to work
This commit is contained in:
parent
cc7a1b0bdc
commit
931e345895
13
init.go
13
init.go
|
@ -6,17 +6,15 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (rl *RepoList) Init(f *forgepb.Forge) {
|
func Init(f *forgepb.Forge, g *gui.Node) *RepoList {
|
||||||
if rl == nil {
|
me = new(RepoList)
|
||||||
rl = new(RepoList)
|
|
||||||
}
|
|
||||||
me = rl
|
|
||||||
// todo: this code sucks. fix it soon
|
// todo: this code sucks. fix it soon
|
||||||
me.mainWindow = gui.NewWindow("builds and uploads all the packages")
|
me.mainWindow = g.NewWindow("builds and uploads all the packages")
|
||||||
me.mainbox = me.mainWindow.NewBox("bw hbox", true)
|
me.mainbox = me.mainWindow.NewBox("bw hbox", true)
|
||||||
|
|
||||||
// make a window with a table of all the repos
|
// make a window with a table of all the repos
|
||||||
me = AutotypistView(me.mainbox)
|
me.AutotypistView(me.mainbox)
|
||||||
|
|
||||||
me.Enable()
|
me.Enable()
|
||||||
me.forge = f
|
me.forge = f
|
||||||
|
@ -29,4 +27,5 @@ func (rl *RepoList) Init(f *forgepb.Forge) {
|
||||||
}
|
}
|
||||||
|
|
||||||
me.Enable()
|
me.Enable()
|
||||||
|
return me
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,27 +20,21 @@ func main() {
|
||||||
|
|
||||||
// load the ~/.config/forge/ config
|
// load the ~/.config/forge/ config
|
||||||
me.forge = forgepb.Init()
|
me.forge = forgepb.Init()
|
||||||
if me.forge == nil {
|
|
||||||
panic("damn it, forge is nil")
|
|
||||||
}
|
|
||||||
if me.forge.Config == nil {
|
|
||||||
panic("damn it config")
|
|
||||||
}
|
|
||||||
me.forge.ConfigPrintTable()
|
me.forge.ConfigPrintTable()
|
||||||
|
|
||||||
|
if err := me.forge.Machine.ConfigLoad(); err != nil {
|
||||||
|
log.Warn("zoopb.ConfigLoad() failed", err)
|
||||||
|
os.Exit(-1)
|
||||||
|
}
|
||||||
|
me.forge.Machine.InitWit()
|
||||||
|
|
||||||
// setup the GUI
|
// setup the GUI
|
||||||
me.myGui = gui.New()
|
me.myGui = gui.New()
|
||||||
me.myGui.Default()
|
me.myGui.Default()
|
||||||
|
|
||||||
// todo: this code sucks. fix it soon
|
me.repoList = repolist.Init(me.forge, me.myGui)
|
||||||
me.mainWindow = me.myGui.NewWindow("builds and uploads all the packages")
|
|
||||||
me.mainbox = me.mainWindow.NewBox("bw hbox", true)
|
|
||||||
|
|
||||||
// make a window with a table of all the repos
|
me.repoList.Enable()
|
||||||
me.repoList = repolist.AutotypistView(me.mainbox)
|
|
||||||
me.repoList.Init(me.forge)
|
|
||||||
|
|
||||||
me.Enable()
|
|
||||||
|
|
||||||
failed := make(map[*repolist.RepoRow]string)
|
failed := make(map[*repolist.RepoRow]string)
|
||||||
versions := make(map[*repolist.RepoRow]string)
|
versions := make(map[*repolist.RepoRow]string)
|
||||||
|
@ -54,10 +48,10 @@ func main() {
|
||||||
var alreadyBuilt bool
|
var alreadyBuilt bool
|
||||||
ver := repo.Status.DebianReleaseVersion()
|
ver := repo.Status.DebianReleaseVersion()
|
||||||
name := me.forge.DebName(repo.GoPath())
|
name := me.forge.DebName(repo.GoPath())
|
||||||
if me.machine.IsInstalled(name) {
|
if me.forge.Machine.IsInstalled(name) {
|
||||||
end += "(installed) "
|
end += "(installed) "
|
||||||
}
|
}
|
||||||
if actualp := me.machine.FindVersion(name, ver); actualp != nil {
|
if actualp := me.forge.Machine.FindVersion(name, ver); actualp != nil {
|
||||||
end += " (version match) " + actualp.Version + " " + ver + " "
|
end += " (version match) " + actualp.Version + " " + ver + " "
|
||||||
alreadyBuilt = true
|
alreadyBuilt = true
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,19 +5,10 @@ import (
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repolist"
|
"go.wit.com/lib/gui/repolist"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/lib/protobuf/zoopb"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var me *autoType
|
var me *autoType
|
||||||
|
|
||||||
func (b *autoType) Disable() {
|
|
||||||
b.mainbox.Disable()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (b *autoType) Enable() {
|
|
||||||
b.mainbox.Enable()
|
|
||||||
}
|
|
||||||
|
|
||||||
// this app's variables
|
// this app's variables
|
||||||
type autoType struct {
|
type autoType struct {
|
||||||
// allrepos map[string]*repo
|
// allrepos map[string]*repo
|
||||||
|
@ -42,7 +33,7 @@ type autoType struct {
|
||||||
goSrcPath string
|
goSrcPath string
|
||||||
|
|
||||||
// use zookeeper to get the list of installed packages
|
// use zookeeper to get the list of installed packages
|
||||||
machine zoopb.Machine
|
// machine zoopb.Machine
|
||||||
|
|
||||||
// #### autotypist Global Display Options
|
// #### autotypist Global Display Options
|
||||||
autoHidePerfect *gui.Node
|
autoHidePerfect *gui.Node
|
||||||
|
|
|
@ -4,33 +4,28 @@ import "go.wit.com/gui"
|
||||||
|
|
||||||
// This creates a view of the repos
|
// This creates a view of the repos
|
||||||
// you can only have one at this point
|
// you can only have one at this point
|
||||||
func AutotypistView(parent *gui.Node) *RepoList {
|
func (rl *RepoList) AutotypistView(parent *gui.Node) {
|
||||||
if me != nil {
|
rl.allrepos = make(map[string]*RepoRow)
|
||||||
return me
|
rl.viewName = "autotypist"
|
||||||
}
|
|
||||||
me = new(RepoList)
|
|
||||||
me.allrepos = make(map[string]*RepoRow)
|
|
||||||
me.viewName = "autotypist"
|
|
||||||
|
|
||||||
// me.reposbox = gui.RawBox()
|
// rl.reposbox = gui.RawBox()
|
||||||
me.reposbox = parent
|
rl.reposbox = parent
|
||||||
|
|
||||||
me.reposgroup = me.reposbox.NewGroup("my git repositories (configure in ~/.config/autotypist)")
|
rl.reposgroup = rl.reposbox.NewGroup("my git repositories (configure in ~/.config/autotypist)")
|
||||||
// me.reposgroup.Menu = repolistMenu() // how to do a menu? what should the code look like?
|
// rl.reposgroup.Menu = repolistMenu() // how to do a menu? what should the code look like?
|
||||||
me.reposgrid = me.reposgroup.NewGrid("test", 0, 0)
|
rl.reposgrid = rl.reposgroup.NewGrid("test", 0, 0)
|
||||||
|
|
||||||
me.reposgrid.NewLabel("") // path goes here
|
rl.reposgrid.NewLabel("") // path goes here
|
||||||
me.reposgrid.NewLabel("last tag").SetProgName("last tag")
|
rl.reposgrid.NewLabel("last tag").SetProgName("last tag")
|
||||||
me.reposgrid.NewLabel("master version")
|
rl.reposgrid.NewLabel("master version")
|
||||||
me.reposgrid.NewLabel("devel version")
|
rl.reposgrid.NewLabel("devel version")
|
||||||
me.reposgrid.NewLabel("user version")
|
rl.reposgrid.NewLabel("user version")
|
||||||
me.reposgrid.NewLabel("Status")
|
rl.reposgrid.NewLabel("Status")
|
||||||
me.reposgrid.NewLabel("Current").SetProgName("CurrentName")
|
rl.reposgrid.NewLabel("Current").SetProgName("CurrentName")
|
||||||
me.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
|
rl.reposgrid.NewLabel("Version").SetProgName("CurrentVersion")
|
||||||
me.reposgrid.NextRow()
|
rl.reposgrid.NextRow()
|
||||||
|
|
||||||
me.blind = gui.RawBox()
|
rl.blind = gui.RawBox()
|
||||||
me.shownCount = me.blind.NewLabel("showCount")
|
rl.shownCount = rl.blind.NewLabel("showCount")
|
||||||
me.duration = me.blind.NewLabel("duration")
|
rl.duration = rl.blind.NewLabel("duration")
|
||||||
return me
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue