wit-debian-gui/watch.go

89 lines
1.8 KiB
Go

// a custom build target for go
//go:generate go get -v github.com/tv42/becky
//go:generate go install github.com/tv42/becky
//go:generate becky README.md
package main
import (
"log"
"runtime/debug"
"time"
)
type myChan struct {
Width int
Height int
}
// This goroutine will
func watchWindows() {
var i = 1
for {
log.Println("wait for GUI exit()", i)
i += 1
time.Sleep(loopsleep * time.Second / 10)
// dotest()
if closed {
log.Println("Window was closed")
/*
if dnsSlider == nil {
log.Println("SKIPPING: dnsSlider == nil")
} else {
dnsSlider.SetValue(55)
}
*/
// gui.CreateWindow("ARGV", "vars", 300, 200, makeWindowARGV)
debug.PrintStack()
dumpModuleInfo()
/*
gui.DumpBoxes()
window := gui.Data.WindowMap["Debugging2"]
if window != nil {
log.Println("found debugging2 Window")
gui.DeleteWindow("Debugging2")
} else {
closed = false
}
*/
// toggle the systray menu
var tmp struct{}
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
}
}
}
}
}
func dumpModuleInfo() {
tmp, _ := debug.ReadBuildInfo()
if tmp == nil {
log.Println("This wasn't compiled with go module support")
return
}
log.Println("mod.Path = ", tmp.Path)
log.Println("mod.Main.Path = ", tmp.Main.Path)
log.Println("mod.Main.Version = ", tmp.Main.Version)
log.Println("mod.Main.Sum = ", tmp.Main.Sum)
for _, value := range tmp.Deps {
log.Println("\tmod.Path = ", value.Path)
log.Println("\tmod.Version = ", value.Version)
}
}
func dumbLoop() {
var i = 1
for {
log.Println("dumb GUI loop ", i)
i += 1
time.Sleep(2 * time.Second)
}
}