From a738650ca17f710ae66a5289b1961a45c529c9d3 Mon Sep 17 00:00:00 2001 From: Marcel Otte Date: Mon, 7 Mar 2022 23:24:02 +0100 Subject: [PATCH] Creating the layout base --- cmd/backive_ui/main.go | 15 +++++++++++++-- ui/ui_main.go | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 ui/ui_main.go diff --git a/cmd/backive_ui/main.go b/cmd/backive_ui/main.go index 721c49a..c6d4f59 100644 --- a/cmd/backive_ui/main.go +++ b/cmd/backive_ui/main.go @@ -2,13 +2,24 @@ package main import ( "fyne.io/fyne/v2/app" - "fyne.io/fyne/v2/widget" + + "github.com/qwc/backive" + backiveui "github.com/qwc/backive/ui" +) + +var ( + config backive.Configuration + database backive.Database ) func main() { + + database.Load() + config.Load() app := app.New() w := app.NewWindow("Hello World!") + backiveui.Init(app, w, config, database) - w.SetContent(widget.NewLabel("Hello World!")) + //w.SetContent(widget.NewLabel("Hello World!")) w.ShowAndRun() } diff --git a/ui/ui_main.go b/ui/ui_main.go new file mode 100644 index 0000000..49c7923 --- /dev/null +++ b/ui/ui_main.go @@ -0,0 +1,34 @@ +package ui + +import ( + "fyne.io/fyne/v2" + "fyne.io/fyne/v2/container" + "fyne.io/fyne/v2/layout" + "fyne.io/fyne/v2/widget" + "github.com/qwc/backive" +) + +var ( + app fyne.App + window fyne.Window + config backive.Configuration + db backive.Database + + accord *widget.Accordion + center *fyne.Container +) + +func Init(a fyne.App, w fyne.Window, c backive.Configuration, d backive.Database) { + app = a + window = w + config = c + db = d + SetupLayout() +} + +func SetupLayout() { + accord = widget.NewAccordion() + center := container.NewMax() + content := container.New(layout.NewBorderLayout(nil, nil, accord, nil), accord, center) + window.SetContent(content) +}