make a problems window
This commit is contained in:
parent
a5222d3894
commit
b672943d0e
170
doGui.go
170
doGui.go
|
@ -15,7 +15,6 @@ import (
|
|||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/debugger"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/repolist"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -195,18 +194,6 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
me.autoCreateBranches = grid.NewCheckbox("auto create branches").SetChecked(true)
|
||||
grid.NextRow()
|
||||
|
||||
var patchWin *patchesWindow
|
||||
|
||||
grid.NewButton("Patches Window", func() {
|
||||
if patchWin != nil {
|
||||
patchWin.Toggle()
|
||||
return
|
||||
}
|
||||
patchWin = new(patchesWindow)
|
||||
patchWin.initWindow()
|
||||
patchWin.Show()
|
||||
})
|
||||
|
||||
group2 := vbox.NewGroup("Repos")
|
||||
grid = group2.RawGrid()
|
||||
|
||||
|
@ -246,43 +233,45 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
findMergeToDevel()
|
||||
makeStandardReposWindow(me.found)
|
||||
})
|
||||
var problemsWin *repoProblemsWindow
|
||||
grid.NewButton("Repo Problems", func() {
|
||||
if problemsWin != nil {
|
||||
problemsWin.Toggle()
|
||||
return
|
||||
}
|
||||
problemsWin = makeRepoProblemsWindow()
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
group2 = vbox.NewGroup("Repos with problems")
|
||||
/*
|
||||
group2 = vbox.NewGroup("Repos with problems")
|
||||
grid = group2.RawGrid()
|
||||
|
||||
grid.NewButton("devel is behind master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("user branch is remote", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("unknown branches", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewButton("remote devel != local devel", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("remote master != local master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
*/
|
||||
|
||||
group2 = vbox.NewGroup("Merge")
|
||||
grid = group2.RawGrid()
|
||||
|
||||
grid.NewButton("devel is behind master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("user branch is remote", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("unknown branches", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewButton("remote devel != local devel", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("remote master != local master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
group3 := vbox.NewGroup("debugging stuff")
|
||||
grid = group3.RawGrid()
|
||||
|
||||
grid.NewButton("forge ConfigSave()", func() {
|
||||
me.forge.ConfigSave()
|
||||
})
|
||||
|
||||
grid.NewButton("debugger()", func() {
|
||||
debugger.DebugWindow()
|
||||
})
|
||||
|
||||
grid.NewButton("merge to devel", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
|
@ -324,53 +313,65 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
mergeDevelToMaster(me.autoCreateBranches.Checked())
|
||||
})
|
||||
|
||||
group3 = vbox.NewGroup("old junk")
|
||||
group3 := vbox.NewGroup("work in progress")
|
||||
grid = group3.RawGrid()
|
||||
|
||||
var foundWin *foundWindow
|
||||
grid.NewButton("Search Repos", func() {
|
||||
if foundWin != nil {
|
||||
foundWin.Toggle()
|
||||
return
|
||||
}
|
||||
foundWin = new(foundWindow)
|
||||
foundWin.initWindow()
|
||||
foundWin.Show()
|
||||
grid.NewButton("forge ConfigSave()", func() {
|
||||
me.forge.ConfigSave()
|
||||
})
|
||||
|
||||
grid.NewButton("Repo Window", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
if reposWin != nil {
|
||||
if reposWin.Hidden() {
|
||||
reposWin.Show()
|
||||
} else {
|
||||
reposWin.Hide()
|
||||
grid.NewButton("debugger()", func() {
|
||||
debugger.DebugWindow()
|
||||
})
|
||||
|
||||
var patchWin *patchesWindow
|
||||
|
||||
grid.NewButton("Patches Window", func() {
|
||||
if patchWin != nil {
|
||||
patchWin.Toggle()
|
||||
return
|
||||
}
|
||||
patchWin = new(patchesWindow)
|
||||
patchWin.initWindow()
|
||||
patchWin.Show()
|
||||
})
|
||||
|
||||
/*
|
||||
grid.NewButton("Repo Window", func() {
|
||||
win.Disable()
|
||||
defer win.Enable()
|
||||
if reposWin != nil {
|
||||
if reposWin.Hidden() {
|
||||
reposWin.Show()
|
||||
} else {
|
||||
reposWin.Hide()
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
reposWin := new(repoWindow)
|
||||
reposWin.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
|
||||
reposWin.win.Make()
|
||||
reposWin := new(repoWindow)
|
||||
reposWin.win = gadgets.RawBasicWindow("All git repositories in ~/go/src/")
|
||||
reposWin.win.Make()
|
||||
|
||||
reposWin.box = reposWin.win.Box().NewBox("bw vbox", false)
|
||||
// me.reposwin.Draw()
|
||||
reposWin.win.Custom = func() {
|
||||
log.Warn("Repo Window close. hidden=true")
|
||||
// sets the hidden flag to false so Toggle() works
|
||||
reposWin.win.Hide()
|
||||
}
|
||||
reposWin.topbox = reposWin.repoMenu()
|
||||
reposWin.box = reposWin.win.Box().NewBox("bw vbox", false)
|
||||
// me.reposwin.Draw()
|
||||
reposWin.win.Custom = func() {
|
||||
log.Warn("Repo Window close. hidden=true")
|
||||
// sets the hidden flag to false so Toggle() works
|
||||
reposWin.win.Hide()
|
||||
}
|
||||
reposWin.topbox = reposWin.repoMenu()
|
||||
|
||||
reposWin.View = repolist.InitBox(me.forge, reposWin.box)
|
||||
reposWin.View.Enable()
|
||||
reposWin.View = repolist.InitBox(me.forge, reposWin.box)
|
||||
reposWin.View.Enable()
|
||||
|
||||
// need to update this logic
|
||||
reposWin.View.ScanRepositoriesOld()
|
||||
reposWin.win.Show()
|
||||
})
|
||||
// need to update this logic
|
||||
reposWin.View.ScanRepositoriesOld()
|
||||
reposWin.win.Show()
|
||||
})
|
||||
*/
|
||||
}
|
||||
|
||||
// this is the magic that generates a window directly from the protocol buffer
|
||||
func makeStandardReposWindow(pb *gitpb.Repos) {
|
||||
t := pb.NewTable("testDirty")
|
||||
sf := t.AddStringFunc("repo", func(r *gitpb.Repo) string {
|
||||
|
@ -382,6 +383,9 @@ func makeStandardReposWindow(pb *gitpb.Repos) {
|
|||
sf.Custom = func(r *gitpb.Repo) {
|
||||
log.Info("do button click on", r.GetGoPath())
|
||||
}
|
||||
t.AddTimeFunc("age", func(repo *gitpb.Repo) time.Time {
|
||||
return repo.NewestTime()
|
||||
})
|
||||
t.AddMasterVersion()
|
||||
t.AddDevelVersion()
|
||||
t.AddUserVersion()
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
type repoProblemsWindow struct {
|
||||
once sync.Once // only init() the window once
|
||||
win *gadgets.BasicWindow // the patches window
|
||||
stack *gui.Node // the top box set as vertical
|
||||
shelf *gui.Node // the first box in the stack, set as horizontal
|
||||
grid *gui.Node // the list of available patches
|
||||
// summary *patchSummary // summary of current patches
|
||||
setgrid *gui.Node // the list of each patchset
|
||||
pset *forgepb.Patchset // the patchset in question
|
||||
}
|
||||
|
||||
// todo: autogenerate these or make them standared 'gui' package functions
|
||||
// make this an go interface somehow
|
||||
|
||||
// is the window hidden right now?
|
||||
func (w *repoProblemsWindow) Hidden() bool {
|
||||
return w.win.Hidden()
|
||||
}
|
||||
|
||||
// switches between the window being visable or hidden on the desktop
|
||||
func (w *repoProblemsWindow) Toggle() {
|
||||
if w.Hidden() {
|
||||
w.Show()
|
||||
} else {
|
||||
w.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
// hides the window completely
|
||||
func (w *repoProblemsWindow) Show() {
|
||||
w.win.Show()
|
||||
}
|
||||
|
||||
func (w *repoProblemsWindow) Hide() {
|
||||
w.win.Hide()
|
||||
}
|
||||
|
||||
// should be the first box/widget in the window
|
||||
// greys out the window to the user
|
||||
func (w *repoProblemsWindow) Disable() {
|
||||
w.stack.Disable()
|
||||
}
|
||||
|
||||
func (w *repoProblemsWindow) Enable() {
|
||||
w.stack.Enable()
|
||||
}
|
||||
|
||||
// you can only have one of these
|
||||
func makeRepoProblemsWindow() *repoProblemsWindow {
|
||||
pw := new(repoProblemsWindow)
|
||||
|
||||
// sync.Once()
|
||||
pw.win = gadgets.RawBasicWindow("Potential Repo Problems")
|
||||
pw.win.Make()
|
||||
|
||||
pw.stack = pw.win.Box().NewBox("bw vbox", false)
|
||||
pw.win.Custom = func() {
|
||||
// sets the hidden flag to false so Toggle() works
|
||||
pw.win.Hide()
|
||||
}
|
||||
pw.stack.NewGroup("things")
|
||||
|
||||
grid := pw.stack.RawGrid()
|
||||
|
||||
grid.NewButton("devel is behind master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("user branch is remote", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("unknown branches", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
grid.NewButton("remote devel != local devel", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
|
||||
grid.NewButton("remote master != local master", func() {
|
||||
log.Info("not done yet")
|
||||
})
|
||||
grid.NextRow()
|
||||
|
||||
return pw
|
||||
}
|
Loading…
Reference in New Issue