summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-07 08:47:06 -0600
committerJeff Carr <[email protected]>2024-02-07 08:47:06 -0600
commit2d0c73f58e68d34cbd2ab85ba82507d159da28de (patch)
treeeed9475503049dfb1176fe12c4c07f0b94337cda /main.go
parent2aed14a60cbb9208f8f9a507c83a3dd297a93640 (diff)
use internal log flagsv0.20.1
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
-rw-r--r--main.go40
1 files changed, 23 insertions, 17 deletions
diff --git a/main.go b/main.go
index 868879d..c2cfa1b 100644
--- a/main.go
+++ b/main.go
@@ -66,27 +66,27 @@ func watchCallback() {
// 99.9% of events are just widget changes
n := me.rootNode.findId(a.WidgetId)
if n != nil {
- log.Verbose("guiChan() FOUND widget id =", n.id, n.progname)
+ log.Log(INFO, "guiChan() FOUND widget id =", n.id, n.progname)
n.gotUserEvent(a)
break
}
// if not a widget change, something more bizare
if a.ActionType == widget.UserQuit {
- log.Warn("guiChan() User sent Quit()")
+ log.Log(WARN, "guiChan() User sent Quit()")
log.Exit("wit/gui toolkit.UserQuit")
break
}
if a.ActionType == widget.ToolkitPanic {
- log.Warn("guiChan() Toolkit panic() in", a.ProgName)
- log.Warn("guiChan() unload toolkit plugin here", a.ProgName)
+ log.Log(WARN, "guiChan() Toolkit panic() in", a.ProgName)
+ log.Log(WARN, "guiChan() unload toolkit plugin here", a.ProgName)
me.rootNode.ListToolkits()
for _, aplug := range allPlugins {
- log.Warn("ListToolkits() already loaded toolkit plugin =", aplug.name)
+ log.Log(WARN, "ListToolkits() already loaded toolkit plugin =", aplug.name)
if aplug.name == a.ProgName {
- log.Warn("FOUND PLUGIN =", aplug.name)
- log.Warn("unload here")
- log.Warn("panic on purpose")
+ log.Log(WARN, "FOUND PLUGIN =", aplug.name)
+ log.Log(WARN, "unload here")
+ log.Log(WARN, "panic on purpose")
me.rootNode.CloseToolkit(aplug.name)
// panic("panic trapped!")
// log.Sleep(.5)
@@ -101,21 +101,21 @@ func watchCallback() {
}
if a.ActionType == widget.ToolkitLoad {
newPlug := widget.GetString(a.Value)
- log.Warn("Attempt to load a new toolkit", newPlug, "here")
+ log.Log(WARN, "Attempt to load a new toolkit", newPlug, "here")
me.rootNode.LoadToolkit(newPlug)
}
if a.ActionType == widget.EnableDebug {
- log.Warn("guiChan() Enable Debugging Window")
- log.Warn("guiChan() TODO: not implemented")
- log.Warn("guiChan() Listing Toolkits:")
+ log.Log(WARN, "guiChan() Enable Debugging Window")
+ log.Log(WARN, "guiChan() TODO: not implemented")
+ log.Log(WARN, "guiChan() Listing Toolkits:")
PLUG.SetBool(true)
me.rootNode.ListToolkits()
me.rootNode.ListChildren(true)
/*
for i, aplug := range allPlugins {
- log.Warn("plug =", i, aplug.name)
+ log.Log("plug =", i, aplug.name)
if aplug.name == "andlabs" {
- log.Warn("Found plug =", i, aplug.name)
+ log.Log("Found plug =", i, aplug.name)
//closePlugin(aplug)
allPlugins = allPlugins[1:]
}
@@ -123,7 +123,7 @@ func watchCallback() {
*/
break
}
- log.Warn("guiChan() Action could not be found or handled", a.ActionType, a)
+ log.Log(WARN, "guiChan() Action could not be found or handled", a.ActionType, a)
}
}
}
@@ -137,6 +137,12 @@ func (n *Node) gotUserEvent(a widget.Action) {
log.Log(CHANGE, "gotUserEvent() received event node =", n.id, n.progname, a.Value)
switch n.WidgetType {
+ case widget.Dropdown:
+ // n.checked = a.State.Checked // TODO: do this and/or time to switch to protobuf
+ n.currentS = a.State.CurrentS
+ case widget.Combobox:
+ // n.checked = a.State.Checked // TODO: do this and/or time to switch to protobuf
+ n.currentS = a.State.CurrentS
case widget.Checkbox:
// n.checked = a.State.Checked // TODO: do this and/or time to switch to protobuf
n.checked = a.State.Checked
@@ -163,14 +169,14 @@ func New() *Node {
// try to load andlabs, if that doesn't work, fall back to the console
func (n *Node) Default() *Node {
if argGui.GuiPlugin != "" {
- log.Warn("New.Default() try toolkit =", argGui.GuiPlugin)
+ log.Log(WARN, "New.Default() try toolkit =", argGui.GuiPlugin)
return n.LoadToolkit(argGui.GuiPlugin)
}
// if DISPLAY isn't set, return since gtk can't load
// TODO: figure out how to check what to do in macos and mswindows
if os.Getenv("DISPLAY") == "" {
if n.LoadToolkit("gocui") == nil {
- log.Warn("New() failed to load gocui")
+ log.Log(WARN, "New() failed to load gocui")
}
return n
}