Compare commits
No commits in common. "guimaster" and "v0.22.34" have entirely different histories.
|
@ -5,4 +5,3 @@
|
|||
go.mod
|
||||
go.sum
|
||||
gocui
|
||||
resources/*.so
|
||||
|
|
2
Makefile
2
Makefile
|
@ -25,7 +25,7 @@ custom:
|
|||
clean:
|
||||
rm -f gocui *.so go.*
|
||||
rm -f *.pb.go *.patch
|
||||
go-mod-clean purge
|
||||
go-mod-clean --purge
|
||||
|
||||
# Test the README.md & doc.go file
|
||||
# this runs pkgsite, the binary that does dev.go.dev
|
||||
|
|
23
color.go
23
color.go
|
@ -186,27 +186,6 @@ func (tk *guiWidget) setColorLabel() {
|
|||
tk.updateColor()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorLabelTable() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
if me.dark {
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorWhite
|
||||
tk.color.bg = gocui.ColorBlack
|
||||
tk.color.selFg = gocui.ColorWhite
|
||||
tk.color.selBg = gocui.AttrNone
|
||||
} else {
|
||||
tk.color.frame = gocui.AttrNone
|
||||
tk.color.fg = gocui.ColorBlack
|
||||
tk.color.bg = gocui.AttrNone
|
||||
tk.color.selFg = gocui.AttrNone
|
||||
tk.color.selBg = gocui.ColorGreen
|
||||
}
|
||||
|
||||
tk.updateColor()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorButtonDense() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
|
@ -228,7 +207,7 @@ func (tk *guiWidget) setColorButtonDense() {
|
|||
tk.updateColor()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) setColorNotifyIcon() {
|
||||
func (tk *guiWidget) setColorNotifyMenu() {
|
||||
if tk.color == nil {
|
||||
tk.color = new(colorT)
|
||||
}
|
||||
|
|
4
debug.go
4
debug.go
|
@ -86,10 +86,6 @@ func (tk *guiWidget) dumpWidget(s string) {
|
|||
} else {
|
||||
end = fmt.Sprintf("%-8s %-8s %s", tk.WidgetType(), tk.cuiName, tk.String())
|
||||
}
|
||||
if tk.node.InTable() {
|
||||
// log.Log(GOCUI, "findParentTAble()", tk.labelN, tk.cuiName, tk.node.WidgetId)
|
||||
end += " (table)"
|
||||
}
|
||||
log.Log(GOCUI, s1, s, end)
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,6 @@ func registerHandlers(g *gocui.Gui) {
|
|||
g.SetKeybinding("", 'L', gocui.ModNone, printWidgetTree) // 'L' list all widgets in tree view
|
||||
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("", 'r', gocui.ModNone, reverseStdout) // 'r' turns scrolling of STDOUT upside down
|
||||
g.SetKeybinding("", 'q', gocui.ModNone, quit) // 'q' only exits gocui. plugin stays alive (?)
|
||||
}
|
||||
|
||||
|
@ -79,8 +78,6 @@ func theSuperMouse(g *gocui.Gui, v *gocui.View) error {
|
|||
func theNotsure(g *gocui.Gui, v *gocui.View) error {
|
||||
log.Info("got to theNotsure(). now what? dark =", me.dark)
|
||||
me.refresh = true
|
||||
log.Info("running VerifyParentId()")
|
||||
me.treeRoot.VerifyParentId()
|
||||
/*
|
||||
if me.debug {
|
||||
log.Info("debugging off")
|
||||
|
@ -104,20 +101,28 @@ func theDarkness(g *gocui.Gui, v *gocui.View) error {
|
|||
log.Info("you have seen the light")
|
||||
} else {
|
||||
me.dark = true
|
||||
log.Info("you have entered into darkness (you may need to trigger SIGWINCH)")
|
||||
log.Info("or maybe open a new window. notsure. This obviously isn't finished.")
|
||||
log.Info("submit patches to this and you will definitely get free cloud credits at WIT")
|
||||
log.Info("you have entered into darkness")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func wheelsUp(g *gocui.Gui, v *gocui.View) error {
|
||||
stdoutWheelsUp()
|
||||
// log.Info("private wheels up")
|
||||
me.stdout.pager -= 2
|
||||
if me.stdout.pager < 0 {
|
||||
me.stdout.pager = 0
|
||||
}
|
||||
me.stdout.tk.refreshStdout()
|
||||
return nil
|
||||
}
|
||||
|
||||
func wheelsDown(g *gocui.Gui, v *gocui.View) error {
|
||||
stdoutWheelsDown()
|
||||
// log.Info("you've landed")
|
||||
me.stdout.pager += 2
|
||||
if me.stdout.pager > len(me.stdout.outputS) {
|
||||
me.stdout.pager = len(me.stdout.outputS)
|
||||
}
|
||||
me.stdout.tk.refreshStdout()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -141,13 +146,11 @@ func doEsc(g *gocui.Gui, v *gocui.View) error {
|
|||
me.dropdown.tk.Hide()
|
||||
me.dropdown.active = false
|
||||
log.Info("escaped from dropdown")
|
||||
me.baseGui.SetCurrentView(me.notify.clock.tk.cuiName)
|
||||
}
|
||||
if me.textbox.active {
|
||||
me.textbox.tk.Hide()
|
||||
me.textbox.active = false
|
||||
log.Info("escaped from textbox")
|
||||
me.baseGui.SetCurrentView(me.notify.clock.tk.cuiName)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -185,19 +188,6 @@ func theFind(g *gocui.Gui, v *gocui.View) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func reverseStdout(g *gocui.Gui, v *gocui.View) error {
|
||||
if me.stdout.reverse {
|
||||
me.stdout.reverse = false
|
||||
log.Info("stdout scrolling normal")
|
||||
} else {
|
||||
me.stdout.reverse = true
|
||||
log.Info("stdout scrolling is reversed. this is sometimes useful when you")
|
||||
log.Info("only need to see a few most recent lines and have the STDOUT window")
|
||||
log.Info("take up minimal realestate at the bottom of your window")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// is run whenever anyone hits 'd' (in an open space)
|
||||
func theLetterD(g *gocui.Gui, v *gocui.View) error {
|
||||
// widgets that don't have physical existance in
|
||||
|
|
|
@ -8,14 +8,12 @@ import (
|
|||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
)
|
||||
|
||||
func theStdout(g *gocui.Gui, v *gocui.View) error {
|
||||
// me.stdout.pager = 0
|
||||
infos := fmt.Sprintf("pager=%d len(%d) ", me.stdout.pager, len(me.stdout.outputS))
|
||||
infos += fmt.Sprintf("last(%d,%d)", me.stdout.lastW, me.stdout.lastH)
|
||||
me.stdout.changed = true
|
||||
|
||||
if me.stdout.outputOnTop {
|
||||
if me.stdout.outputOffscreen {
|
||||
|
@ -24,38 +22,18 @@ func theStdout(g *gocui.Gui, v *gocui.View) error {
|
|||
me.stdout.lastW = me.stdout.tk.gocuiSize.w0
|
||||
me.stdout.lastH = me.stdout.tk.gocuiSize.h0
|
||||
relocateStdoutOffscreen()
|
||||
new1 := new(tree.ToolkitConfig)
|
||||
new1.Plugin = "gocui"
|
||||
new1.Name = "stdoutoffscreen"
|
||||
new1.Value = "true"
|
||||
me.myTree.ConfigSave(new1)
|
||||
return nil
|
||||
} else {
|
||||
me.stdout.outputOffscreen = true
|
||||
log.Info("stdout moved on screen", infos)
|
||||
new1 := new(tree.ToolkitConfig)
|
||||
new1.Plugin = "gocui"
|
||||
new1.Name = "stdoutoffscreen"
|
||||
new1.Value = "false"
|
||||
me.myTree.ConfigSave(new1)
|
||||
}
|
||||
// move the stdout window back onscreen
|
||||
me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
|
||||
me.stdout.outputOnTop = false
|
||||
setThingsOnTop()
|
||||
new1 := new(tree.ToolkitConfig)
|
||||
new1.Plugin = "gocui"
|
||||
new1.Name = "stdoutlevel"
|
||||
new1.Value = "bottom"
|
||||
me.myTree.ConfigSave(new1)
|
||||
} else {
|
||||
me.stdout.outputOnTop = true
|
||||
setThingsOnTop()
|
||||
new1 := new(tree.ToolkitConfig)
|
||||
new1.Plugin = "gocui"
|
||||
new1.Name = "stdoutlevel"
|
||||
new1.Value = "top"
|
||||
me.myTree.ConfigSave(new1)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -77,20 +55,14 @@ func stdoutHome(g *gocui.Gui, v *gocui.View) error {
|
|||
}
|
||||
|
||||
func stdoutArrowUp(g *gocui.Gui, v *gocui.View) error {
|
||||
if me.stdout.reverse {
|
||||
stdoutWheelsDown()
|
||||
} else {
|
||||
stdoutWheelsUp()
|
||||
}
|
||||
me.stdout.pager += 1
|
||||
me.stdout.tk.refreshStdout()
|
||||
return nil
|
||||
}
|
||||
|
||||
func stdoutArrowDown(g *gocui.Gui, v *gocui.View) error {
|
||||
if me.stdout.reverse {
|
||||
stdoutWheelsUp()
|
||||
} else {
|
||||
stdoutWheelsDown()
|
||||
}
|
||||
me.stdout.pager -= 1
|
||||
me.stdout.tk.refreshStdout()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -109,23 +81,3 @@ func stdoutPgdn(g *gocui.Gui, v *gocui.View) error {
|
|||
tk.refreshStdout()
|
||||
return nil
|
||||
}
|
||||
|
||||
// scrolling up with the mouse wheel (or trackpad)
|
||||
func stdoutWheelsUp() {
|
||||
// log.Info("private wheels up")
|
||||
me.stdout.pager -= 2
|
||||
if me.stdout.pager < 0 {
|
||||
me.stdout.pager = 0
|
||||
}
|
||||
me.stdout.tk.refreshStdout()
|
||||
}
|
||||
|
||||
// scrolling down with the mouse wheel (or trackpad)
|
||||
func stdoutWheelsDown() {
|
||||
// log.Info("you've landed")
|
||||
me.stdout.pager += 2
|
||||
if me.stdout.pager > len(me.stdout.outputS) {
|
||||
me.stdout.pager = len(me.stdout.outputS)
|
||||
}
|
||||
me.stdout.tk.refreshStdout()
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ package main
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
|
@ -40,36 +39,6 @@ func quit(g *gocui.Gui, v *gocui.View) error {
|
|||
return gocui.ErrQuit
|
||||
}
|
||||
|
||||
func (tk *guiWidget) SetView() error {
|
||||
if me.baseGui == nil {
|
||||
return fmt.Errorf("me.baseGui == nil")
|
||||
}
|
||||
|
||||
r := new(rectType)
|
||||
r.w0 = tk.gocuiSize.w0
|
||||
r.h0 = tk.gocuiSize.h0
|
||||
r.w1 = tk.gocuiSize.w1
|
||||
r.h1 = tk.gocuiSize.h1
|
||||
|
||||
return tk.SetViewRect(r)
|
||||
}
|
||||
|
||||
func (tk *guiWidget) SetViewRect(r *rectType) error {
|
||||
if me.baseGui == nil {
|
||||
return fmt.Errorf("me.baseGui == nil")
|
||||
}
|
||||
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName, r.w0, r.h0, r.w1, r.h1, 0)
|
||||
if err != nil {
|
||||
if !errors.Is(err, gocui.ErrUnknownView) {
|
||||
log.Log(ERROR, "SetView() global failed on name =", tk.cuiName)
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func SetView(name string, x0, y0, x1, y1 int, overlaps byte) *gocui.View {
|
||||
if me.baseGui == nil {
|
||||
log.Log(ERROR, "SetView() ERROR: me.baseGui == nil")
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/widget"
|
||||
)
|
||||
|
@ -27,7 +26,7 @@ func doMouseClick(w int, h int) {
|
|||
// can't drag or do anything when dropdown or textbox are visible
|
||||
for _, tk := range findByXY(w, h) {
|
||||
if tk.WidgetId() == me.dropdown.wId {
|
||||
log.Info("got dropdown click", w, h, tk.cuiName)
|
||||
log.Info("got dropdwon click", w, h, tk.cuiName)
|
||||
tk.dropdownClicked(w, h)
|
||||
return
|
||||
}
|
||||
|
@ -44,17 +43,17 @@ func doMouseClick(w int, h int) {
|
|||
win := findWindowUnderMouse()
|
||||
if win == nil {
|
||||
log.Log(INFO, "click() nothing was at:", w, h)
|
||||
log.Log(INFO, "click() check if", w, h, "is the libnotify icon")
|
||||
if me.notify.icon.tk != nil && me.notify.icon.tk.gocuiSize.inRect(w, h) {
|
||||
log.Log(GOCUI, "click() is libnotify.icon!")
|
||||
if me.notify.icon.active {
|
||||
log.Info("show notify.icon here")
|
||||
setNotifyIconText("[X]")
|
||||
me.notify.icon.active = false
|
||||
log.Log(INFO, "click() check if", w, h, "is the libnotify menu")
|
||||
if me.notify.menu.tk != nil && me.notify.menu.tk.gocuiSize.inRect(w, h) {
|
||||
log.Log(GOCUI, "click() is libnotify menu!")
|
||||
if me.notify.menu.active {
|
||||
log.Info("show notify menu here")
|
||||
setNotifyMenuText("[X]")
|
||||
me.notify.menu.active = false
|
||||
} else {
|
||||
log.Info("hide notify.icon here")
|
||||
setNotifyIconText("[ ]")
|
||||
me.notify.icon.active = true
|
||||
log.Info("hide notify menu here")
|
||||
setNotifyMenuText("[ ]")
|
||||
me.notify.menu.active = true
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -107,17 +106,8 @@ func doMouseClick(w int, h int) {
|
|||
tk.showDropdown()
|
||||
return
|
||||
case widget.Textbox:
|
||||
log.Log(WARN, "TODO: textbox click")
|
||||
tk.prepTextbox()
|
||||
return
|
||||
case widget.Label:
|
||||
if tk.node.InTable() {
|
||||
if tk.node.State.AtH == 0 {
|
||||
log.Log(NOW, "todo: sort by column here")
|
||||
tk.dumpWidget("sort")
|
||||
}
|
||||
}
|
||||
return
|
||||
default:
|
||||
// TODO: enable the GUI debugger in gocui
|
||||
// tk.dumpWidget("undef click()") // enable this to debug widget clicks
|
||||
|
@ -125,12 +115,6 @@ func doMouseClick(w int, h int) {
|
|||
}
|
||||
}
|
||||
|
||||
// todo: use this?
|
||||
func ctrlDown(g *gocui.Gui, v *gocui.View) error {
|
||||
log.Info("todo: clicked with ctrlDown")
|
||||
return nil
|
||||
}
|
||||
|
||||
func doMouseDoubleClick(w int, h int) {
|
||||
me.mouse.double = false
|
||||
// log.Printf("actually a double click (%d,%d)", w, h)
|
||||
|
|
|
@ -48,7 +48,6 @@ func mouseMove(g *gocui.Gui) {
|
|||
// old hack. create the 'msg' view if it does not yet exist
|
||||
// TODO: put this somewhere more correct
|
||||
if widgetView, _ := g.View("msg"); widgetView == nil {
|
||||
me.stdout.changed = true
|
||||
if createStdout(g) {
|
||||
return
|
||||
}
|
||||
|
@ -111,7 +110,15 @@ func (tk *guiWidget) moveNew() {
|
|||
tk.makeWindowActive()
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
if tk.WidgetType() == widget.Flag {
|
||||
me.baseGui.SetView(tk.cuiName, w-3, h-3, w+20, h+20, 0)
|
||||
// tk.verifyRect()
|
||||
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName)
|
||||
tk.dumpWidget(s)
|
||||
return
|
||||
}
|
||||
*/
|
||||
if tk.WidgetType() == widget.Stdout {
|
||||
if me.mouse.resize {
|
||||
newW := w - me.stdout.lastW
|
||||
|
@ -131,6 +138,5 @@ func (tk *guiWidget) moveNew() {
|
|||
// log.Info("Resize false", w, h, newW, newH)
|
||||
}
|
||||
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
||||
me.stdout.changed = true
|
||||
}
|
||||
}
|
||||
|
|
63
find.go
63
find.go
|
@ -129,6 +129,13 @@ func findWindowUnderMouse() *guiWidget {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// print out the window list
|
||||
for _, tk := range me.allwin {
|
||||
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
|
||||
}
|
||||
*/
|
||||
|
||||
// now check if the active window is below the mouse
|
||||
for _, tk := range me.allwin {
|
||||
if tk.window.active {
|
||||
|
@ -145,6 +152,12 @@ func findWindowUnderMouse() *guiWidget {
|
|||
return a.window.order - b.window.order
|
||||
})
|
||||
|
||||
/*
|
||||
// print out the window list
|
||||
for _, tk := range me.allwin {
|
||||
log.Info("findWindowUnderMouse() print:", tk.labelN, tk.window.active, tk.window.order)
|
||||
}
|
||||
*/
|
||||
for _, win := range me.allwin {
|
||||
if win.full.inRect(w, h) {
|
||||
// log.Info(fmt.Sprintf("findWindowUnderMouse() found %s window (%dx%d)", win.cuiName, w, h))
|
||||
|
@ -163,6 +176,12 @@ func findWindowUnderMouse() *guiWidget {
|
|||
return nil
|
||||
}
|
||||
|
||||
// todo: use this?
|
||||
func ctrlDown(g *gocui.Gui, v *gocui.View) error {
|
||||
log.Info("todo: clicked with ctrlDown")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findParentWindow() *guiWidget {
|
||||
if tk.WidgetType() == widget.Window {
|
||||
return tk
|
||||
|
@ -172,47 +191,3 @@ func (tk *guiWidget) findParentWindow() *guiWidget {
|
|||
}
|
||||
return tk.parent.findParentWindow()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findWidgetByName(name string) *guiWidget {
|
||||
if tk.cuiName == name {
|
||||
return tk
|
||||
}
|
||||
for _, child := range tk.children {
|
||||
found := child.findWidgetByName(name)
|
||||
if found != nil {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findWidgetByView(v *gocui.View) *guiWidget {
|
||||
if tk.v == v {
|
||||
return tk
|
||||
}
|
||||
if tk.cuiName == v.Name() {
|
||||
log.Log(NOW, "findWidget() error. names are mismatched or out of sync", tk.cuiName)
|
||||
log.Log(NOW, "findWidget() or maybe the view has been deleted")
|
||||
// return tk
|
||||
}
|
||||
for _, child := range tk.children {
|
||||
found := child.findWidgetByView(v)
|
||||
if found != nil {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findWidgetById(id int) *guiWidget {
|
||||
if tk.WidgetId() == id {
|
||||
return tk
|
||||
}
|
||||
for _, child := range tk.children {
|
||||
found := child.findWidgetById(id)
|
||||
if found != nil {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
22
help.go
22
help.go
|
@ -1,7 +1,7 @@
|
|||
// Copyright 2014 The gocui Authors. All rights reserved.
|
||||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
// Prior Copyright 2014 The gocui Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
|
@ -25,20 +25,16 @@ import (
|
|||
|
||||
var helpText []string = []string{"Help Menu",
|
||||
"",
|
||||
"Tab toggle through windows",
|
||||
"'O' toggle STDOUT",
|
||||
"'H' toggle this gocui menu",
|
||||
"'D' toggle light/dark mode",
|
||||
"CTRL-z background to shell",
|
||||
"CTRL-c quit()",
|
||||
"Tab: toggle through windows",
|
||||
"O: toggle STDOUT",
|
||||
"H: toggle this gocui menu",
|
||||
"L: toggle light/dark mode",
|
||||
"CTRL-c: quit()",
|
||||
"",
|
||||
"Debugging:",
|
||||
"'S' Supermouse mode",
|
||||
"'M' list all widget positions",
|
||||
"'L' list all widgets in tree",
|
||||
"<Pgup> scroll up the STDOUT window",
|
||||
"<Pgdn> scroll down the STDOUT window",
|
||||
"'r' reverse STDOUT scrolling",
|
||||
"S: Supermouse mode",
|
||||
"M: list all widget positions",
|
||||
"L: list all widgets in tree",
|
||||
}
|
||||
|
||||
func hideHelp() {
|
||||
|
|
95
init.go
95
init.go
|
@ -14,13 +14,10 @@ import (
|
|||
"runtime"
|
||||
"runtime/debug"
|
||||
"runtime/pprof"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
)
|
||||
|
||||
// sent via -ldflags
|
||||
|
@ -33,7 +30,7 @@ var PLUGIN string = "gocui"
|
|||
// between the app and this gocui plugin
|
||||
// this is a good place to initialize gocui's default behavior
|
||||
func toolkitInit() {
|
||||
log.Log(INFO, "gocui toolkitInit() me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() me.ok =", me.ok)
|
||||
if me.baseGui == nil {
|
||||
log.Info("gocui baseGui is still nil")
|
||||
standardExit()
|
||||
|
@ -42,13 +39,13 @@ func toolkitInit() {
|
|||
log.Info("gocui treeRoot is still nil")
|
||||
standardExit()
|
||||
}
|
||||
// w := me.treeRoot.TK.(*guiWidget)
|
||||
// w.dumpTree("MM")
|
||||
// w.dumpWindows("WW")
|
||||
w := me.treeRoot.TK.(*guiWidget)
|
||||
w.dumpTree("MM")
|
||||
w.dumpWindows("WW")
|
||||
|
||||
// SETUP HELP START
|
||||
me.baseGui.Update(testRefresh)
|
||||
log.Log(INFO, "gocui toolkitInit() trying showHelp() me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() trying showHelp() me.ok =", me.ok)
|
||||
showHelp()
|
||||
hideHelp()
|
||||
// SETUP HELP END
|
||||
|
@ -59,10 +56,10 @@ func toolkitInit() {
|
|||
}
|
||||
|
||||
// time.Sleep(300 * time.Millisecond)
|
||||
log.Log(INFO, "gocui toolkitInit() me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() me.ok =", me.ok)
|
||||
me.baseGui.Update(testRefresh)
|
||||
if !me.stdout.init {
|
||||
log.Log(INFO, "gocui toolkitInit() stdout.Init me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() stdout.Init me.ok =", me.ok)
|
||||
me.stdout.init = true
|
||||
relocateStdoutOffscreen()
|
||||
}
|
||||
|
@ -78,24 +75,22 @@ func toolkitInit() {
|
|||
|
||||
// SETUP libnotify clock and menu
|
||||
me.notify.clock.once.Do(makeNotifyClock)
|
||||
me.notify.icon.once.Do(makeNotifyIcon)
|
||||
me.notify.menu.once.Do(makeNotifyMenu)
|
||||
|
||||
// TODO: for some reason, this makes the background doesn't display
|
||||
// PUT INIT DEBUG COOE HERE
|
||||
var toggle bool
|
||||
for i := 0; i < 4; i++ {
|
||||
// enable this to show early debugging
|
||||
// w := me.treeRoot.TK.(*guiWidget)
|
||||
// w.dumpTree("MM")
|
||||
// w.dumpWindows("WW")
|
||||
for i := 0; i < 6; i++ {
|
||||
w := me.treeRoot.TK.(*guiWidget)
|
||||
w.dumpTree("MM")
|
||||
w.dumpWindows("WW")
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
if toggle {
|
||||
toggle = false
|
||||
// log.Info("gocui toolkitInit() put testing true stuff here")
|
||||
log.Info("gocui toolkitInit() put testing true stuff here")
|
||||
} else {
|
||||
toggle = true
|
||||
// log.Info("gocui toolkitInit() put testing false stuff here")
|
||||
log.Info("gocui toolkitInit() put testing false stuff here")
|
||||
}
|
||||
setBottomBG()
|
||||
}
|
||||
|
@ -103,11 +98,12 @@ func toolkitInit() {
|
|||
|
||||
// TEST TEXTBOX START
|
||||
// time.Sleep(1 * time.Second)
|
||||
log.Log(INFO, "gocui toolkitInit() me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() me.ok =", me.ok)
|
||||
me.baseGui.Update(testRefresh)
|
||||
if me.textbox.tk == nil {
|
||||
log.Log(INFO, "gocui toolkitInit() initTextbox me.ok =", me.ok)
|
||||
log.Info("gocui toolkitInit() initTextbox me.ok =", me.ok)
|
||||
initTextbox()
|
||||
me.textbox.tk.prepTextbox()
|
||||
}
|
||||
// TEST TEXTBOX END
|
||||
}
|
||||
|
@ -143,16 +139,10 @@ func initPlugin() {
|
|||
// me.stdout.Write([]byte("starting with stdout onscreen\n"))
|
||||
}
|
||||
if val == "disable" {
|
||||
log.Log(INFO, "gocui: attempt to COMPLETELY DISABLE STDOUT LOG")
|
||||
log.Info("COMPLETELY DISABLE LOG CRAP")
|
||||
me.stdout.disable = true
|
||||
}
|
||||
}
|
||||
if val, err := me.myTree.ConfigFind("stdoutoffscreen"); err == nil {
|
||||
if val == "false" {
|
||||
// log.Log(NOW, "gocui: START ON SCREEN TRUE")
|
||||
me.stdout.startOnscreen = true
|
||||
}
|
||||
}
|
||||
if val, err := me.myTree.ConfigFind("dark"); err == nil {
|
||||
if val == "true" {
|
||||
me.dark = true
|
||||
|
@ -165,15 +155,12 @@ func initPlugin() {
|
|||
}
|
||||
// todo: make this a tmp file that goes away
|
||||
if !me.stdout.disable {
|
||||
tmpFile, err := os.CreateTemp("", "gocui-*.log")
|
||||
log.Info("USING STDOUT")
|
||||
me.outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||
if err != nil {
|
||||
fmt.Println("Error creating temp file:", err)
|
||||
standardExit()
|
||||
log.Info("error opening file:", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
// defer os.Remove(tmpFile.Name())
|
||||
|
||||
log.Log(INFO, "stdout.disable == true. writing to", tmpFile.Name())
|
||||
me.outf = tmpFile
|
||||
// todo: some early output still goes to the /tmp/ file
|
||||
//time.Sleep(200 * time.Millisecond)
|
||||
log.CaptureMode(me.stdout)
|
||||
|
@ -192,20 +179,6 @@ func initPlugin() {
|
|||
me.stdout.lastW = 4
|
||||
me.stdout.lastH = 20
|
||||
|
||||
if val, err := me.myTree.ConfigFind("stdoutsize"); err == nil {
|
||||
parts := strings.Fields(val)
|
||||
if len(parts) == 4 {
|
||||
log.Info("initial stdout settings:", parts, "setting startOnscreen = true")
|
||||
me.stdout.w, _ = strconv.Atoi(parts[0])
|
||||
me.stdout.h, _ = strconv.Atoi(parts[1])
|
||||
me.stdout.lastW, _ = strconv.Atoi(parts[2])
|
||||
me.stdout.lastH, _ = strconv.Atoi(parts[3])
|
||||
me.stdout.startOnscreen = true
|
||||
} else {
|
||||
log.Info("initial stdout settings parse error:", parts)
|
||||
}
|
||||
}
|
||||
|
||||
// just make up unique values for these
|
||||
me.dropdown.wId = -77
|
||||
me.textbox.wId = -55
|
||||
|
@ -217,9 +190,9 @@ func initPlugin() {
|
|||
me.notify.clock.offsetW = 13
|
||||
me.notify.clock.offsetH = 1
|
||||
|
||||
me.notify.icon.wId = -6
|
||||
me.notify.icon.offsetW = 4
|
||||
me.notify.icon.offsetH = 1
|
||||
me.notify.menu.wId = -6
|
||||
me.notify.menu.offsetW = 4
|
||||
me.notify.menu.offsetH = 1
|
||||
|
||||
me.notify.help.wId = -7
|
||||
me.notify.help.offsetH = 3
|
||||
|
@ -314,7 +287,6 @@ func standardExit() {
|
|||
if me.outf != nil {
|
||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||
me.outf.Close()
|
||||
os.Remove(me.outf.Name())
|
||||
}
|
||||
// log(true, "standardExit() setOutput(os.Stdout)")
|
||||
// setOutput(os.Stdout)
|
||||
|
@ -331,7 +303,6 @@ func standardClose() {
|
|||
me.baseGui.Close()
|
||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||
me.outf.Close()
|
||||
os.Remove(me.outf.Name())
|
||||
// os.Stdin = os.Stdin
|
||||
// os.Stdout = os.Stdout
|
||||
// os.Stderr = os.Stderr
|
||||
|
@ -394,23 +365,10 @@ func refreshGocui() {
|
|||
// redraw the windows if something has changed
|
||||
if time.Since(lastRefresh) > 1000*time.Millisecond {
|
||||
if me.refresh {
|
||||
log.Log(NOW, "newWindowTrigger() sending refresh to channel")
|
||||
log.Info("refresh triggered")
|
||||
me.newWindowTrigger <- me.treeRoot.TK.(*guiWidget)
|
||||
me.refresh = false
|
||||
}
|
||||
if me.stdout.changed {
|
||||
me.stdout.changed = false
|
||||
lastRefresh = time.Now()
|
||||
new1 := new(tree.ToolkitConfig)
|
||||
new1.Plugin = "gocui"
|
||||
new1.Name = "stdoutsize"
|
||||
width := me.stdout.tk.gocuiSize.w1 - me.stdout.tk.gocuiSize.w0
|
||||
height := me.stdout.tk.gocuiSize.h1 - me.stdout.tk.gocuiSize.h0
|
||||
new1.Value = fmt.Sprintf("%d %d %d %d", width, height, me.stdout.tk.gocuiSize.w0, me.stdout.tk.gocuiSize.h0)
|
||||
me.myTree.ConfigSave(new1)
|
||||
// log.Log(NOW, "newWindowTrigger() gocui setting stdout size =", new1.Value)
|
||||
// me.stdout.tk.dumpWidget("save")
|
||||
}
|
||||
}
|
||||
|
||||
// this code updates the clock
|
||||
|
@ -456,6 +414,7 @@ func newWindowTrigger() {
|
|||
}
|
||||
if me.textbox.tk == nil {
|
||||
initTextbox()
|
||||
me.textbox.tk.prepTextbox()
|
||||
}
|
||||
tk.makeWindowActive()
|
||||
me.myTree.Unlock()
|
||||
|
|
137
libnotify.go
137
libnotify.go
|
@ -56,32 +56,32 @@ func makeNotifyClock() {
|
|||
return
|
||||
}
|
||||
me.notify.clock.tk = makeNewInternalWidget(me.notify.clock.wId)
|
||||
// me.notify.clock.tk.dumpWidget("init() clock")
|
||||
me.notify.clock.tk.dumpWidget("init() clock")
|
||||
me.notify.clock.tk.MoveToOffset(0, 0)
|
||||
me.notify.clock.tk.labelN = time.Now().Format("15:04:05")
|
||||
me.notify.clock.tk.frame = false
|
||||
me.notify.clock.tk.setColorLabel()
|
||||
me.notify.clock.tk.Show()
|
||||
me.notify.clock.active = true
|
||||
// me.notify.clock.tk.dumpWidget("notifyClock()")
|
||||
me.notify.clock.tk.dumpWidget("notifyClock()")
|
||||
|
||||
}
|
||||
|
||||
func makeNotifyIcon() {
|
||||
func makeNotifyMenu() {
|
||||
if me.treeRoot == nil {
|
||||
log.Info("gogui makeClock() error. treeRoot == nil")
|
||||
return
|
||||
}
|
||||
me.notify.icon.tk = makeNewInternalWidget(me.notify.icon.wId)
|
||||
// me.notify.icon.tk.dumpWidget("init() menu")
|
||||
me.notify.menu.tk = makeNewInternalWidget(me.notify.menu.wId)
|
||||
me.notify.menu.tk.dumpWidget("init() menu")
|
||||
w, _ := me.baseGui.Size()
|
||||
me.notify.icon.tk.MoveToOffset(w-5, me.notify.icon.offsetH)
|
||||
me.notify.icon.tk.labelN = "[ ]"
|
||||
me.notify.icon.tk.frame = false
|
||||
me.notify.icon.tk.setColorNotifyIcon()
|
||||
me.notify.icon.tk.Show()
|
||||
me.notify.icon.active = true
|
||||
// me.notify.icon.tk.dumpWidget("notifyIcon()")
|
||||
me.notify.menu.tk.MoveToOffset(w-5, me.notify.menu.offsetH)
|
||||
me.notify.menu.tk.labelN = "[ ]"
|
||||
me.notify.menu.tk.frame = false
|
||||
me.notify.menu.tk.setColorNotifyMenu()
|
||||
me.notify.menu.tk.Show()
|
||||
me.notify.menu.active = true
|
||||
me.notify.menu.tk.dumpWidget("notifyMenu()")
|
||||
|
||||
}
|
||||
|
||||
|
@ -103,19 +103,15 @@ func libNotifyUpdate() {
|
|||
// check for SIGWINCH. If so, move the libnotify clock
|
||||
w, h := me.baseGui.Size()
|
||||
if me.winchW != w || me.winchH != h {
|
||||
if me.winchW == 0 && me.winchH == 0 {
|
||||
// this isn't really SIGWINCH. This is the app starting
|
||||
} else {
|
||||
log.Printf("gocui: long live SIGWINCH! (w,h) is now (%d,%d)\n", w, h)
|
||||
}
|
||||
me.winchW = w
|
||||
me.winchH = h
|
||||
log.Info("handle SIGWINCH!", w, h)
|
||||
me.notify.clock.tk.MoveToOffset(w-me.notify.clock.offsetW, me.notify.clock.offsetH)
|
||||
me.notify.clock.tk.Hide()
|
||||
me.notify.clock.tk.Show()
|
||||
|
||||
sigWinchBG()
|
||||
sigWinchIcon()
|
||||
sigWinchMenu()
|
||||
}
|
||||
|
||||
// update the time
|
||||
|
@ -126,41 +122,30 @@ func libNotifyUpdate() {
|
|||
// hardDrawUnderMouse(me.notify.clock.tk, "clock")
|
||||
// log.Info("libNotifyUpdate updated clock", me.notify.clock.tk.labelN)
|
||||
|
||||
if me.notify.icon.tk == nil {
|
||||
if me.notify.menu.tk == nil {
|
||||
log.Info("libNotifyUpdate error menu.tk == nil")
|
||||
return
|
||||
}
|
||||
if me.notify.icon.tk.v == nil {
|
||||
if me.notify.menu.tk.v == nil {
|
||||
log.Info("libNotifyUpdate error menu.tk.v == nil")
|
||||
return
|
||||
}
|
||||
|
||||
// update the menu
|
||||
hardDrawAtgocuiSize(me.notify.icon.tk)
|
||||
me.notify.icon.tk.setColorNotifyIcon()
|
||||
me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
|
||||
hardDrawAtgocuiSize(me.notify.menu.tk)
|
||||
me.notify.menu.tk.setColorNotifyMenu()
|
||||
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name())
|
||||
me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name())
|
||||
}
|
||||
|
||||
func setNotifyIconText(s string) {
|
||||
me.notify.icon.tk.v.Clear()
|
||||
me.notify.icon.tk.labelN = s
|
||||
me.notify.icon.tk.v.WriteString(me.notify.icon.tk.labelN)
|
||||
hardDrawAtgocuiSize(me.notify.icon.tk)
|
||||
me.notify.icon.tk.setColorNotifyIcon()
|
||||
me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
|
||||
log.Info("setNotifyIconText() updated menu to:", me.notify.icon.tk.labelN)
|
||||
// print out the window list // TODO: put this in libnotify
|
||||
for _, tk := range me.allwin {
|
||||
log.Info("known window Window", tk.labelN, tk.window.active, tk.window.order)
|
||||
}
|
||||
if s == "[X]" {
|
||||
log.Warn("should turn on help window here")
|
||||
showHelp()
|
||||
} else {
|
||||
log.Warn("should turn off help window here")
|
||||
hideHelp()
|
||||
}
|
||||
func setNotifyMenuText(s string) {
|
||||
me.notify.menu.tk.v.Clear()
|
||||
me.notify.menu.tk.labelN = s
|
||||
me.notify.menu.tk.v.WriteString(me.notify.menu.tk.labelN)
|
||||
hardDrawAtgocuiSize(me.notify.menu.tk)
|
||||
me.notify.menu.tk.setColorNotifyMenu()
|
||||
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name())
|
||||
log.Info("setNotifyMenuText() updated menu to:", me.notify.menu.tk.labelN)
|
||||
}
|
||||
|
||||
// in the very end of redrawing things, this will place the help and stdout on the top or botton
|
||||
|
@ -176,9 +161,9 @@ func setThingsOnTop() {
|
|||
me.baseGui.SetViewOnTop(me.notify.clock.tk.v.Name())
|
||||
}
|
||||
|
||||
if me.notify.icon.tk != nil {
|
||||
if me.notify.icon.tk.v != nil {
|
||||
me.baseGui.SetViewOnTop(me.notify.icon.tk.v.Name())
|
||||
if me.notify.menu.tk != nil {
|
||||
if me.notify.menu.tk.v != nil {
|
||||
me.baseGui.SetViewOnTop(me.notify.menu.tk.v.Name())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -218,14 +203,15 @@ func hardDrawUnderMouse(tk *guiWidget, name string) {
|
|||
tk.Hide()
|
||||
}
|
||||
w, h := me.baseGui.MousePosition()
|
||||
r := new(rectType)
|
||||
r.w0 = w
|
||||
r.h0 = h
|
||||
r.w1 = w + 8
|
||||
r.h1 = h + 4
|
||||
if err := tk.SetViewRect(r); err != nil {
|
||||
log.Info("hardDrawUnderMouse() err", tk.cuiName, err)
|
||||
tk.dumpWidget("hardDrawERR")
|
||||
a := w
|
||||
b := h
|
||||
c := w + 8
|
||||
d := h + 4
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0)
|
||||
if err == nil {
|
||||
log.Info("hardDrawUnderMouse() err ok widget", tk.cuiName)
|
||||
tk.dumpWidget("hard draw err")
|
||||
}
|
||||
tk.v.Frame = false
|
||||
tk.v.Clear()
|
||||
|
@ -236,35 +222,44 @@ func hardDrawAtgocuiSize(tk *guiWidget) {
|
|||
if tk.v != nil {
|
||||
tk.Hide()
|
||||
}
|
||||
if err := tk.SetView(); err != nil {
|
||||
a := tk.gocuiSize.w0
|
||||
b := tk.gocuiSize.h0
|
||||
c := tk.gocuiSize.w1
|
||||
d := tk.gocuiSize.h1
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0)
|
||||
if err == nil {
|
||||
log.Info("hardDrawAtgocuiSize() err ok widget", tk.cuiName)
|
||||
tk.dumpWidget("hardDrawERR")
|
||||
tk.dumpWidget("hard draw err")
|
||||
}
|
||||
tk.v.Frame = false
|
||||
tk.v.Clear()
|
||||
tk.v.WriteString(tk.labelN)
|
||||
// log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name())
|
||||
log.Verbose("hardDrawAtgocuiSize() err ok widget", tk.cuiName, a, b, c, d, tk.v.Name())
|
||||
}
|
||||
|
||||
func sigWinchIcon() {
|
||||
func sigWinchMenu() {
|
||||
w, _ := me.baseGui.Size()
|
||||
me.notify.icon.tk.MoveToOffset(w-me.notify.icon.offsetW, me.notify.icon.offsetH)
|
||||
me.notify.icon.tk.Hide()
|
||||
me.notify.icon.tk.Show()
|
||||
me.notify.menu.tk.MoveToOffset(w-me.notify.menu.offsetW, me.notify.menu.offsetH)
|
||||
me.notify.menu.tk.Hide()
|
||||
me.notify.menu.tk.Show()
|
||||
}
|
||||
|
||||
func sigWinchBG() {
|
||||
tk := me.BG.tk
|
||||
w, h := me.baseGui.Size()
|
||||
tk.gocuiSize.w0 = -1
|
||||
tk.gocuiSize.h0 = -1
|
||||
tk.gocuiSize.w1 = w + 1
|
||||
tk.gocuiSize.h1 = h + 1
|
||||
if err := tk.SetView(); err != nil {
|
||||
tk.dumpWidget("sigWinchBGerr()")
|
||||
log.Log(ERROR, "sigWinchBG()", err)
|
||||
a := -1
|
||||
b := -1
|
||||
c := w + 1
|
||||
d := h + 1
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName, a, b, c, d, 0)
|
||||
if err == nil {
|
||||
tk.dumpWidget("drawView() err")
|
||||
log.Log(ERROR, "drawView() internal plugin error err = nil")
|
||||
return
|
||||
}
|
||||
log.Log(INFO, "background resized to", tk.gocuiSize)
|
||||
log.Info("background resized to", a, b, c, d)
|
||||
}
|
||||
|
||||
// find the "BG" widget and set it to the background on the very very bottom
|
||||
|
@ -287,9 +282,5 @@ func setBottomBG() {
|
|||
tk.v.Clear()
|
||||
me.baseGui.SetViewOnBottom(tk.cuiName)
|
||||
w, h := me.baseGui.Size()
|
||||
tk.gocuiSize.w0 = -1
|
||||
tk.gocuiSize.h0 = -1
|
||||
tk.gocuiSize.w1 = w + 1
|
||||
tk.gocuiSize.h1 = h + 1
|
||||
tk.SetView()
|
||||
me.baseGui.SetView(tk.cuiName, -1, -1, w+1, h+1, 0)
|
||||
}
|
||||
|
|
14
place.go
14
place.go
|
@ -143,7 +143,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
|||
// tk.dumpWidget(fmt.Sprintf("PlaceGroup(%d,%d)", maxW, newH))
|
||||
return maxW, newH
|
||||
case widget.Button:
|
||||
if tk.isDense() && tk.isInGrid() {
|
||||
if tk.isWindowDense() && tk.isInGrid() {
|
||||
tk.frame = false
|
||||
// tk.color = nil
|
||||
// tk.defaultColor = nil
|
||||
|
@ -167,14 +167,6 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
|||
return 0, 0
|
||||
}
|
||||
|
||||
func (tk *guiWidget) isDense() bool {
|
||||
if tk.node.InTable() {
|
||||
return true
|
||||
}
|
||||
|
||||
return tk.isWindowDense()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) isWindowDense() bool {
|
||||
if tk.WidgetType() == widget.Window {
|
||||
return tk.window.dense
|
||||
|
@ -201,6 +193,8 @@ func (w *guiWidget) placeGrid(startW int, startH int) (int, int) {
|
|||
return 0, 0
|
||||
}
|
||||
|
||||
dense := w.isWindowDense()
|
||||
|
||||
w.full.w0 = startW
|
||||
w.full.h0 = startH
|
||||
|
||||
|
@ -215,7 +209,7 @@ func (w *guiWidget) placeGrid(startW int, startH int) (int, int) {
|
|||
if w.heights[child.GridH()] < childH {
|
||||
w.heights[child.GridH()] = childH
|
||||
}
|
||||
if child.isDense() {
|
||||
if dense {
|
||||
if w.heights[child.GridH()] > 0 {
|
||||
w.heights[child.GridH()] = 1
|
||||
} else {
|
||||
|
|
|
@ -16,7 +16,7 @@ func newAdd(n *tree.Node) {
|
|||
return
|
||||
}
|
||||
if n.TK != nil {
|
||||
log.Log(INFO, "Tree Add() sent a widget we aleady seem to have")
|
||||
log.Warn("Tree Add() sent a widget we aleady seem to have")
|
||||
// this is done to protect the plugin being 'refreshed' with the
|
||||
// widget binary tree. TODO: find a way to keep them in sync
|
||||
return
|
||||
|
@ -116,7 +116,7 @@ func (w *guiWidget) AddText(text string) {
|
|||
}
|
||||
w.vals = append(w.vals, text)
|
||||
for i, s := range w.vals {
|
||||
log.Log(INFO, "AddText()", w.String(), i, s)
|
||||
log.Log(NOW, "AddText()", w.String(), i, s)
|
||||
}
|
||||
w.SetText(text)
|
||||
}
|
||||
|
@ -162,10 +162,10 @@ func (tk *guiWidget) GetText() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
// hack. use "textbox widget" to "disable" user events
|
||||
func hideDisable() {
|
||||
if me.textbox.tk == nil {
|
||||
initTextbox()
|
||||
me.textbox.tk.prepTextbox()
|
||||
}
|
||||
|
||||
me.textbox.tk.Hide()
|
||||
|
@ -177,7 +177,6 @@ func hideDisable() {
|
|||
// me.baseGui.DeleteView(me.textbox.tk.v.Name())
|
||||
}
|
||||
|
||||
// hack. use "textbox widget" to "disable" user events
|
||||
func showDisable() {
|
||||
if me.textbox.tk == nil {
|
||||
initTextbox()
|
||||
|
@ -201,7 +200,7 @@ func showDisable() {
|
|||
me.textbox.tk.v.Editable = true
|
||||
me.textbox.tk.v.Wrap = true
|
||||
|
||||
me.textbox.tk.SetViewRect(r)
|
||||
me.baseGui.SetView(me.textbox.tk.cuiName, r.w0, r.h0, r.w1, r.h1, 0)
|
||||
me.baseGui.SetCurrentView(me.textbox.tk.v.Name())
|
||||
|
||||
// bind the enter key to a function so we can close the textbox
|
||||
|
|
6
size.go
6
size.go
|
@ -67,7 +67,7 @@ func (tk *guiWidget) Size() (int, int) {
|
|||
case widget.Checkbox:
|
||||
return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense'
|
||||
case widget.Button:
|
||||
if tk.isDense() {
|
||||
if tk.isWindowDense() {
|
||||
return len(tk.String()) + 2, 0
|
||||
}
|
||||
return len(tk.String()) + 2, 3 // TODO: compute this based on 'window dense'
|
||||
|
@ -244,7 +244,7 @@ func (tk *guiWidget) setFullSize() bool {
|
|||
if tk.WidgetType() == widget.Button {
|
||||
tk.full.h1 = tk.full.h0 + 1
|
||||
}
|
||||
if tk.isDense() && tk.isInGrid() {
|
||||
if tk.isWindowDense() && tk.isInGrid() {
|
||||
tk.full.h1 = tk.full.h0
|
||||
}
|
||||
if changed {
|
||||
|
@ -309,7 +309,7 @@ func (tk *guiWidget) buttonFullSize() rectType {
|
|||
tk.full.h1 = r.h1
|
||||
|
||||
// total hack. fix this somewhere eventually correctly
|
||||
if tk.isDense() { // total hack. fix this somewhere eventually correctly
|
||||
if tk.isWindowDense() { // total hack. fix this somewhere eventually correctly
|
||||
tk.full.h0 += 1 // total hack. fix this somewhere eventually correctly
|
||||
tk.full.h1 = tk.full.h0 // total hack. fix this somewhere eventually correctly
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"slices"
|
||||
"strings"
|
||||
|
@ -45,7 +46,6 @@ func coreStdout() {
|
|||
me.stdout.tk = initWidget(n)
|
||||
|
||||
tk := me.stdout.tk
|
||||
tk.cuiName = "msg"
|
||||
tk.gocuiSize.w0 = me.stdout.lastW
|
||||
tk.gocuiSize.h0 = me.stdout.lastH
|
||||
tk.gocuiSize.w1 = tk.gocuiSize.w0 + me.stdout.w
|
||||
|
@ -64,18 +64,32 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
return nil
|
||||
}
|
||||
|
||||
me.stdout.tk.cuiName = "msg"
|
||||
me.stdout.tk.SetView()
|
||||
|
||||
v, err := g.View("msg")
|
||||
if v == nil {
|
||||
// log.Log(NOW, "makeoutputwindow() this is supposed to happen. v == nil", err)
|
||||
log.Log(NOW, "makeoutputwindow() this is supposed to happen. v == nil", err)
|
||||
} else {
|
||||
log.Log(NOW, "makeoutputwindow() msg != nil. WTF now? err =", err)
|
||||
return v
|
||||
}
|
||||
|
||||
v = me.stdout.tk.v
|
||||
rect := me.stdout.tk.gocuiSize
|
||||
v, err = g.SetView("msg", rect.w0, rect.h0, rect.w1, rect.h1, 0)
|
||||
|
||||
if errors.Is(err, gocui.ErrUnknownView) {
|
||||
log.Log(NOW, "makeoutputwindow() this is supposed to happen?", err)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Log(NOW, "makeoutputwindow() create output window failed", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
if v == nil {
|
||||
log.Log(NOW, "makeoutputwindow() msg == nil. WTF now? err =", err)
|
||||
return nil
|
||||
} else {
|
||||
me.stdout.tk.v = v
|
||||
}
|
||||
|
||||
v.Clear()
|
||||
v.SelBgColor = gocui.ColorCyan
|
||||
|
@ -84,8 +98,16 @@ func makeOutputWidget(g *gocui.Gui, stringFromMouseClick string) *gocui.View {
|
|||
// g.SetViewOnBottom("msg")
|
||||
// setBottomBG()
|
||||
|
||||
me.stdout.tk.v = v
|
||||
me.stdout.tk.DrawAt(me.stdout.lastW, me.stdout.lastH)
|
||||
relocateStdoutOffscreen()
|
||||
/*
|
||||
if me.stdout.outputOffscreen {
|
||||
me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH)
|
||||
} else {
|
||||
relocateStdoutOffscreen()
|
||||
}
|
||||
*/
|
||||
return v
|
||||
}
|
||||
|
||||
|
@ -103,22 +125,6 @@ func relocateStdoutOffscreen() {
|
|||
}
|
||||
|
||||
func (tk *guiWidget) relocateStdout(w int, h int) {
|
||||
if me.stdout.w < 8 {
|
||||
me.stdout.w = 8
|
||||
}
|
||||
|
||||
if me.stdout.h < 4 {
|
||||
me.stdout.h = 4
|
||||
}
|
||||
|
||||
if w+me.stdout.w < 2 {
|
||||
w = 2
|
||||
}
|
||||
|
||||
if h+me.stdout.h < 2 {
|
||||
h = 2
|
||||
}
|
||||
|
||||
w0 := w
|
||||
h0 := h
|
||||
w1 := w + me.stdout.w
|
||||
|
@ -134,7 +140,8 @@ func (tk *guiWidget) relocateStdout(w int, h int) {
|
|||
tk.full.h0 = h0
|
||||
tk.full.h1 = h1
|
||||
|
||||
tk.SetView()
|
||||
me.baseGui.SetView("msg", w0, h0, w1, h1, 0)
|
||||
// me.baseGui.SetViewOnBottom("msg")
|
||||
}
|
||||
|
||||
// from the gocui devs:
|
||||
|
@ -211,9 +218,7 @@ func (tk *guiWidget) refreshStdout() {
|
|||
// chop off the last lines in the buffer
|
||||
chop := len(me.stdout.outputS) - (me.stdout.pager + me.stdout.h)
|
||||
cur = append(cur, me.stdout.outputS[chop:chop+me.stdout.h]...)
|
||||
if me.stdout.reverse {
|
||||
slices.Reverse(cur)
|
||||
}
|
||||
slices.Reverse(cur)
|
||||
tk.v.Clear()
|
||||
fmt.Fprintln(tk.v, strings.Join(cur, "\n"))
|
||||
}
|
||||
|
|
20
structs.go
20
structs.go
|
@ -116,11 +116,11 @@ type stdout struct {
|
|||
disable bool // disable the stdout window. do not change os.Stdout & os.Stderr
|
||||
lastW int // the last 'w' location (used to move from offscreen to onscreen)
|
||||
lastH int // the last 'h' location (used to move from offscreen to onscreen)
|
||||
init bool // moves the window offscreen on startup
|
||||
outputS []string // the buffer of all the output
|
||||
pager int // allows the user to page through the buffer
|
||||
changed bool // indicates the user has changed stdout. gocui should remember the state here
|
||||
reverse bool // flip the STDOUT upside down so new STDOUT lines are at the top
|
||||
// mouseOffsetW int // the current 'w' offset
|
||||
// mouseOffsetH int // the current 'h' offset
|
||||
init bool // moves the window offscreen on startup
|
||||
outputS []string // the buffer of all the output
|
||||
pager int // allows the user to page through the buffer
|
||||
}
|
||||
|
||||
// settings for the dropdown window
|
||||
|
@ -149,10 +149,11 @@ type internalTK struct {
|
|||
|
||||
// the desktop libnotify menu
|
||||
type libnotify struct {
|
||||
clock internalTK // widget for the clock
|
||||
icon internalTK // libnotify menu icon
|
||||
window internalTK // the libnotify menu
|
||||
help internalTK // the help menu
|
||||
clock internalTK // widget for the clock
|
||||
menu internalTK // libnotify menu icon
|
||||
menuWindow internalTK // libnotify menu window
|
||||
window internalTK // the libnotify menu
|
||||
help internalTK // the help menu
|
||||
}
|
||||
|
||||
// this is the gocui way
|
||||
|
@ -241,7 +242,6 @@ type guiWidget struct {
|
|||
color *colorT // what color to use
|
||||
colorLast colorT // the last color the widget had
|
||||
defaultColor *colorT // the default colors // TODO: make a function for this instead
|
||||
isTable bool // is this a table?
|
||||
}
|
||||
|
||||
// THIS IS GO COMPILER MAGIC
|
||||
|
|
43
table.go
43
table.go
|
@ -13,6 +13,18 @@ import (
|
|||
"go.wit.com/widget"
|
||||
)
|
||||
|
||||
func initWindowPB(pb *guipb.Widget) *guiWidget {
|
||||
var w *guiWidget
|
||||
w = new(guiWidget)
|
||||
|
||||
w.pb = pb
|
||||
w.parent = me.treeRoot.TK.(*guiWidget)
|
||||
w.wtype = widget.Window
|
||||
w.cuiName = fmt.Sprintf("%d %s", pb.Id, "TK")
|
||||
w.labelN = pb.Name
|
||||
return w
|
||||
}
|
||||
|
||||
func initGridPB(pb *guipb.Widget) *guiWidget {
|
||||
var w *guiWidget
|
||||
w = new(guiWidget)
|
||||
|
@ -21,7 +33,6 @@ func initGridPB(pb *guipb.Widget) *guiWidget {
|
|||
w.wtype = widget.Grid
|
||||
w.cuiName = fmt.Sprintf("%d %s", pb.Id, "TK")
|
||||
w.labelN = pb.Name
|
||||
w.isTable = true
|
||||
return w
|
||||
}
|
||||
|
||||
|
@ -31,21 +42,19 @@ func showTable(t *guipb.Table) {
|
|||
return
|
||||
}
|
||||
log.Info("gocui: table.Title", t.Title)
|
||||
// log.Info("gocui: need to add window here id =", t.Window.Id, t.Window.Name)
|
||||
if t.Window == nil {
|
||||
log.Info("gocui: missing window widget. tree plugin error")
|
||||
return
|
||||
}
|
||||
log.Info("gocui: need to add window here id =", t.Window.Id, t.Window.Name)
|
||||
if t.Grid == nil {
|
||||
log.Info("gocui: missing grid widget. tree plugin error")
|
||||
return
|
||||
}
|
||||
root := me.treeRoot.TK.(*guiWidget)
|
||||
parent := root.findWidgetById(int(t.Parent.Id))
|
||||
if parent == nil {
|
||||
log.Info("gocui: show table error. parent.Id not found", t.Parent.Id)
|
||||
return
|
||||
}
|
||||
|
||||
log.Info("gocui: need to add grid here id =", t.Grid.Id)
|
||||
grid := initGridPB(t.Grid)
|
||||
grid.parent = parent
|
||||
win := initWindowPB(t.Window)
|
||||
grid := initWindowPB(t.Window)
|
||||
grid.parent = win
|
||||
}
|
||||
|
||||
func enableWidget(n *tree.Node) {
|
||||
|
@ -74,20 +83,12 @@ func hideWidget(n *tree.Node) {
|
|||
}
|
||||
|
||||
func (tk *guiWidget) deleteWidget() {
|
||||
log.Log(INFO, "gocui deleteWidget() looking for child to delete:", tk.cuiName)
|
||||
log.Info("gocui deleteWidget() looking for child to delete:", tk.cuiName)
|
||||
p := tk.parent
|
||||
for i, child := range p.children {
|
||||
if tk == child {
|
||||
log.Log(INFO, "deleteWidget() found parent with child to delete:", i, child.cuiName, child.WidgetId())
|
||||
log.Info("deleteWidget() found parent with child to delete:", i, child.cuiName)
|
||||
p.children = slices.Delete(p.children, i, i+1)
|
||||
}
|
||||
}
|
||||
tk.deleteTree()
|
||||
}
|
||||
|
||||
func (tk *guiWidget) deleteTree() {
|
||||
for _, child := range tk.children {
|
||||
child.deleteTree()
|
||||
}
|
||||
tk.Hide()
|
||||
}
|
||||
|
|
30
textbox.go
30
textbox.go
|
@ -7,7 +7,6 @@ package main
|
|||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
log "go.wit.com/log"
|
||||
|
@ -41,7 +40,7 @@ func initTextbox() {
|
|||
func (callertk *guiWidget) prepTextbox() {
|
||||
initTextbox()
|
||||
if me.textbox.tk == nil {
|
||||
log.Log(WARN, "prepTextbox() Is Broken")
|
||||
log.Log(GOCUI, "prepTextbox() Is Broken")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -52,35 +51,21 @@ func (callertk *guiWidget) prepTextbox() {
|
|||
r.w1 = r.w0 + 24
|
||||
r.h1 = r.h0 + 2
|
||||
me.textbox.tk.forceSizes(r)
|
||||
me.textbox.tk.dumpWidget("after sizes")
|
||||
// me.textbox.tk.dumpWidget("after sizes")
|
||||
|
||||
me.textbox.callerTK = callertk
|
||||
|
||||
if me.textbox.tk.v != nil {
|
||||
log.Log(WARN, "WARNING textbox DeleteView()")
|
||||
log.Log(WARN, "WARNING textbox DeleteView()")
|
||||
log.Log(WARN, "WARNING textbox DeleteView()")
|
||||
me.baseGui.DeleteView(me.textbox.tk.cuiName)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
|
||||
if err := me.textbox.tk.SetViewRect(r); err != nil {
|
||||
log.Log(WARN, "textbox SetViewRect() failed", err, "view name =", me.textbox.tk.cuiName)
|
||||
return
|
||||
}
|
||||
// me.textbox.tk.Show() // actually makes the gocui view. TODO: redo this?
|
||||
showTextbox(callertk.String())
|
||||
// showTextbox(callertk.String())
|
||||
}
|
||||
|
||||
func showTextbox(callers string) {
|
||||
// tk := me.textbox.tk
|
||||
// me.textbox.tk.dumpWidget("after sizes")
|
||||
log.Log(WARN, "showTextbox() caller string =", callers)
|
||||
|
||||
// me.textbox.tk.Show() // actually makes the gocui view. TODO: redo this
|
||||
|
||||
if me.textbox.tk.v == nil {
|
||||
log.Log(WARN, "textbox.tk.v == nil showTextbox() is broken")
|
||||
log.Info("wtf went wrong")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -93,8 +78,8 @@ func showTextbox(callers string) {
|
|||
me.textbox.tk.v.Editable = true
|
||||
me.textbox.tk.v.Wrap = true
|
||||
|
||||
me.textbox.tk.SetView()
|
||||
|
||||
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())
|
||||
|
||||
// bind the enter key to a function so we can close the textbox
|
||||
|
@ -102,8 +87,7 @@ func showTextbox(callers string) {
|
|||
|
||||
me.textbox.active = true
|
||||
|
||||
me.baseGui.SetViewOnTop(me.textbox.tk.v.Name())
|
||||
me.textbox.tk.dumpWidget("showTextbox()")
|
||||
// me.textbox.dumpWidget("showTextbox()")
|
||||
}
|
||||
|
||||
func theCloseTheTextbox(g *gocui.Gui, v *gocui.View) error {
|
||||
|
|
|
@ -41,14 +41,17 @@ func addWidget(n *tree.Node) {
|
|||
switch n.WidgetType {
|
||||
case widget.Root:
|
||||
log.Log(INFO, "setStartWH() rootNode w.id =", n.WidgetId, "w.name", n.String())
|
||||
// tk.color = &colorRoot
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Flag:
|
||||
// tk.color = &colorFlag
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Window:
|
||||
tk.frame = false
|
||||
tk.labelN = tk.GetText() + " X"
|
||||
// tk.setColor(&colorWindow)
|
||||
me.newWindowTrigger <- tk
|
||||
redoWindows(0, 0)
|
||||
return
|
||||
|
@ -59,6 +62,7 @@ func addWidget(n *tree.Node) {
|
|||
tk.isFake = true
|
||||
return
|
||||
case widget.Tab:
|
||||
// tk.color = &colorTab
|
||||
return
|
||||
case widget.Button:
|
||||
tk.setColorButton()
|
||||
|
@ -77,16 +81,20 @@ func addWidget(n *tree.Node) {
|
|||
case widget.Textbox:
|
||||
n.State.Label = ""
|
||||
tk.labelN = " "
|
||||
// tk.color = &colorDropdown
|
||||
tk.setColorInput()
|
||||
return
|
||||
case widget.Combobox:
|
||||
// tk.color = &colorCombobox
|
||||
tk.setColorInput()
|
||||
return
|
||||
case widget.Box:
|
||||
// tk.color = &colorBox
|
||||
tk.isFake = true
|
||||
setFake(n)
|
||||
return
|
||||
case widget.Grid:
|
||||
// tk.color = &colorGrid
|
||||
tk.isFake = true
|
||||
setFake(n)
|
||||
return
|
||||
|
@ -95,17 +103,7 @@ func addWidget(n *tree.Node) {
|
|||
tk.frame = false
|
||||
return
|
||||
case widget.Label:
|
||||
if tk.node.InTable() {
|
||||
if tk.node.State.AtH == 0 {
|
||||
// this is the table header
|
||||
tk.setColorLabelTable()
|
||||
} else {
|
||||
// todo: highlight the whole table row
|
||||
tk.setColorLabel()
|
||||
}
|
||||
} else {
|
||||
tk.setColorLabel()
|
||||
}
|
||||
tk.setColorLabel()
|
||||
tk.frame = false
|
||||
return
|
||||
default:
|
|
@ -193,7 +193,7 @@ func (tk *guiWidget) drawView() {
|
|||
switch tk.WidgetType() {
|
||||
case widget.Button:
|
||||
if tk.IsEnabled() {
|
||||
if tk.isDense() && tk.isInGrid() {
|
||||
if tk.isWindowDense() && tk.isInGrid() {
|
||||
tk.setColorButtonDense()
|
||||
} else {
|
||||
tk.setColorButton()
|
||||
|
@ -223,12 +223,17 @@ func (tk *guiWidget) drawView() {
|
|||
log.Log(INFO, "drawView() END")
|
||||
}
|
||||
|
||||
// redraw the widget tree starting at this location
|
||||
func (w *guiWidget) DrawAt(offsetW, offsetH int) {
|
||||
// w.setColor(&colorActiveW)
|
||||
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
||||
// w.dumpWidget(fmt.Sprintf("DrawAt(%d,%d)", offsetW, offsetH))
|
||||
}
|
||||
|
||||
func (w *guiWidget) simpleDrawAt(offsetW, offsetH int) {
|
||||
// w.setColor(&colorActiveW)
|
||||
w.dumpWidget("simpleDrawAt()")
|
||||
}
|
||||
|
||||
// display the widgets in the binary tree
|
||||
func (w *guiWidget) drawTree(draw bool) {
|
||||
if w == nil {
|
|
@ -7,6 +7,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/awesome-gocui/gocui"
|
||||
"go.wit.com/log"
|
||||
"go.wit.com/toolkits/tree"
|
||||
"go.wit.com/widget"
|
||||
|
@ -42,11 +43,7 @@ func initWidget(n *tree.Node) *guiWidget {
|
|||
return w
|
||||
}
|
||||
if p.TK == nil {
|
||||
if n.WidgetId == 0 {
|
||||
// this is a normal init condition
|
||||
} else {
|
||||
log.Log(ERROR, "parent.TK == nil", w.String(), n.WidgetId, w.WidgetType())
|
||||
}
|
||||
log.Log(ERROR, "parent.TK == nil", w.String(), n.WidgetId, w.WidgetType())
|
||||
return w
|
||||
}
|
||||
|
||||
|
@ -124,3 +121,34 @@ func (tk *guiWidget) SetVisible(b bool) {
|
|||
tk.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findWidgetByName(name string) *guiWidget {
|
||||
if tk.cuiName == name {
|
||||
return tk
|
||||
}
|
||||
for _, child := range tk.children {
|
||||
found := child.findWidgetByName(name)
|
||||
if found != nil {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (tk *guiWidget) findWidgetByView(v *gocui.View) *guiWidget {
|
||||
if tk.v == v {
|
||||
return tk
|
||||
}
|
||||
if tk.cuiName == v.Name() {
|
||||
log.Log(NOW, "findWidget() error. names are mismatched or out of sync", tk.cuiName)
|
||||
log.Log(NOW, "findWidget() or maybe the view has been deleted")
|
||||
// return tk
|
||||
}
|
||||
for _, child := range tk.children {
|
||||
found := child.findWidgetByView(v)
|
||||
if found != nil {
|
||||
return found
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
28
window.go
28
window.go
|
@ -100,7 +100,6 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
|||
|
||||
// set the window frame below the window widget, but this resizes the window widget it seems
|
||||
me.baseGui.SetViewBeneath(tk.windowFrame.cuiName, tk.cuiName, 1)
|
||||
|
||||
// so now we have to resize the window frame, but this moves it to the top?
|
||||
me.baseGui.SetView(tk.windowFrame.cuiName, tk.windowFrame.full.w0, tk.windowFrame.full.h0, tk.windowFrame.full.w1, tk.windowFrame.full.h1, 0)
|
||||
|
||||
|
@ -210,6 +209,13 @@ func (tk *guiWidget) makeWindowActive() {
|
|||
|
||||
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
|
||||
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
|
||||
|
||||
/*
|
||||
// print out the window list
|
||||
for _, tk := range me.allwin {
|
||||
log.Info("makeWindowActive() Window", tk.labelN, tk.window.active, tk.window.order)
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
func (tk *guiWidget) makeTK(ddItems []string) {
|
||||
|
@ -220,7 +226,25 @@ func (tk *guiWidget) makeTK(ddItems []string) {
|
|||
tk.gocuiSize.w1 = 120
|
||||
tk.gocuiSize.h0 = 15
|
||||
tk.gocuiSize.h1 = 18
|
||||
|
||||
/*
|
||||
var err error
|
||||
tk.v, err = me.baseGui.SetView(tk.cuiName,
|
||||
tk.gocuiSize.w0,
|
||||
tk.gocuiSize.h0,
|
||||
tk.gocuiSize.w1,
|
||||
tk.gocuiSize.h1, 0)
|
||||
if err != nil {
|
||||
log.Info("makeTK() err", err)
|
||||
return
|
||||
}
|
||||
if tk.v == nil {
|
||||
return
|
||||
}
|
||||
tk.v.Wrap = true
|
||||
tk.v.Frame = true
|
||||
tk.v.Clear()
|
||||
fmt.Fprint(tk.v, items)
|
||||
*/
|
||||
tk.Show()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue