trying to get patchset tables to work
This commit is contained in:
parent
2c5841f5ec
commit
18d9a7a099
|
@ -0,0 +1,71 @@
|
||||||
|
// 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/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
type stdPatchTableWin struct {
|
||||||
|
sync.Mutex
|
||||||
|
win *gadgets.GenericWindow // the machines gui window
|
||||||
|
box *gui.Node // the machines gui parent box widget
|
||||||
|
TB *forgepb.PatchesTable // the gui table buffer
|
||||||
|
update bool // if the window should be updated
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *stdPatchTableWin) Toggle() {
|
||||||
|
if w == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if w.win == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
w.win.Toggle()
|
||||||
|
}
|
||||||
|
|
||||||
|
func makePatchesWin() *stdPatchTableWin {
|
||||||
|
dwin := new(stdPatchTableWin)
|
||||||
|
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "who is squirreling around?")
|
||||||
|
dwin.win.Custom = func() {
|
||||||
|
log.Info("test delete window here")
|
||||||
|
}
|
||||||
|
grid := dwin.win.Group.RawGrid()
|
||||||
|
|
||||||
|
grid.NewButton("reload", func() {
|
||||||
|
})
|
||||||
|
|
||||||
|
// make a box at the bottom of the window for the protobuf table
|
||||||
|
dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
|
||||||
|
|
||||||
|
return dwin
|
||||||
|
}
|
||||||
|
|
||||||
|
func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
|
||||||
|
dwin.Lock()
|
||||||
|
defer dwin.Unlock()
|
||||||
|
if dwin.TB != nil {
|
||||||
|
dwin.TB.Delete()
|
||||||
|
dwin.TB = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// define what rows to have in the protobuf table
|
||||||
|
func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable {
|
||||||
|
t := pb.NewTable("PatchesPB")
|
||||||
|
t.NewUuid()
|
||||||
|
t.SetParent(tbox)
|
||||||
|
|
||||||
|
t.AddRepoNamespace()
|
||||||
|
t.AddFilename()
|
||||||
|
t.AddCommitHash()
|
||||||
|
|
||||||
|
t.ShowTable()
|
||||||
|
return t
|
||||||
|
}
|
|
@ -88,7 +88,6 @@ func (dwin *stdPatchsetTableWin) doPatchsetsTable(currentPatchsets *forgepb.Patc
|
||||||
dwin.TB = AddPatchsetsPB(dwin.box, currentPatchsets)
|
dwin.TB = AddPatchsetsPB(dwin.box, currentPatchsets)
|
||||||
f := func(pset *forgepb.Patchset) {
|
f := func(pset *forgepb.Patchset) {
|
||||||
log.Info("Triggered. do something here", pset.Name)
|
log.Info("Triggered. do something here", pset.Name)
|
||||||
// m.Enabled = true
|
|
||||||
win := makePatchWindow(pset)
|
win := makePatchWindow(pset)
|
||||||
win.Show()
|
win.Show()
|
||||||
}
|
}
|
||||||
|
@ -109,7 +108,9 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
}
|
}
|
||||||
tp := t.AddButtonFunc("Analyse", testf)
|
tp := t.AddButtonFunc("Analyse", testf)
|
||||||
tp.Custom = func(p *forgepb.Patchset) {
|
tp.Custom = func(p *forgepb.Patchset) {
|
||||||
log.Info("test patchset here", p.Name)
|
log.Info("show patches here", p.Name)
|
||||||
|
patchwin := makePatchesWin()
|
||||||
|
patchwin.doPatchesTable(p.Patches)
|
||||||
}
|
}
|
||||||
|
|
||||||
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
||||||
|
|
Loading…
Reference in New Issue