Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
1127b96570 | |
|
308543c02c | |
|
d141b4d308 |
|
@ -38,9 +38,9 @@ func addNode(a *widget.Action) *Node {
|
||||||
}
|
}
|
||||||
|
|
||||||
if treeRoot.FindWidgetId(a.WidgetId) != nil {
|
if treeRoot.FindWidgetId(a.WidgetId) != nil {
|
||||||
log.Log(TREEWARN, "AddNode() WidgetId already exists", a.WidgetId)
|
// ignore these errors for now
|
||||||
log.Log(TREEWARN, "probably this is a Show() / Hide() issue")
|
log.Log(TREE, "AddNode() WidgetId already exists", a.WidgetId)
|
||||||
log.Log(TREEWARN, "TODO: figure out what to do here")
|
log.Log(TREE, "TODO: figure out what to do here probably this is a Show() / Hide() issue")
|
||||||
return treeRoot.FindWidgetId(a.WidgetId)
|
return treeRoot.FindWidgetId(a.WidgetId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
find.go
4
find.go
|
@ -10,6 +10,10 @@ func FindWidgetId(id int) *Node {
|
||||||
return treeRoot.FindWidgetId(id)
|
return treeRoot.FindWidgetId(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func FindWidgetById(id int) *Node {
|
||||||
|
return treeRoot.FindWidgetId(id)
|
||||||
|
}
|
||||||
|
|
||||||
// searches the binary tree for a WidgetId
|
// searches the binary tree for a WidgetId
|
||||||
func (n *Node) FindWidgetId(id int) *Node {
|
func (n *Node) FindWidgetId(id int) *Node {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
|
|
25
init.go
25
init.go
|
@ -68,7 +68,30 @@ func (t *TreeInfo) ConfigFind(n string) (string, error) {
|
||||||
if n == r.Name {
|
if n == r.Name {
|
||||||
return r.Value, nil
|
return r.Value, nil
|
||||||
}
|
}
|
||||||
log.Info("toolkit config", r.Plugin, r.Name, r.Value, n)
|
// log.Info("toolkit config no-match on", r.Plugin, r.Name, r.Value, n)
|
||||||
}
|
}
|
||||||
return "", fmt.Errorf("toolkit config %s not found", n)
|
return "", fmt.Errorf("toolkit config %s not found", n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *TreeInfo) ConfigSave(o *ToolkitConfig) {
|
||||||
|
t.configInsert(o)
|
||||||
|
t.config.configSave()
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the config option value (or append if new record)
|
||||||
|
func (t *TreeInfo) configInsert(newr *ToolkitConfig) {
|
||||||
|
all := t.config.All() // get the list of repos
|
||||||
|
for all.Scan() {
|
||||||
|
r := all.Next()
|
||||||
|
if t.PluginName != r.Plugin {
|
||||||
|
// option isn't for this plugin
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if newr.Name == r.Name {
|
||||||
|
// found the record!
|
||||||
|
r.Value = newr.Value
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
t.config.Append(newr)
|
||||||
|
}
|
||||||
|
|
17
table.go
17
table.go
|
@ -200,6 +200,7 @@ func (me *TreeInfo) makeTable(t *guipb.Table) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
me.Add(grid)
|
me.Add(grid)
|
||||||
|
grid.State.ProgName = "TableGridPB"
|
||||||
// log.Info("tree: makeTable() finished add win & grid")
|
// log.Info("tree: makeTable() finished add win & grid")
|
||||||
var h int = 0
|
var h int = 0
|
||||||
var w int = 0
|
var w int = 0
|
||||||
|
@ -307,6 +308,22 @@ func (me *TreeInfo) addTableRow(t *guipb.Table, grid *Node, name string, w int)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if widget is in a table
|
||||||
|
func (n *Node) InTable() bool {
|
||||||
|
// log.Info("InTable() parent id =", n.ParentId)
|
||||||
|
grid := FindWidgetById(int(n.ParentId))
|
||||||
|
if grid != nil {
|
||||||
|
if grid.WidgetType == widget.Grid {
|
||||||
|
if grid.State.ProgName == "TableGridPB" {
|
||||||
|
// this is a protobuf table
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func dumpTable(t *guipb.Table) {
|
func dumpTable(t *guipb.Table) {
|
||||||
for i, o := range t.Order {
|
for i, o := range t.Order {
|
||||||
log.Info("got order:", t.Title, i, o)
|
log.Info("got order:", t.Title, i, o)
|
||||||
|
|
|
@ -7,8 +7,8 @@ package forgepb;
|
||||||
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
|
||||||
|
|
||||||
message ToolkitConfig { //
|
message ToolkitConfig { //
|
||||||
string plugin = 1; // 'gocui', 'andlabs', etc
|
string plugin = 1; // 'gocui', 'andlabs', etc `autogenpb:unique`
|
||||||
string name = 2; // variable name 'fullscreen'
|
string name = 2; // variable name 'fullscreen' `autogenpb:unique`
|
||||||
string value = 3; // value "true"
|
string value = 3; // value "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue