tinkering
This commit is contained in:
parent
f2a296064e
commit
676b3a8548
|
@ -57,13 +57,13 @@ func (n *Node) Hidden() bool {
|
|||
}
|
||||
|
||||
/* avoid this function name as confusing
|
||||
func (n *Node) GetText() string {
|
||||
func (n *Node) GetText() string { // BAD
|
||||
return widget.GetString(n.State.Value)
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (n *Node) SetValue(a any) {
|
||||
func (n *Node) SetValue(a any) { // BAD
|
||||
n.State.Value = a
|
||||
}
|
||||
*/
|
||||
|
|
21
debug.go
21
debug.go
|
@ -1,6 +1,8 @@
|
|||
package tree
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/widget"
|
||||
)
|
||||
|
@ -20,7 +22,24 @@ func (n *Node) ShowButtons() {
|
|||
}
|
||||
|
||||
func (n *Node) DumpWidget(pad string) {
|
||||
log.Log(TREEWARN, "node:", pad, n.WidgetId, ",", n.WidgetType, ",", n.GetProgName())
|
||||
s := n.GetProgName()
|
||||
if s == "" {
|
||||
s = n.CurrentS()
|
||||
}
|
||||
if s == "" {
|
||||
s = n.String()
|
||||
}
|
||||
if s == "" {
|
||||
s = n.ProgName()
|
||||
}
|
||||
if s == "" {
|
||||
s = n.GetLabel()
|
||||
}
|
||||
if s == "" {
|
||||
s = n.State.NewString
|
||||
}
|
||||
end := fmt.Sprintf("%d,%-9s .%s.", n.WidgetId, n.WidgetType, s)
|
||||
log.Log(TREEWARN, "node:", pad, end)
|
||||
}
|
||||
|
||||
var depth int = 0
|
||||
|
|
17
init.go
17
init.go
|
@ -1,7 +1,10 @@
|
|||
// Although most code from WIT.COM Inc is under the GPL
|
||||
// This code is more generic because it must be able
|
||||
// to be used in any GUI plugin
|
||||
|
||||
package tree
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
"sync"
|
||||
|
@ -80,8 +83,8 @@ func (me *TreeInfo) newAction(a widget.Action) {
|
|||
func (me *TreeInfo) catchActionChannel() {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel()", r)
|
||||
log.Log(TREEWARN, "YAHOOOO Recovered in tree.catchActionChannel() Plugin:", me.PluginName)
|
||||
log.Log(TREEWARN, "YAHOOOO. Recovered in tree.catchActionChannel()", r)
|
||||
log.Log(TREEWARN, "YAHOOOO. Recovered in tree.catchActionChannel() Plugin:", me.PluginName)
|
||||
me.SendToolkitPanic()
|
||||
debug.PrintStack()
|
||||
me.ToolkitClose()
|
||||
|
@ -97,13 +100,7 @@ func (me *TreeInfo) catchActionChannel() {
|
|||
case a := <-me.pluginChan:
|
||||
log.Verbose("catchActionChannel() on ", a.WidgetId, a.WidgetType, a.ProgName)
|
||||
muAction.Lock()
|
||||
if me.newAction == nil {
|
||||
log.Error(errors.New("toolkit newAction == nil"), a.WidgetId, a.ActionType, a.WidgetType)
|
||||
} else {
|
||||
// send this to the toolkit
|
||||
me.newAction(a)
|
||||
// me.ActionFromChannel(a)
|
||||
}
|
||||
me.newAction(a)
|
||||
muAction.Unlock()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import (
|
|||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
// TODO: use protocol buffers
|
||||
|
||||
// this is the root node of the binary tree
|
||||
// There is only one of these per application
|
||||
var treeRoot *Node
|
||||
|
|
Loading…
Reference in New Issue