diff --git a/doGui.go b/doGui.go index 7b07a9d..6d0dcc9 100644 --- a/doGui.go +++ b/doGui.go @@ -31,7 +31,7 @@ func doGui() { me.patchWin = new(patchesWindow) - me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)") + me.mainWindow = gadgets.RawBasicWindow("Forge: (this kinda works sometimes)") me.mainWindow.Make() me.mainWindow.Show() me.mainWindow.Custom = func() { diff --git a/windowMain.go b/windowMain.go index 55252ce..7d6441a 100644 --- a/windowMain.go +++ b/windowMain.go @@ -111,12 +111,21 @@ func globalBuildOptions(vbox *gui.Node) { me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) grid.NextRow() + grid.NewButton("Show Repos", func() { + if me.repos.Hidden() { + me.repos.Show() + } else { + me.repos.Hide() + } + }) grid.NewButton("patches window", func() { me.patchWin.once.Do(me.patchWin.initWindow) me.patchWin.Toggle() + }) + grid.NewButton("update patch summary", func() { + me.summary.Update() + }) + grid.NewButton("test add", func() { me.patchWin.initGroup() }) - grid.NewButton("hide patches window", func() { - me.patchWin.Hide() - }) } diff --git a/windowNew.go b/windowNew.go index e6d0043..7e6d342 100644 --- a/windowNew.go +++ b/windowNew.go @@ -11,12 +11,12 @@ import ( ) type patchesWindow struct { - once sync.Once - win *gadgets.BasicWindow - box *gui.Node + once sync.Once + win *gadgets.BasicWindow + stackBox *gui.Node // the top box of the repolist window - topbox *gui.Node + shelf *gui.Node } func (r *patchesWindow) Hidden() bool { @@ -27,7 +27,7 @@ func (r *patchesWindow) Toggle() { if r.Hidden() { r.Show() } else { - r.Show() + r.Hide() } } @@ -40,11 +40,11 @@ func (r *patchesWindow) Hide() { } func (r *patchesWindow) Disable() { - r.box.Disable() + r.stackBox.Disable() } func (r *patchesWindow) Enable() { - r.box.Enable() + r.stackBox.Enable() } // you can only have one of these @@ -53,18 +53,21 @@ func (r *patchesWindow) initWindow() { r.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/") r.win.Make() - r.box = r.win.Box().NewBox("bw vbox", false) + r.stackBox = r.win.Box().NewBox("bw vbox", false) // me.reposwin.Draw() r.win.Custom = func() { log.Warn("Repo Window close. Do something here?") + // sets the hidden flag to false so Toggle() works + r.win.Hide() } - r.topbox = r.initGroup() + r.shelf = r.initGroup() + submitPatchesBox(r.shelf) } func (r *patchesWindow) initGroup() *gui.Node { // reposbox.SetExpand(false) - group1 := r.box.NewGroup("Filter:") + group1 := r.stackBox.NewGroup("Filter:") hbox := group1.Box() // hbox.Horizontal() diff --git a/windowPatchesBox.go b/windowPatchesBox.go index eeae1e8..30c34cb 100644 --- a/windowPatchesBox.go +++ b/windowPatchesBox.go @@ -116,20 +116,10 @@ func submitPatchesBox(box *gui.Node) *patchSummary { applyPatchset(pset) }) - s.grid.NewButton("Show Repos", func() { - s.Update() - if me.repos.Hidden() { - me.repos.Show() - } else { - me.repos.Hide() - } - }) - // disable these until there are not dirty repos // s.reason.Disable() s.submitB.Disable() s.grid.NextRow() - return s } diff --git a/windowRepos.go b/windowRepos.go index ecd541f..2558f37 100644 --- a/windowRepos.go +++ b/windowRepos.go @@ -54,7 +54,9 @@ func makeRepoView() *repoWindow { r.box = r.win.Box().NewBox("bw vbox", false) // me.reposwin.Draw() r.win.Custom = func() { - log.Warn("Repo Window close. Do something here?") + log.Warn("Repo Window close. hidden=true") + // sets the hidden flag to false so Toggle() works + r.win.Hide() } r.topbox = r.repoMenu()