flush out a debugging tab
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
a557c4a042
commit
860a026ee0
86
gui-debug.go
86
gui-debug.go
|
@ -1,8 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
// import "fmt"
|
||||||
|
import "time"
|
||||||
|
import "runtime"
|
||||||
|
import "os/exec"
|
||||||
|
import "strings"
|
||||||
|
|
||||||
import "git.wit.com/wit/gui"
|
import "git.wit.com/wit/gui"
|
||||||
|
// import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
|
import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
// import "github.com/andlabs/ui"
|
// import "github.com/andlabs/ui"
|
||||||
// import _ "github.com/andlabs/ui/winmanifest"
|
// import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
@ -24,11 +32,81 @@ func debugClick(b *gui.GuiButton) {
|
||||||
gui.HorizontalBreak(box)
|
gui.HorizontalBreak(box)
|
||||||
makeButton(box, nil, nil, "Create Subdomain Account", "ADD", addSubdomainClick)
|
makeButton(box, nil, nil, "Create Subdomain Account", "ADD", addSubdomainClick)
|
||||||
box = gui.HardBox(gw, gui.Xaxis, "subdomain test")
|
box = gui.HardBox(gw, gui.Xaxis, "subdomain test")
|
||||||
makeButton(box, nil, nil, "Generate 1", "SUBDOMAIN", nil)
|
makeButton(box, nil, nil, "ping", "SUBDOMAIN", runPingClick)
|
||||||
makeButton(box, nil, nil, "Generate 2", "SUBDOMAIN", nil)
|
makeButton(box, nil, nil, "Cross platform shell test", "SUBDOMAIN", runTestExecClick)
|
||||||
makeButton(box, nil, nil, "Generate 3", "SUBDOMAIN", func (*gui.GuiButton) {
|
makeButton(box, nil, nil, "Generate 3", "SUBDOMAIN", nil)
|
||||||
log.Println("debugClick() Generate 3")
|
makeButton(box, nil, nil, "Generate 4", "SUBDOMAIN", nil)
|
||||||
|
|
||||||
|
box = gui.NewBox(box, gui.Yaxis, "subdomain Y test")
|
||||||
|
makeButton(box, nil, nil, "List all windows & tabs", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
|
log.Println("debugClick() Hide()")
|
||||||
|
box := gw.BoxMap["MAINBOX"]
|
||||||
|
box.Window.UiTab.Hide()
|
||||||
})
|
})
|
||||||
|
makeButton(box, nil, nil, "Hide all tabs", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
|
log.Println("debugClick() Hide()")
|
||||||
|
box := gw.BoxMap["MAINBOX"]
|
||||||
|
box.Window.UiTab.Hide()
|
||||||
|
})
|
||||||
|
makeButton(box, nil, nil, "Hide sleep Show", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
|
log.Println("debugClick() Hide()")
|
||||||
|
box := gw.BoxMap["MAINBOX"]
|
||||||
|
box.Window.UiTab.Hide()
|
||||||
|
time.Sleep(2000 * time.Millisecond)
|
||||||
|
box.Window.UiTab.Show()
|
||||||
|
})
|
||||||
|
makeButton(box, nil, nil, "Destroy tab 0", "SUBDOMAIN", func (*gui.GuiButton) {
|
||||||
|
log.Println("debugClick() Destroy(0)")
|
||||||
|
box := gw.BoxMap["MAINBOX"]
|
||||||
|
box.Window.UiTab.Delete(0)
|
||||||
|
})
|
||||||
|
makeButton(box, nil, nil, "Generate 76", "SUBDOMAIN", nil)
|
||||||
|
|
||||||
log.Println("debugClick() END box =", box)
|
log.Println("debugClick() END box =", box)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func runPingClick(b *gui.GuiButton) {
|
||||||
|
log.Println("runPingClick START")
|
||||||
|
values, _ := b.Values.(*myButtonInfo)
|
||||||
|
log.Println("runTestExecClick values.VM", values.VM)
|
||||||
|
hostname := "localhost"
|
||||||
|
if (values.VM != nil) {
|
||||||
|
hostname = values.VM.Hostname
|
||||||
|
}
|
||||||
|
spew.Dump(b)
|
||||||
|
var tmp []string
|
||||||
|
tmp = append(tmp, "xterm", "-geometry", "120x30", "-e", "ping " + hostname + ";sleep 3")
|
||||||
|
go runCommand(tmp)
|
||||||
|
log.Println("runPingClick END")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runTestExecClick(b *gui.GuiButton) {
|
||||||
|
log.Println("runTestExecClick START")
|
||||||
|
if runtime.GOOS == "linux" {
|
||||||
|
go runSimpleCommand("xterm -report-fonts")
|
||||||
|
} else if runtime.GOOS == "windows" {
|
||||||
|
go runSimpleCommand("mintty.exe")
|
||||||
|
} else {
|
||||||
|
go runSimpleCommand("xterm")
|
||||||
|
}
|
||||||
|
log.Println("runTestExecClick END")
|
||||||
|
}
|
||||||
|
|
||||||
|
func runSimpleCommand(s string) {
|
||||||
|
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
|
||||||
|
cmdArgs := strings.Fields(cmd)
|
||||||
|
runCommand(cmdArgs)
|
||||||
|
}
|
||||||
|
|
||||||
|
func runCommand(cmdArgs []string) {
|
||||||
|
log.Println("runCommand() START", cmdArgs)
|
||||||
|
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
|
||||||
|
// process := exec.Command("xterm", "-e", "ping localhost")
|
||||||
|
log.Println("runCommand() process.Start()")
|
||||||
|
process.Start()
|
||||||
|
log.Println("runCommand() process.Wait()")
|
||||||
|
process.Wait()
|
||||||
|
log.Println("runCommand() NEED TO CHECK THE TIME HERE TO SEE IF THIS WORKED")
|
||||||
|
log.Println("runCommand() OTHERWISE INFORM THE USER")
|
||||||
|
log.Println("runCommand() END")
|
||||||
|
}
|
||||||
|
|
|
@ -2,15 +2,10 @@ package main
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
import "fmt"
|
import "fmt"
|
||||||
import "runtime"
|
|
||||||
import "os/exec"
|
|
||||||
import "strings"
|
|
||||||
|
|
||||||
import "git.wit.com/wit/gui"
|
import "git.wit.com/wit/gui"
|
||||||
import pb "git.wit.com/wit/witProtobuf"
|
import pb "git.wit.com/wit/witProtobuf"
|
||||||
|
|
||||||
import "github.com/davecgh/go-spew/spew"
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// THIS IS THE STANDARD VM DISPLAY TABLE
|
// THIS IS THE STANDARD VM DISPLAY TABLE
|
||||||
// This maps the 'human' indexed cells in the table
|
// This maps the 'human' indexed cells in the table
|
||||||
|
@ -138,61 +133,3 @@ func createVmBox(gw *gui.GuiWindow, vm *pb.Event_VM) {
|
||||||
makeButton(box, nil, vm, "Save", "SAVE", nil)
|
makeButton(box, nil, vm, "Save", "SAVE", nil)
|
||||||
makeButton(box, nil, vm, "Done", "DONE", nil)
|
makeButton(box, nil, vm, "Done", "DONE", nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTestHide(b *gui.GuiButton) {
|
|
||||||
/*
|
|
||||||
log.Println("runTestHide START")
|
|
||||||
Data.Window1.Box1.Hide()
|
|
||||||
Data.Window1.Box2.Hide()
|
|
||||||
// time.Sleep(2000 * time.Millisecond)
|
|
||||||
Data.State = "HIDE"
|
|
||||||
log.Println("runTestHide END")
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
func runPingClick(b *gui.GuiButton) {
|
|
||||||
log.Println("runPingClick START")
|
|
||||||
values, _ := b.Values.(*myButtonInfo)
|
|
||||||
log.Println("runTestExecClick values.VM", values.VM)
|
|
||||||
hostname := "localhost"
|
|
||||||
if (values.VM != nil) {
|
|
||||||
hostname = values.VM.Hostname
|
|
||||||
}
|
|
||||||
spew.Dump(b)
|
|
||||||
var tmp []string
|
|
||||||
tmp = append(tmp, "xterm", "-geometry", "120x30", "-e", "ping " + hostname + ";sleep 3")
|
|
||||||
go runCommand(tmp)
|
|
||||||
log.Println("runPingClick END")
|
|
||||||
}
|
|
||||||
|
|
||||||
func runTestExecClick(b *gui.GuiButton) {
|
|
||||||
log.Println("runTestExecClick START")
|
|
||||||
if runtime.GOOS == "linux" {
|
|
||||||
go runSimpleCommand("xterm -report-fonts")
|
|
||||||
} else if runtime.GOOS == "windows" {
|
|
||||||
go runSimpleCommand("mintty.exe")
|
|
||||||
} else {
|
|
||||||
go runSimpleCommand("xterm")
|
|
||||||
}
|
|
||||||
log.Println("runTestExecClick END")
|
|
||||||
}
|
|
||||||
|
|
||||||
func runSimpleCommand(s string) {
|
|
||||||
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
|
|
||||||
cmdArgs := strings.Fields(cmd)
|
|
||||||
runCommand(cmdArgs)
|
|
||||||
}
|
|
||||||
|
|
||||||
func runCommand(cmdArgs []string) {
|
|
||||||
log.Println("runCommand() START", cmdArgs)
|
|
||||||
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
|
|
||||||
// process := exec.Command("xterm", "-e", "ping localhost")
|
|
||||||
log.Println("runCommand() process.Start()")
|
|
||||||
process.Start()
|
|
||||||
log.Println("runCommand() process.Wait()")
|
|
||||||
process.Wait()
|
|
||||||
log.Println("runCommand() NEED TO CHECK THE TIME HERE TO SEE IF THIS WORKED")
|
|
||||||
log.Println("runCommand() OTHERWISE INFORM THE USER")
|
|
||||||
log.Println("runCommand() END")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue