more work on the ever illusive floating stdout window
This commit is contained in:
parent
4a8fb6ab22
commit
517d844b3c
10
Makefile
10
Makefile
|
@ -1,10 +1,14 @@
|
||||||
VERSION = $(shell git describe --tags)
|
VERSION = $(shell git describe --tags)
|
||||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||||
|
|
||||||
all: gocui.so
|
all: goimports vet gocui
|
||||||
@#ldd gocui.so
|
@ldd gocui.so
|
||||||
|
|
||||||
gocui.so: goimports
|
vet:
|
||||||
|
@GO111MODULE=off go vet
|
||||||
|
@echo this go plugin builds okay
|
||||||
|
|
||||||
|
gocui:
|
||||||
GO111MODULE=off go build -v -work -buildmode=plugin -o gocui.so \
|
GO111MODULE=off go build -v -work -buildmode=plugin -o gocui.so \
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
|
|
4
debug.go
4
debug.go
|
@ -55,6 +55,10 @@ func (w *guiWidget) dumpWidget(s string) {
|
||||||
if w.node.WidgetType == widget.Box {
|
if w.node.WidgetType == widget.Box {
|
||||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String())
|
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String())
|
||||||
} else {
|
} else {
|
||||||
|
curval := w.String()
|
||||||
|
if curval == "" {
|
||||||
|
curval = w.node.GetLabel()
|
||||||
|
}
|
||||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String())
|
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String())
|
||||||
}
|
}
|
||||||
log.Log(NOW, s1, s, end)
|
log.Log(NOW, s1, s, end)
|
||||||
|
|
|
@ -124,7 +124,6 @@ func doPanic(g *gocui.Gui, v *gocui.View) error {
|
||||||
log.Log(GOCUI, "do panic() here")
|
log.Log(GOCUI, "do panic() here")
|
||||||
standardClose()
|
standardClose()
|
||||||
panic("forced panic in gocui")
|
panic("forced panic in gocui")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dumpWidgets(g *gocui.Gui, v *gocui.View) error {
|
func dumpWidgets(g *gocui.Gui, v *gocui.View) error {
|
||||||
|
|
|
@ -132,5 +132,4 @@ func click(g *gocui.Gui, v *gocui.View) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
8
init.go
8
init.go
|
@ -77,9 +77,9 @@ func standardClose() {
|
||||||
me.baseGui.Close()
|
me.baseGui.Close()
|
||||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||||
outf.Close()
|
outf.Close()
|
||||||
os.Stdin = os.Stdin
|
// os.Stdin = os.Stdin
|
||||||
os.Stdout = os.Stdout
|
// os.Stdout = os.Stdout
|
||||||
os.Stderr = os.Stderr
|
// os.Stderr = os.Stderr
|
||||||
log.Log(NOW, "standardExit() send back Quit()")
|
log.Log(NOW, "standardExit() send back Quit()")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func mainGogui() {
|
||||||
|
|
||||||
outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
outf, err = os.OpenFile("/tmp/captureMode.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err, "error opening file: %v")
|
log.Info("error opening file:", err)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
origStdout = os.Stdout
|
origStdout = os.Stdout
|
||||||
|
|
|
@ -40,6 +40,7 @@ func newAdd(n *tree.Node) {
|
||||||
w.Show()
|
w.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for gocui as a GUI plugin, SetTitle & SetLabel are identical to SetText
|
||||||
func newSetTitle(n *tree.Node, s string) {
|
func newSetTitle(n *tree.Node, s string) {
|
||||||
newSetText(n, s)
|
newSetText(n, s)
|
||||||
}
|
}
|
||||||
|
@ -48,6 +49,9 @@ func newSetLabel(n *tree.Node, s string) {
|
||||||
newSetText(n, s)
|
newSetText(n, s)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// newSetText() and newAddText() are simple. They take the event sent
|
||||||
|
// to the GO plugin from the application and lookup the plugin structure
|
||||||
|
// then pass that event to gocui. This is the transfer point
|
||||||
func newSetText(n *tree.Node, s string) {
|
func newSetText(n *tree.Node, s string) {
|
||||||
if n == nil {
|
if n == nil {
|
||||||
log.Warn("Tree Error: Add() sent n == nil")
|
log.Warn("Tree Error: Add() sent n == nil")
|
||||||
|
@ -180,6 +184,7 @@ func (w *guiWidget) SetText(text string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (w *guiWidget) Set(val any) {
|
func (w *guiWidget) Set(val any) {
|
||||||
if w == nil {
|
if w == nil {
|
||||||
log.Log(WARN, "Set() w == nil. val =", val)
|
log.Log(WARN, "Set() w == nil. val =", val)
|
||||||
|
@ -196,3 +201,4 @@ func (w *guiWidget) Set(val any) {
|
||||||
w.labelN = widget.GetString(val)
|
w.labelN = widget.GetString(val)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue