attempting to force the "Running..." box in the corner
This commit is contained in:
parent
6ea6ffaa3d
commit
6df064282c
|
@ -81,7 +81,7 @@ func doMouseClick(w int, h int) {
|
|||
tk.showDropdown()
|
||||
return
|
||||
case widget.Textbox:
|
||||
tk.showTextbox()
|
||||
tk.prepTextbox()
|
||||
return
|
||||
default:
|
||||
// TODO: enable the GUI debugger in gocui
|
||||
|
|
10
plugin.go
10
plugin.go
|
@ -229,9 +229,15 @@ func (tk *guiWidget) Disable() {
|
|||
// log.Info("disable widget in gocui", tk.node.WidgetType, tk.node.ProgName())
|
||||
switch tk.node.WidgetType {
|
||||
case widget.Box:
|
||||
tk.labelN = "Running..."
|
||||
// log.Info("todo: blank out the window here", tk.String())
|
||||
tk.showTextbox()
|
||||
r := new(rectType)
|
||||
// startW, startH := tk.Position()
|
||||
r.w0 = 0
|
||||
r.h0 = 0
|
||||
r.w1 = r.w0 + 24
|
||||
r.h1 = r.h0 + 2
|
||||
me.textbox.tk.forceSizes(r)
|
||||
showTextbox("Running...")
|
||||
return
|
||||
case widget.Button:
|
||||
tk.setColorDisable()
|
||||
|
|
18
textbox.go
18
textbox.go
|
@ -29,7 +29,7 @@ func (tk *guiWidget) forceSizes(r *rectType) {
|
|||
tk.force.h1 = r.h1
|
||||
}
|
||||
|
||||
func (callertk *guiWidget) showTextbox() {
|
||||
func (callertk *guiWidget) prepTextbox() {
|
||||
if me.textbox.tk == nil {
|
||||
// should only happen once
|
||||
me.textbox.tk = makeNewFlagWidget(me.textbox.wId)
|
||||
|
@ -40,7 +40,6 @@ func (callertk *guiWidget) showTextbox() {
|
|||
return
|
||||
}
|
||||
|
||||
// tk := me.textbox.tk
|
||||
r := new(rectType)
|
||||
// startW, startH := tk.Position()
|
||||
r.w0 = callertk.gocuiSize.w0 + 4
|
||||
|
@ -50,6 +49,15 @@ func (callertk *guiWidget) showTextbox() {
|
|||
me.textbox.tk.forceSizes(r)
|
||||
// me.textbox.tk.dumpWidget("after sizes")
|
||||
|
||||
me.textbox.callerTK = callertk
|
||||
|
||||
showTextbox(callertk.String())
|
||||
}
|
||||
|
||||
func showTextbox(callertk string) {
|
||||
// tk := me.textbox.tk
|
||||
// me.textbox.tk.dumpWidget("after sizes")
|
||||
|
||||
me.textbox.tk.Show() // actually makes the gocui view. TODO: redo this
|
||||
|
||||
if me.textbox.tk.v == nil {
|
||||
|
@ -59,13 +67,14 @@ func (callertk *guiWidget) showTextbox() {
|
|||
|
||||
me.textbox.tk.setColorModal()
|
||||
me.textbox.tk.v.Clear()
|
||||
cur := strings.TrimSpace(callertk.String())
|
||||
cur := strings.TrimSpace(callertk)
|
||||
// log.Info("setting textbox string to:", cur)
|
||||
me.textbox.tk.v.WriteString(cur)
|
||||
|
||||
me.textbox.tk.v.Editable = true
|
||||
me.textbox.tk.v.Wrap = true
|
||||
|
||||
r := me.textbox.tk.gocuiSize
|
||||
me.baseGui.SetView(me.textbox.tk.cuiName, r.w0, r.h0, r.w1, r.h1, 0)
|
||||
me.baseGui.SetCurrentView(me.textbox.tk.v.Name())
|
||||
|
||||
|
@ -73,9 +82,8 @@ func (callertk *guiWidget) showTextbox() {
|
|||
me.baseGui.SetKeybinding(me.textbox.tk.v.Name(), gocui.KeyEnter, gocui.ModNone, theCloseTheTextbox)
|
||||
|
||||
me.textbox.active = true
|
||||
me.textbox.callerTK = callertk
|
||||
|
||||
// tk.dumpWidget("showTextbox()")
|
||||
// me.textbox.dumpWidget("showTextbox()")
|
||||
}
|
||||
|
||||
func theCloseTheTextbox(g *gocui.Gui, v *gocui.View) error {
|
||||
|
|
Loading…
Reference in New Issue