66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
|
package main
|
||
|
|
||
|
import "log"
|
||
|
import "fmt"
|
||
|
import "time"
|
||
|
|
||
|
// import "os"
|
||
|
// import "fmt"
|
||
|
// import "github.com/gookit/config"
|
||
|
|
||
|
import "github.com/andlabs/ui"
|
||
|
import _ "github.com/andlabs/ui/winmanifest"
|
||
|
|
||
|
import "git.wit.com/wit/gui"
|
||
|
|
||
|
var cloudwin *ui.Window
|
||
|
var cloudtab *ui.Tab
|
||
|
var tabcount int
|
||
|
|
||
|
func main() {
|
||
|
// make this the main loop in an attempt to figure out the crashes
|
||
|
// do not change this until the GUI is stable
|
||
|
ui.Main(setupCloudUI)
|
||
|
}
|
||
|
|
||
|
// can not pass any args to this (?)
|
||
|
func setupCloudUI() {
|
||
|
cloudwin = ui.NewWindow("Cloud Control Panel", 640, 480, false)
|
||
|
cloudwin.OnClosing(func(*ui.Window) bool {
|
||
|
ui.Quit()
|
||
|
return true
|
||
|
})
|
||
|
ui.OnShouldQuit(func() bool {
|
||
|
cloudwin.Destroy()
|
||
|
return true
|
||
|
})
|
||
|
|
||
|
cloudtab = ui.NewTab()
|
||
|
cloudwin.SetChild(cloudtab)
|
||
|
cloudwin.SetMargined(true)
|
||
|
|
||
|
tabcount = 0
|
||
|
addTableTab()
|
||
|
// cloudtab.Append("Cloud Info", makeCloudInfoBox())
|
||
|
// cloudtab.SetMargined(tabcount, true)
|
||
|
|
||
|
cloudwin.Show()
|
||
|
}
|
||
|
|
||
|
func addTableTab() {
|
||
|
var parts []gui.TableColumnData
|
||
|
|
||
|
for key, foo := range []string{"BG", "TEXTCOLOR", "BUTTON", "TEXTCOLOR", "TEXTCOLOR", "TEXT", "BUTTON", "TEXT", "BUTTON"} {
|
||
|
log.Println(key, foo)
|
||
|
|
||
|
var b gui.TableColumnData
|
||
|
b.CellType = foo
|
||
|
b.Heading = fmt.Sprintf("heading%d", key)
|
||
|
parts = append(parts, b)
|
||
|
}
|
||
|
|
||
|
log.Println("Sleep for 2 seconds, then try to add new tabs")
|
||
|
time.Sleep(1 * 1000 * 1000 * 1000)
|
||
|
gui.AddTableTab(cloudtab, 0, "test seven", 7, parts)
|
||
|
}
|