initOnce()
This commit is contained in:
parent
8c459da9f7
commit
fa9ec36dbb
|
@ -5,6 +5,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/awesome-gocui/gocui"
|
"github.com/awesome-gocui/gocui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -53,6 +54,10 @@ func registerHandlers(g *gocui.Gui) {
|
||||||
g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse
|
g.SetKeybinding("", 'f', gocui.ModNone, theFind) // 'f' shows what is under your mouse
|
||||||
g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons
|
g.SetKeybinding("", 'd', gocui.ModNone, theLetterD) // 'd' toggles on and off debugging buttons
|
||||||
g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?)
|
g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?)
|
||||||
|
|
||||||
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
// tell 'tree' that we are okay to start talking to
|
||||||
|
me.myTree.InitOK()
|
||||||
}
|
}
|
||||||
|
|
||||||
// flips on 'super mouse' mode // this was awesome for debugging gocui. never remove this code.
|
// flips on 'super mouse' mode // this was awesome for debugging gocui. never remove this code.
|
||||||
|
|
2
init.go
2
init.go
|
@ -30,7 +30,7 @@ func toolkitClose() {
|
||||||
|
|
||||||
// sets defaults and establishes communication
|
// sets defaults and establishes communication
|
||||||
// to this toolkit from the wit/gui golang package
|
// to this toolkit from the wit/gui golang package
|
||||||
func init() {
|
func initPlugin() {
|
||||||
log.Log(INFO, "Init() of awesome-gocui")
|
log.Log(INFO, "Init() of awesome-gocui")
|
||||||
|
|
||||||
// init the config struct default values
|
// init the config struct default values
|
||||||
|
|
|
@ -22,6 +22,8 @@ import (
|
||||||
"go.wit.com/toolkits/tree"
|
"go.wit.com/toolkits/tree"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var initOnce sync.Once
|
||||||
|
|
||||||
// It's probably a terrible idea to call this 'me'
|
// It's probably a terrible idea to call this 'me'
|
||||||
// 2025 note: doesn't seem terrible to call this 'me' anymore. notsure.
|
// 2025 note: doesn't seem terrible to call this 'me' anymore. notsure.
|
||||||
var me config
|
var me config
|
||||||
|
|
|
@ -48,6 +48,7 @@ func Callback(guiCallback chan widget.Action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func PluginChannel() chan widget.Action {
|
func PluginChannel() chan widget.Action {
|
||||||
|
initOnce.Do(initPlugin)
|
||||||
return me.myTree.PluginChannel()
|
return me.myTree.PluginChannel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue