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)
|
||||
BUILDTIME = $(shell date +%Y.%m.%d)
|
||||
|
||||
all: gocui.so
|
||||
@#ldd gocui.so
|
||||
all: goimports vet gocui
|
||||
@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 \
|
||||
-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 {
|
||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.node.State.Direction.String())
|
||||
} else {
|
||||
curval := w.String()
|
||||
if curval == "" {
|
||||
curval = w.node.GetLabel()
|
||||
}
|
||||
end = fmt.Sprintf("%5s %-8s %s", w.cuiName, w.node.WidgetType, w.String())
|
||||
}
|
||||
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")
|
||||
standardClose()
|
||||
panic("forced panic in gocui")
|
||||
return nil
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
8
init.go
8
init.go
|
@ -77,9 +77,9 @@ func standardClose() {
|
|||
me.baseGui.Close()
|
||||
log.Log(NOW, "standardExit() doing outf.Close()")
|
||||
outf.Close()
|
||||
os.Stdin = os.Stdin
|
||||
os.Stdout = os.Stdout
|
||||
os.Stderr = os.Stderr
|
||||
// os.Stdin = os.Stdin
|
||||
// os.Stdout = os.Stdout
|
||||
// os.Stderr = os.Stderr
|
||||
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)
|
||||
if err != nil {
|
||||
log.Error(err, "error opening file: %v")
|
||||
log.Info("error opening file:", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
origStdout = os.Stdout
|
||||
|
|
|
@ -40,6 +40,7 @@ func newAdd(n *tree.Node) {
|
|||
w.Show()
|
||||
}
|
||||
|
||||
// for gocui as a GUI plugin, SetTitle & SetLabel are identical to SetText
|
||||
func newSetTitle(n *tree.Node, s string) {
|
||||
newSetText(n, s)
|
||||
}
|
||||
|
@ -48,6 +49,9 @@ func newSetLabel(n *tree.Node, s string) {
|
|||
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) {
|
||||
if 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) {
|
||||
if w == nil {
|
||||
log.Log(WARN, "Set() w == nil. val =", val)
|
||||
|
@ -196,3 +201,4 @@ func (w *guiWidget) Set(val any) {
|
|||
w.labelN = widget.GetString(val)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue