vms tab now creates within the GUI goroutine
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
c4b46266b0
commit
0190410cc9
30
infoTabUI.go
30
infoTabUI.go
|
@ -15,10 +15,6 @@ import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
var cloudwin *ui.Window
|
|
||||||
var cloudtab *ui.Tab
|
|
||||||
var tabcount int
|
|
||||||
|
|
||||||
func makeCloudInfoBox(custom func(int, string)) *ui.Box {
|
func makeCloudInfoBox(custom func(int, string)) *ui.Box {
|
||||||
hbox := ui.NewHorizontalBox()
|
hbox := ui.NewHorizontalBox()
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
|
@ -79,25 +75,25 @@ func makeCloudInfoBox(custom func(int, string)) *ui.Box {
|
||||||
|
|
||||||
// can not pass any args to this (?)
|
// can not pass any args to this (?)
|
||||||
func setupCloudUI() {
|
func setupCloudUI() {
|
||||||
cloudwin = ui.NewWindow("Cloud Control Panel", config.Int("width"), config.Int("height"), false)
|
Data.cloudWindow = ui.NewWindow("Cloud Control Panel", config.Int("width"), config.Int("height"), false)
|
||||||
cloudwin.OnClosing(func(*ui.Window) bool {
|
Data.cloudWindow.OnClosing(func(*ui.Window) bool {
|
||||||
ui.Quit()
|
ui.Quit()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
ui.OnShouldQuit(func() bool {
|
ui.OnShouldQuit(func() bool {
|
||||||
cloudwin.Destroy()
|
Data.cloudWindow.Destroy()
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
|
||||||
cloudtab = ui.NewTab()
|
Data.cloudTab = ui.NewTab()
|
||||||
cloudwin.SetChild(cloudtab)
|
Data.cloudWindow.SetChild(Data.cloudTab)
|
||||||
cloudwin.SetMargined(true)
|
Data.cloudWindow.SetMargined(true)
|
||||||
|
|
||||||
tabcount = 0
|
Data.tabcount = 0
|
||||||
cloudtab.Append("Cloud Info", makeCloudInfoBox(nil))
|
Data.cloudTab.Append("Cloud Info", makeCloudInfoBox(nil))
|
||||||
cloudtab.SetMargined(tabcount, true)
|
Data.cloudTab.SetMargined(Data.tabcount, true)
|
||||||
|
|
||||||
cloudwin.Show()
|
Data.cloudWindow.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
func addTableTab() {
|
func addTableTab() {
|
||||||
|
@ -114,10 +110,10 @@ func addTableTab() {
|
||||||
|
|
||||||
log.Println("Sleep for 2 seconds, then try to add new tabs")
|
log.Println("Sleep for 2 seconds, then try to add new tabs")
|
||||||
time.Sleep(1 * 1000 * 1000 * 1000)
|
time.Sleep(1 * 1000 * 1000 * 1000)
|
||||||
AddTableTab(cloudtab, 1, "test seven", 7, parts)
|
AddTableTab(Data.cloudTab, 1, "test seven", 7, parts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func addVmsTab(count int) *TableData {
|
func AddVmsTab(count int) *TableData {
|
||||||
var parts []TableColumnData
|
var parts []TableColumnData
|
||||||
|
|
||||||
human := 0
|
human := 0
|
||||||
|
@ -171,7 +167,7 @@ func addVmsTab(count int) *TableData {
|
||||||
parts = append(parts, tmp)
|
parts = append(parts, tmp)
|
||||||
human += 1
|
human += 1
|
||||||
|
|
||||||
mh := AddTableTab(cloudtab, 1, "Virtual Machines", count, parts)
|
mh := AddTableTab(Data.cloudTab, 1, "Virtual Machines", count, parts)
|
||||||
return mh
|
return mh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue