add a submit button

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-13 13:50:19 -06:00
parent e4c3aafb7b
commit 0ef88b82d1
4 changed files with 30 additions and 38 deletions

View File

@ -78,9 +78,11 @@ func globalBuildOptions(vbox *gui.Node) {
me.develBranch = gadgets.NewBasicCombobox(grid, "default devel branch")
me.develBranch.AddText("devel")
me.develBranch.Disable()
me.userBranch = gadgets.NewBasicCombobox(grid, "default user branch")
me.userBranch.AddText(usr.Username)
me.userBranch.Disable()
var newBranch *gui.Node
var setBranchB *gui.Node

View File

@ -1,15 +1,10 @@
package main
import (
"fmt"
"os"
"path/filepath"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/logsettings"
"go.wit.com/log"
)
func globalDisplaySetRepoState() {
@ -73,33 +68,6 @@ func globalDisplayOptions(vbox *gui.Node) {
}
me.scanEveryMinute = group1.NewCheckbox("Scan every minute").SetChecked(false)
group1.NewButton("make go.work file", func() {
me.autotypistWindow.Disable()
goSrcDir := me.goSrcPwd.String()
filename := filepath.Join(goSrcDir, "go.work")
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {
return
}
defer f.Close()
fmt.Fprintln(f, "go 1.21.4")
fmt.Fprintln(f, "")
fmt.Fprintln(f, "use (")
for _, repo := range me.allrepos {
if repo.status.Exists("go.mod") {
fmt.Fprintln(f, "\t"+repo.String())
} else {
log.Info("missing go.mod for", repo.String())
repo.status.MakeRedomod()
}
}
fmt.Fprintln(f, ")")
me.autotypistWindow.Enable()
})
var tagsW *tagWindow
group1.NewButton("git tags Window", func() {
if tagsW == nil {

View File

@ -71,7 +71,7 @@ type autoType struct {
// displays a summary of all the repos
// has total dirty, total read-only
// total patches, etc
summary *develSummary
summary *patchSummary
}
type repo struct {

View File

@ -10,7 +10,7 @@ import (
"go.wit.com/log"
)
type develSummary struct {
type patchSummary struct {
grid *gui.Node
updateB *gui.Node
docsB *gui.Node
@ -20,11 +20,14 @@ type develSummary struct {
readonlyOL *gadgets.OneLiner
totalPatchesOL *gadgets.OneLiner
reason *gadgets.BasicEntry
submitB *gui.Node
allp []*patch
}
func submitPatchesBox(box *gui.Node) *develSummary {
s := new(develSummary)
func submitPatchesBox(box *gui.Node) *patchSummary {
s := new(patchSummary)
group1 := box.NewGroup("Submit Patches Summary")
s.grid = group1.RawGrid()
@ -61,10 +64,27 @@ func submitPatchesBox(box *gui.Node) *develSummary {
s.totalPatchesOL = gadgets.NewOneLiner(s.grid, "total commits")
s.grid.NextRow()
s.reason = gadgets.NewBasicEntry(s.grid, "patch name:")
s.reason.Custom = func() {
if s.reason.String() != "" {
s.submitB.Enable()
} else {
s.submitB.Disable()
}
}
s.submitB = s.grid.NewButton("Submit Patches", func() {
for i, p := range s.allp {
log.Info(i, p.ref, p.rs.String())
}
})
// disable these until there are not dirty repos
s.reason.Disable()
s.submitB.Disable()
return s
}
func (s *develSummary) Update() {
func (s *patchSummary) Update() {
var total, dirty, readonly int
for _, repo := range me.allrepos {
total += 1
@ -86,6 +106,8 @@ func (s *develSummary) Update() {
}
if dirty == 0 {
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches")
s.submitB.Enable()
s.reason.Enable()
} else {
s.totalPatchesOL.SetText(strconv.Itoa(p) + " patches + ? dirty")
}
@ -97,7 +119,7 @@ type patch struct {
rs *repostatus.RepoStatus
}
func (s *develSummary) GetPatches() (int, []*patch) {
func (s *patchSummary) GetPatches() (int, []*patch) {
var patchcount int
patches := make([]*patch, 0, 0)
for _, repo := range me.allrepos {