diff options
| author | Jeff Carr <[email protected]> | 2025-02-19 02:48:20 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-19 17:39:45 -0600 |
| commit | b257b05f7bd4e431f3fa8a1eeec30c73f6eac865 (patch) | |
| tree | 11d3c53556f04e93ba90f85127e937e9fccb095b /table.go | |
| parent | 4087d77add8579b0fa0c738830d07ab3af6aad02 (diff) | |
string rows
Diffstat (limited to 'table.go')
| -rw-r--r-- | table.go | 72 |
1 files changed, 53 insertions, 19 deletions
@@ -74,16 +74,12 @@ type NodeTable struct { // pb *guipb.Table } -func (t *NodeTable) ShowTable(pb *guipb.Table) { - log.Info("gui.ShowTable") +func ShowTable(pb *guipb.Table) { // make a new action and populate the current node state - a := getNewAction(t.n, widget.Show) - /* - if t.pb == nil { - log.Info("error: TablePB == nil") - return - } - */ + a := getNewAction(me.rootNode, widget.Show) + + makeTableWidgets(pb) + nt := guipb.NewTables() nt.Append(pb) a.TablePB, err = nt.Marshal() @@ -91,17 +87,55 @@ func (t *NodeTable) ShowTable(pb *guipb.Table) { log.Info("unmarshal error", err) return } - log.Info("send action to plugin", t.n.label, "pb len =", len(a.TablePB)) + log.Info("send action to plugin", "pb len =", len(a.TablePB)) sendActionToPlugin(a) - /* - newNode := parent.newNode(name, widget.Button) - newNode.Custom = custom - newNode.label = name - newNode.progname = name +} - // inform the toolkits - sendAction(newNode, widget.Add) - */ - // return newNode +func makeTableWidgets(pb *guipb.Table) { + if pb == nil { + log.Info("pb was nil") + return + } + if me.rootNode == nil { + log.Info("me.rootNode was nil") + return + } + win := addNode() + pb.Window = new(guipb.Widget) + pb.Window.Id = int64(win.id) + pb.Window.Name = pb.Title + + grid := addNode() + pb.Grid = new(guipb.Widget) + pb.Grid.Id = int64(grid.id) + for i, r := range pb.StringRows { + log.Info("gui: got string row:", pb.Title, i, r.Header, r.Vals) + for _, v := range r.Vals { + label := addNode() + pbwidget := new(guipb.Widget) + pbwidget.Id = int64(label.id) + pbwidget.Name = v + r.WidgetS = append(r.WidgetS, pbwidget) + log.Info("gui: added new WidgetS", pbwidget) + } + } + for i, r := range pb.IntRows { + log.Info("gui: got int row:", i, r.Header, r.Vals) + } } + +/* +func (t *NodeTable) ShowTable(pb *guipb.Table) { + log.Info("gui.ShowTable") + // make a new action and populate the current node state + a := getNewAction(t.n, widget.Show) + a.TablePB, err = nt.Marshal() + if err != nil { + log.Info("unmarshal error", err) + return + } + log.Info("send action to plugin", t.n.label, "pb len =", len(a.TablePB)) + sendActionToPlugin(a) +} +*/ |
