From 217499af46a060341d7e91ee208182531a796a94 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 7 Oct 2025 01:46:47 -0500 Subject: attempt to ressurrect a patches table in the GUI --- doGui.go | 21 +++++---------------- doPatch.go | 2 +- windowPatches.go | 17 +++++++++++------ 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/doGui.go b/doGui.go index 6906812..e83b8b8 100644 --- a/doGui.go +++ b/doGui.go @@ -90,22 +90,11 @@ func doGui() { patchButton.SetLabel("not safe yet") return } - // patchesWin = makePatchesWin(me.forge.Patchsets) - notdone := new(forgepb.Patches) - - all := me.forge.Patchsets.All() - for all.Scan() { - pset := all.Next() - if pset.State == "DONE" { - // skip old patchsets - continue - } - AddAllPatches(notdone, pset, false) - // AddNotDonePatches(notdone, pset, false) - } - notdone.PrintTable() - - patchesWin = makePatchesWin(notdone) + curpatches := forgepb.NewPatches() + curpatches.Filename = "/tmp/curpatches.pb" + curpatches.Load() + curpatches.Save() + patchesWin = makePatchesWin(curpatches) }) var pubWin *gadgets.GenericWindow diff --git a/doPatch.go b/doPatch.go index 507b2fd..8b59c49 100644 --- a/doPatch.go +++ b/doPatch.go @@ -150,7 +150,7 @@ func doPatchGet(newpb *forgepb.Sets) { continue } // gitpb.FindPatchIdFromGitAmBroken(patch.Data) // doesn't os.Exec() - log.Info("current patch", patch.CommitHash, patch.PatchId, patch.Filename) + log.Info("adding new patch", patch.CommitHash, patch.PatchId, patch.Filename) curpatches.AppendByPatchId(patch) } } diff --git a/windowPatches.go b/windowPatches.go index 40f96de..fa1d299 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -68,13 +68,18 @@ func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin { log.Info("ALL PATCHES WORKED! count =", count) }) + grid.NewButton("draw table", func() { + if dwin.TB == nil { + log.Info("dwin.TB is nil") + dwin.doPatchesTable(patches) + return + } + dwin.TB.MakeTable() + dwin.TB.ShowTable() + }) + // make a box at the bottom of the window for the protobuf table dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX") - - if patches != nil { - dwin.doPatchesTable(patches) - } - return dwin } @@ -103,7 +108,7 @@ func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) { } // display the protobuf - dwin.TB = AddPatchesPB(dwin.box, currentPatches) + dwin.TB = currentPatches.MakeTable() f := func(p *forgepb.Patch) { log.Info("do something with patch", p.Filename) } -- cgit v1.2.3