diff --git a/Makefile b/Makefile index c5ba527..ac55485 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,16 @@ -redomod: +all: + @echo + @echo "Run: make redomod # to remake the go files" + @echo + +redomod: goimports rm -f go.* GO111MODULE= go mod init GO111MODULE= go mod tidy +goimports: + goimports -w *.go + download: go get -v go.wit.com/toolkits/debian go get -v go.wit.com/toolkits/tree diff --git a/addNode.go b/addNode.go index 660ddae..2db130c 100644 --- a/addNode.go +++ b/addNode.go @@ -1,8 +1,6 @@ package tree import ( - "errors" - "go.wit.com/log" "go.wit.com/widget" ) @@ -35,9 +33,9 @@ func (me *TreeInfo) AddNode(a *widget.Action) *Node { p := me.treeRoot.FindWidgetId(a.ParentId) n.Parent = p if n.Parent == nil { - log.Error(errors.New("tree.AddNode() ERROR n.Parent == nil"), a.WidgetId, a.ParentId, a.ActionType) - log.Warn("AddNode() ERROR n.Parent == nil", a.WidgetId, a.ParentId, a.ActionType) - log.Warn("AddNode() ERROR n.Parent == nil", a.WidgetId, a.ParentId, a.WidgetType) + log.Log(TREEWARN, "AddNode() ERROR n.Parent == nil n =", n.WidgetId, n.WidgetType, n.GetProgName()) + log.Log(TREEWARN, "AddNode() ERROR n.Parent == nil a =", a.WidgetId, a.WidgetType, a.State.ProgName) + log.Log(TREEWARN, "AddNode() ERROR n.Parent == nil a.pid =", a.ParentId) return n } log.Log(TREE, "AddNode() Adding to parent =", p.ParentId, p.WidgetType, p.GetProgName()) diff --git a/flags.go b/flags.go index 4e6fda4..dca154a 100644 --- a/flags.go +++ b/flags.go @@ -5,9 +5,11 @@ import ( ) var TREE *log.LogFlag +var TREEWARN *log.LogFlag func init() { full := "go.wit.com/gui" short := "tree" TREE = log.NewFlag("TREE", false, full, short, "treeRoot info") + TREEWARN = log.NewFlag("TREEWARN", true, full, short, "treeRoot warnings") } diff --git a/init.go b/init.go index 66dc673..79f7241 100644 --- a/init.go +++ b/init.go @@ -24,24 +24,14 @@ func (me *TreeInfo) catchActionChannel() { select { case a := <-me.pluginChan: log.Verbose("catchActionChannel() on ", a.WidgetId, a.WidgetType, a.ProgName) - // log.Warn("catchActionChannel() STUFF", a.WidgetId, a.ActionType, a.WidgetType) - /* - if a.WidgetType == widget.Dropdown { - log.Warn("Found dropdown", a.WidgetId, a.ActionType, a.WidgetType) - for i, s := range a.State.Strings { - log.Warn("a.State.Strings =", i, s) - } - } - */ muAction.Lock() - // send this to the toolkit if me.ActionFromChannel == nil { log.Error(errors.New("toolkit ActionFromChannel == nil"), a.WidgetId, a.ActionType, a.WidgetType) } else { + // send this to the toolkit me.ActionFromChannel(a) } muAction.Unlock() - // log.Log(TREE, "catchActionChannel() STUFF END", a.WidgetId, a.ActionType, a.WidgetType) } } } @@ -51,9 +41,9 @@ func New() *TreeInfo { me.pluginChan = make(chan widget.Action, 1) /* - full := "go.wit.com/gui" - short := "gui" - TREE = log.NewFlag("TREE", true, full, short, "treeRoot info") + full := "go.wit.com/gui" + short := "gui" + TREE = log.NewFlag("TREE", true, full, short, "treeRoot info") */ log.Log(TREE, "Init() start channel reciever")