101 lines
2.4 KiB
Go
101 lines
2.4 KiB
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
// "bufio"
|
|
// "os"
|
|
"runtime"
|
|
// "runtime/debug"
|
|
// "runtime/pprof"
|
|
// "time"
|
|
|
|
"git.wit.org/wit/gui"
|
|
// "git.wit.org/wit/shell"
|
|
|
|
// "github.com/andlabs/ui"
|
|
// _ "github.com/andlabs/ui/winmanifest"
|
|
)
|
|
|
|
// var jcarrtest *gui.GuiBox
|
|
// var jcarrnode *gui.Node
|
|
|
|
// TODO: convert this so it works in a tab
|
|
func showSplashTab(n *gui.Node) *gui.Node {
|
|
log.Println("ShowSplashBox() START")
|
|
|
|
// box.Window.UiWindow.SetTitle("Debugging2")
|
|
|
|
ny1 := n.AddHorizontalBox("tile1")
|
|
ny1.NewLabel("bar")
|
|
|
|
ny1.NewLabel("OS: "+runtime.GOOS)
|
|
ny1.NewLabel("Version: "+VERSION)
|
|
ny1.NewLabel("git commit: "+GITCOMMIT)
|
|
ny1.NewLabel("GO Version: "+GOVERSION)
|
|
|
|
ny1.AddButton("Delete tab 0", func(*gui.Node) {
|
|
// n.UiTab.Delete(0)
|
|
})
|
|
|
|
// log.Println("ShowSplashBox() END box =", box)
|
|
return ny1
|
|
}
|
|
|
|
func runTestExecClick(n *gui.Node) {
|
|
log.Println("runTestExecClick START")
|
|
if runtime.GOOS == "linux" {
|
|
var tmp []string
|
|
tmp = append(tmp, "nohup", "xterm")
|
|
go runCommand(tmp)
|
|
// go runSimpleCommand("xterm -report-fonts")
|
|
} else if runtime.GOOS == "windows" {
|
|
go runSimpleCommand("mintty.exe")
|
|
} else {
|
|
var tmp []string
|
|
tmp = append(tmp, "nohup", "xterm")
|
|
go runCommand(tmp)
|
|
}
|
|
log.Println("runTestExecClick END")
|
|
}
|
|
|
|
func populateDebugTab(n *gui.Node) {
|
|
log.Println("debugClick() START")
|
|
|
|
/////////////////////////////// Column BLAH ///////////////////////////////
|
|
gNode := n.AddGroup("blah")
|
|
|
|
gNode.AddButton("bash", runTestExecClick)
|
|
gNode.AddButton("ping", func (*gui.Node) {
|
|
hostname := "localhost"
|
|
xterm("ping " + hostname)
|
|
})
|
|
gNode.AddButton("systrayMain", func (*gui.Node) {
|
|
go systrayMain()
|
|
})
|
|
|
|
/////////////////////////////// Column DEBUG GUI /////////////////////////
|
|
gNode.AddButton("closed = true", func (*gui.Node) {
|
|
closed = true
|
|
})
|
|
gNode.AddButton("closed = false", func (*gui.Node) {
|
|
closed = false
|
|
})
|
|
gNode.AddButton("loopsleep = 2", func (*gui.Node) {
|
|
loopsleep = 2
|
|
})
|
|
gNode.AddButton("toggle systray menu", func (*gui.Node) {
|
|
var tmp struct{}
|
|
// log.Println("is tmp uninitialized:", tmp == nil)
|
|
log.Println("is mChecked uninitialized:", mChecked == nil)
|
|
if mChecked != nil {
|
|
log.Println("is mChecked.ClickedCh uninitialized:", mChecked.ClickedCh == nil)
|
|
if mChecked.ClickedCh != nil {
|
|
mChecked.ClickedCh <- tmp // signal the main goroutine
|
|
}
|
|
}
|
|
})
|
|
|
|
// FIXME: need correct args
|
|
// gNode.CreateColorButton("COLOR73", "COLOR73", nil)
|
|
}
|