add Disable() and Enable()
This commit is contained in:
parent
1e79d31a02
commit
1f33979af9
16
init.go
16
init.go
|
@ -208,6 +208,17 @@ func waitOK() {
|
|||
}
|
||||
}
|
||||
|
||||
// this hack is to wait for the application to send something
|
||||
// before trying to do anything. todo: rethink this someday
|
||||
func waitFirstWindow() {
|
||||
for {
|
||||
if me.firstWindowOk {
|
||||
return
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
// empty function. this triggers gocui to refresh the screen
|
||||
func testRefresh(*gocui.Gui) error {
|
||||
// log.Info("in testRefresh")
|
||||
|
@ -279,10 +290,15 @@ func newWindowTrigger() {
|
|||
waitOK()
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
redoWindows(3, 3)
|
||||
me.firstWindowOk = true
|
||||
if !me.stdout.init {
|
||||
me.stdout.init = true
|
||||
relocateStdoutOffscreen()
|
||||
}
|
||||
if me.textbox.tk == nil {
|
||||
initTextbox()
|
||||
me.textbox.tk.prepTextbox()
|
||||
}
|
||||
tk.makeWindowActive()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ type config struct {
|
|||
myTree *tree.TreeInfo // ?
|
||||
currentWindow *guiWidget // this is the current tab or window to show
|
||||
ok bool // if the user doesn't hit a key or move the mouse, gocui doesn't really start
|
||||
firstWindowOk bool // allows the init to wait for the first window from the application
|
||||
ctrlDown *tree.Node // shown if you click the mouse when the ctrl key is pressed
|
||||
helpLabel *gocui.View // ?
|
||||
showHelp bool // toggle boolean for the help menu (deprecate?)
|
||||
|
|
11
table.go
11
table.go
|
@ -6,8 +6,19 @@ package main
|
|||
import (
|
||||
"go.wit.com/lib/protobuf/guipb"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
)
|
||||
|
||||
func showTable(t *guipb.Table) {
|
||||
log.Info("should show table here")
|
||||
}
|
||||
|
||||
func enableWidget(n *tree.Node) {
|
||||
tk := n.TK.(*guiWidget)
|
||||
tk.Enable()
|
||||
}
|
||||
|
||||
func disableWidget(n *tree.Node) {
|
||||
tk := n.TK.(*guiWidget)
|
||||
tk.Disable()
|
||||
}
|
||||
|
|
|
@ -60,6 +60,10 @@ func initTree() *tree.TreeInfo {
|
|||
t.SetLabel = setLabel
|
||||
t.SetText = setText
|
||||
t.AddText = addText
|
||||
|
||||
t.Enable = enableWidget
|
||||
t.Disable = disableWidget
|
||||
|
||||
t.SetChecked = setChecked
|
||||
t.ToolkitClose = toolkitClose
|
||||
t.ShowTable = showTable
|
||||
|
|
Loading…
Reference in New Issue