2019-05-10 01:25:27 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
// import "time"
|
|
|
|
// import "fmt"
|
|
|
|
|
2019-05-10 03:21:32 -05:00
|
|
|
import "github.com/gookit/config"
|
2019-05-10 01:25:27 -05:00
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
|
|
|
2019-05-10 03:21:32 -05:00
|
|
|
var jwcmainwin *ui.Window
|
|
|
|
var jwcmaintab *ui.Tab
|
|
|
|
var tabcount int
|
2019-05-10 01:25:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
func makeCloudInfoBox() ui.Control {
|
|
|
|
hbox := ui.NewHorizontalBox()
|
|
|
|
hbox.SetPadded(true)
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
|
|
|
hbox.Append(vbox, false)
|
|
|
|
|
|
|
|
vbox.Append(ui.NewDatePicker(), false)
|
|
|
|
vbox.Append(ui.NewTimePicker(), false)
|
|
|
|
vbox.Append(ui.NewDateTimePicker(), false)
|
|
|
|
vbox.Append(ui.NewFontButton(), false)
|
|
|
|
vbox.Append(ui.NewColorButton(), false)
|
|
|
|
|
|
|
|
mybutton := ui.NewButton("Test List VMs")
|
|
|
|
mybutton.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("send over socket")
|
|
|
|
})
|
|
|
|
vbox.Append(mybutton, false)
|
2019-05-10 03:21:32 -05:00
|
|
|
vbox.Append(ui.NewLabel("Hostname:"), false)
|
2019-05-10 01:25:27 -05:00
|
|
|
|
|
|
|
hbox.Append(ui.NewVerticalSeparator(), false)
|
|
|
|
|
|
|
|
vbox = ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(true)
|
|
|
|
hbox.Append(vbox, true)
|
|
|
|
|
|
|
|
grid := ui.NewGrid()
|
|
|
|
grid.SetPadded(true)
|
|
|
|
vbox.Append(grid, false)
|
|
|
|
|
|
|
|
button := ui.NewButton("Open File")
|
|
|
|
entry := ui.NewEntry()
|
|
|
|
entry.SetReadOnly(true)
|
|
|
|
button.OnClicked(func(*ui.Button) {
|
|
|
|
/*
|
|
|
|
filename := ui.OpenFile(mainwin)
|
|
|
|
if filename == "" {
|
|
|
|
filename = "(cancelled)"
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
entry.SetText("FIXME")
|
|
|
|
})
|
|
|
|
grid.Append(button,
|
|
|
|
0, 0, 1, 1,
|
|
|
|
false, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
grid.Append(entry,
|
|
|
|
1, 0, 1, 1,
|
|
|
|
true, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
|
|
|
|
button = ui.NewButton("Save File")
|
|
|
|
entry2 := ui.NewEntry()
|
|
|
|
entry2.SetReadOnly(true)
|
|
|
|
button.OnClicked(func(*ui.Button) {
|
|
|
|
/*
|
|
|
|
filename := ui.SaveFile(mainwin)
|
|
|
|
if filename == "" {
|
|
|
|
filename = "(cancelled)"
|
|
|
|
}
|
|
|
|
entry2.SetText(filename)
|
|
|
|
*/
|
|
|
|
entry.SetText("FIXME")
|
|
|
|
})
|
|
|
|
grid.Append(button,
|
|
|
|
0, 1, 1, 1,
|
|
|
|
false, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
grid.Append(entry2,
|
|
|
|
1, 1, 1, 1,
|
|
|
|
true, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
|
|
|
|
msggrid := ui.NewGrid()
|
|
|
|
msggrid.SetPadded(true)
|
|
|
|
grid.Append(msggrid,
|
|
|
|
0, 2, 2, 1,
|
|
|
|
false, ui.AlignCenter, false, ui.AlignStart)
|
|
|
|
|
|
|
|
button = ui.NewButton("Message Box")
|
|
|
|
button.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("FIXEME")
|
|
|
|
/*
|
|
|
|
ui.MsgBox(mainwin,
|
|
|
|
"This is a normal message box.",
|
|
|
|
"More detailed information can be shown here.")
|
|
|
|
*/
|
|
|
|
})
|
|
|
|
msggrid.Append(button,
|
|
|
|
0, 0, 1, 1,
|
|
|
|
false, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
button = ui.NewButton("Error Box")
|
|
|
|
button.OnClicked(func(*ui.Button) {
|
|
|
|
log.Println("FIXEME")
|
|
|
|
/*
|
|
|
|
ui.MsgBoxError(mainwin,
|
|
|
|
"This message box describes an error.",
|
|
|
|
"More detailed information can be shown here.")
|
|
|
|
*/
|
|
|
|
})
|
|
|
|
msggrid.Append(button,
|
|
|
|
1, 0, 1, 1,
|
|
|
|
false, ui.AlignFill, false, ui.AlignFill)
|
|
|
|
|
2019-05-10 03:21:32 -05:00
|
|
|
vbox.Append(ui.NewLabel("Hostname:"), false)
|
|
|
|
vbox.Append(ui.NewLabel("librem15.lab.wit.com"), false)
|
|
|
|
|
|
|
|
|
|
|
|
entryForm := ui.NewForm()
|
|
|
|
entryForm.SetPadded(true)
|
|
|
|
vbox.Append(entryForm, false)
|
|
|
|
|
|
|
|
hostnameEntry := ui.NewEntry()
|
|
|
|
entryForm.Append("hostname:", hostnameEntry, false)
|
|
|
|
hostnameEntry.SetText("librem15.lab.wit.com")
|
|
|
|
|
|
|
|
IPv6entry := ui.NewEntry()
|
|
|
|
entryForm.Append("IPv6:", IPv6entry, false)
|
|
|
|
IPv6entry.SetText("2604:bbc0:3:3:0:10:0:1003")
|
|
|
|
|
2019-05-10 01:25:27 -05:00
|
|
|
return hbox
|
|
|
|
}
|
2019-05-10 03:21:32 -05:00
|
|
|
|
|
|
|
func setupCloudUI() {
|
|
|
|
jwcmainwin = ui.NewWindow("Cloud Control Panel", config.Int("width"), config.Int("height"), false)
|
|
|
|
jwcmainwin.OnClosing(func(*ui.Window) bool {
|
|
|
|
ui.Quit()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
ui.OnShouldQuit(func() bool {
|
|
|
|
jwcmainwin.Destroy()
|
|
|
|
return true
|
|
|
|
})
|
|
|
|
|
|
|
|
jwcmaintab = ui.NewTab()
|
|
|
|
jwcmainwin.SetChild(jwcmaintab)
|
|
|
|
jwcmainwin.SetMargined(true)
|
|
|
|
|
|
|
|
tabcount = 0
|
|
|
|
jwcmaintab.Append("Cloud Info", makeCloudInfoBox())
|
|
|
|
jwcmaintab.SetMargined(tabcount, true)
|
|
|
|
|
|
|
|
|
|
|
|
jwcmainwin.Show()
|
|
|
|
}
|