Skip to content

Instantly share code, notes, and snippets.

@rfay
Created March 10, 2020 19:34
Show Gist options
  • Save rfay/85aeb42ba7175f331639a259885a6e4d to your computer and use it in GitHub Desktop.
Save rfay/85aeb42ba7175f331639a259885a6e4d to your computer and use it in GitHub Desktop.
fyneApp := fapp.New()
window := fyneApp.NewWindow("DDEV-Local")
s := fyne.NewSize(1, 0)
nameLabel := widget.NewLabel("Project")
nameLabel.Resize(s)
nameCol := []fyne.CanvasObject{nameLabel}
typeCol := []fyne.CanvasObject{widget.NewLabel("Type")}
locCol := []fyne.CanvasObject{widget.NewLabel("Location")}
urlCol := []fyne.CanvasObject{widget.NewLabel("URL")}
statusCol := []fyne.CanvasObject{widget.NewLabel("Status")}
//var nameCol, typeCol, locCol, urlCol, statusCol []fyne.CanvasObject
for _, app := range apps {
desc, err := app.Describe()
if err != nil {
util.Error("Failed to describe project %s: %v", app.GetName(), err)
}
nameLabel := widget.NewLabel(desc["name"].(string))
nameLabel.Resize(s)
ms := nameLabel.MinSize()
fmt.Printf("nameLabel ms=%v", ms)
nameCol = append(nameCol, nameLabel)
//nameCol = append(nameCol, widget.NewLabel(desc["name"].(string)))
typeCol = append(typeCol, widget.NewLabel(desc["type"].(string)))
locCol = append(locCol, widget.NewLabel(desc["approot"].(string)))
x := widget.NewHyperlink(desc["httpsurl"].(string), nil)
_ = x.SetURLFromString(desc["httpsurl"].(string))
urlCol = append(urlCol, x)
statusCol = append(statusCol, widget.NewLabel(desc["status"].(string)))
}
nameCont := fyne.NewContainerWithLayout(layout.NewGridLayout(1), nameCol...)
fmt.Printf("nameCont ms=%v nameCont size=%v", nameCont.MinSize(), nameCont.Size())
typeCont := fyne.NewContainerWithLayout(layout.NewGridLayout(1), typeCol...)
locCont := fyne.NewContainerWithLayout(layout.NewGridLayout(1), locCol...)
urlCont := fyne.NewContainerWithLayout(layout.NewGridLayout(1), urlCol...)
statusCont := fyne.NewContainerWithLayout(layout.NewGridLayout(1), statusCol...)
window.SetContent(
fyne.NewContainerWithLayout(layout.NewGridLayoutWithRows(1),
nameCont, typeCont, locCont, urlCont, statusCont,
//fyne.NewContainerWithLayout(layout.NewGridLayout(1), nameCol...),
//fyne.NewContainerWithLayout(layout.NewGridLayout(1), typeCol...),
//fyne.NewContainerWithLayout(layout.NewGridLayout(1), locCol...),
//fyne.NewContainerWithLayout(layout.NewGridLayout(1), urlCol...),
//fyne.NewContainerWithLayout(layout.NewGridLayout(1), statusCol...)),
))
window.ShowAndRun()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment