104 lines
2.7 KiB
Go
104 lines
2.7 KiB
Go
package main
|
|
|
|
import "log"
|
|
import "os"
|
|
import "time"
|
|
// import "reflect"
|
|
|
|
// this is the king of dns libraries
|
|
// import "github.com/miekg/dns"
|
|
|
|
import "git.wit.org/wit/gui"
|
|
import pb "git.wit.org/jcarr/witProtobuf"
|
|
// import "git.wit.org/jcarr/dnssecsocket"
|
|
|
|
import "github.com/gobuffalo/packr"
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
|
|
var GITCOMMIT string // this is passed in as an ldflag
|
|
var GOVERSION string // this is passed in as an ldflag
|
|
var BUILDTIME string // this is passed in as an ldflag
|
|
var VERSION string // this is passed in as an ldflag
|
|
|
|
var State string // used as a State machine
|
|
|
|
type myButtonInfo struct {
|
|
Account *pb.Account // associated with what account?
|
|
Accounts []*pb.Account // associated with what account?
|
|
VM *pb.Event_VM // associated with which VM?
|
|
Custom func (*gui.GuiButton)
|
|
ADD func (*gui.GuiButton)
|
|
Name string
|
|
Action string
|
|
}
|
|
|
|
var packrBox packr.Box
|
|
|
|
func onExit(err error) {
|
|
os.Exit(0)
|
|
}
|
|
|
|
func main() {
|
|
packrBox = packr.NewBox("./resources")
|
|
|
|
parseConfig()
|
|
|
|
go gui.WatchGUI()
|
|
|
|
config.Hostname = "localhost"
|
|
config.IPv6 = "notvalid"
|
|
|
|
gui.Data.MouseClick = func (*gui.GuiButton) {
|
|
log.Println("mainMouseClick() BACK IN CONTROL PANEL CODE")
|
|
}
|
|
|
|
gui.Config.Width = int(config.Width)
|
|
gui.Config.Height = int(config.Height)
|
|
|
|
gui.Config.Debug = config.Debug
|
|
gui.Config.DebugTable = config.Debugtable
|
|
log.Println("gui.Config.Debug = ", gui.Config.Debug)
|
|
log.Println("gui.Config.DebugTable = ", gui.Config.DebugTable)
|
|
|
|
go gui.StartNewWindow(false, "test4", 1, showBox)
|
|
time.Sleep(time.Second * 2)
|
|
gui.StartNewWindow(false, "test5", 2, showBox)
|
|
}
|
|
|
|
func showBox(gw *gui.GuiWindow) *gui.GuiBox {
|
|
log.Println("ShowSplashBox() START")
|
|
|
|
box := gui.HardBox(gw, gui.Yaxis, "Cloud Accounts")
|
|
|
|
log.Println("showBox() START GW IS NOW: gw =", gw)
|
|
log.Println("showBox() box =", box)
|
|
|
|
gui.NewLabel(box, "Hostname:")
|
|
makeButton(box, nil, nil, "EMPTY", "SUBDOMAIN", nil)
|
|
makeButton(box, nil, nil, "List all windows & tabs", "SUBDOMAIN", func (*gui.GuiButton) {
|
|
log.Println("showBox() gui.DumpBoxes()")
|
|
gui.DumpBoxes()
|
|
})
|
|
|
|
return box
|
|
}
|
|
|
|
// stores the fields we want to map into our private structure 'values'
|
|
func makeGuiButtonValues(box *gui.GuiBox, a *pb.Account, vm *pb.Event_VM,
|
|
name string, action string, custom func(*gui.GuiButton)) *myButtonInfo {
|
|
val := &myButtonInfo{}
|
|
val.Account = a
|
|
val.Accounts = config.Accounts
|
|
val.VM = vm
|
|
val.Custom = custom
|
|
val.Name = "jcarr"
|
|
val.Action = action
|
|
return val
|
|
}
|
|
|
|
func makeButton(box *gui.GuiBox, a *pb.Account, vm *pb.Event_VM,
|
|
name string, action string, custom func(*gui.GuiButton)) *gui.GuiButton {
|
|
val := makeGuiButtonValues(box, a, vm, name, action, custom)
|
|
return gui.CreateButton(box, custom, name, val)
|
|
}
|