remove old action function

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-05 12:27:22 -06:00
parent 75e7070077
commit 6454e540d0
2 changed files with 1 additions and 85 deletions

View File

@ -26,7 +26,7 @@ func init() {
me.myTree = tree.New()
me.myTree.PluginName = "gocui"
// me.myTree.ActionFromChannel = action
me.myTree.NodeAction = newaction
me.myTree.Add = newAdd
me.myTree.SetTitle = newSetTitle

View File

@ -118,90 +118,6 @@ func newaction(n *tree.Node, atype widget.ActionType) {
log.Log(INFO, "newaction() END", atype, n.String())
}
func action(a widget.Action) {
log.Log(INFO, "action() IGNORE", a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
return
// n := me.rootNode.findWidgetId(a.WidgetId)
n := me.treeRoot.FindWidgetId(a.WidgetId)
var w *guiWidget
if n != nil {
w = n.TK.(*guiWidget)
}
switch a.ActionType {
case widget.Add:
if w == nil {
n := me.myTree.AddNode(&a)
if n == nil {
log.Warn("WTF")
panic("WTF")
}
n.TK = initWidget(n)
if n.WidgetType == widget.Root {
me.treeRoot = n
}
addWidget(n)
w = n.TK.(*guiWidget)
if w.enable {
// don't change the color
} else {
w.setColor(&colorDisabled)
}
w.Show()
} else {
// this is done to protect the plugin being 'refreshed' with the
// widget binary tree. TODO: find a way to keep them in sync
log.Log(ERROR, "action() Add ignored for already defined widget",
a.WidgetId, a.ActionType, a.WidgetType, a.ProgName)
}
case widget.Show:
log.Log(NOW, "Show() HERE. a.Hidden() was =", a.State.Hidden)
w.Show()
case widget.Hide:
log.Log(NOW, "Hide() HERE. a.State.Hidden was =", a.State.Hidden)
w.Hide()
case widget.Set:
if a.WidgetType == widget.Flag {
log.Log(NOW, "TODO: set flag here", a.ActionType, a.WidgetType, a.ProgName)
log.Log(NOW, "TODO: n.WidgetType =", n.WidgetType, "n.String() =", a.ProgName)
} else {
if a.Value == nil {
log.Log(ERROR, "TODO: Set here. a == nil id =", a.WidgetId, "type =", a.WidgetType, "Name =", a.ProgName)
log.Log(ERROR, "TODO: Set here. id =", a.WidgetId, "n.String() =", n.String())
} else {
w.Set(a.Value)
}
}
case widget.SetText:
w.SetText(widget.GetString(a.Value))
case widget.AddText:
w.AddText(widget.GetString(a.Value))
case widget.Move:
log.Log(NOW, "attempt to move() =", a.ActionType, a.WidgetType, a.ProgName)
case widget.ToolkitClose:
log.Log(NOW, "attempting to close the plugin and release stdout and stderr")
standardClose()
case widget.Enable:
w.enable = true
w.enableColor()
case widget.Disable:
w.enable = false
w.disableColor()
case widget.Delete:
if w == nil {
return
} else {
w.hideWidgets()
w.deleteNode()
}
n.DeleteNode()
wRoot := me.treeRoot.TK.(*guiWidget)
wRoot.redoWindows(0, 0)
default:
log.Log(ERROR, "action() UNKNOWN Action Type =", a.ActionType, "WidgetType =", a.WidgetType, "Name =", a.ProgName)
}
log.Log(INFO, "action() END")
}
func (w *guiWidget) deleteGocuiViews() {
if w.v == nil {
// no gocui view to delete for this widget