diff --git a/rex_client/Makefile b/rex_client/Makefile index 0a14788..b15f637 100644 --- a/rex_client/Makefile +++ b/rex_client/Makefile @@ -1,16 +1,16 @@ NAME = rexclient -build: commit.txt - go build -tags no_emoji -trimpath -ldflags="-s -w" -buildvcs=false -o $(NAME) - run: commit.txt go run . debug: commit.txt go run -tags debug,hints . +build: commit.txt + go build -tags no_emoji -trimpath -ldflags="-s -w" -buildvcs=false -o $(NAME) + commit.txt: go generate clean: - rm -f $(NAME) + rm -f rexclient diff --git a/rex_client/main.go b/rex_client/main.go index a7815c0..2b06fb5 100644 --- a/rex_client/main.go +++ b/rex_client/main.go @@ -1,15 +1,14 @@ package main import ( - _ "embed" "fmt" "time" + _ "embed" "fyne.io/fyne/v2" "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/layout" - "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" ) @@ -32,39 +31,6 @@ func (s *MyStruct) Download() { fmt.Printf("Downloading %s...\n", s.Name) } -var myList = []MyStruct{ - {"AtlasLoot"}, - {"Bartender4"}, - {"Deadly Boss Mods"}, - {"Details! Damage Meter"}, - {"WeakAuras"}, - {"ElvUI"}, - {"BigWigs"}, - {"Recount"}, - {"GatherMate2"}, - {"TomTom"}, - {"Questie"}, - {"TradeSkillMaster"}, - {"HandyNotes"}, - {"Bagnon"}, - {"Threat Plates"}, - {"GTFO"}, - {"Plater Nameplates"}, - {"Rarity"}, - {"Pawn"}, - {"Auctioneer"}, - {"Shadowed Unit Frames"}, - {"SexyMap"}, - {"TidyPlates"}, - {"MoveAnything"}, - {"Postal"}, - {"OmniCC"}, - {"Leatrix Plus"}, - {"SimulationCraft"}, - {"VuhDo"}, - {"KuiNameplates"}, -} - func main() { clock := widget.NewLabel("") formatted := time.Now().Format("Time: 03:04:05") @@ -74,29 +40,26 @@ func main() { w := a.NewWindow(fmt.Sprintf("RexForge %s", git_rev)) w.Resize(fyne.NewSize(900, 600)) - list := widget.NewList( - func() int { - return len(myList) - }, - func() fyne.CanvasObject { - btn := widget.NewButton("", func() {}) - label := widget.NewLabel("") + myList := []MyStruct{ + {"AtlasLoot"}, + {"Bartender4"}, + {"Deadly Boss Mods"}, + } - return container.NewBorder(nil, nil, label, btn) - }, - func(i widget.ListItemID, o fyne.CanvasObject) { - o.(*fyne.Container).RemoveAll() + listContainer := container.NewVBox() - btn := widget.NewButtonWithIcon("Download", theme.DownloadIcon(), func() { - myList[i].Download() - }) - btn.Importance = widget.LowImportance - - label := widget.NewLabel(myList[i].Name) - - row := container.NewBorder(nil, nil, label, btn) - o.(*fyne.Container).Add(row) + for _, item := range myList { + current := item + namelabel := widget.NewLabel(current.Name) + dlbutton := widget.NewButton("Download", func() { + current.Download() }) + dlbutton.Importance = widget.LowImportance + + spacer := layout.NewSpacer() + ct := container.NewHBox(namelabel, spacer, dlbutton) + listContainer.Add(ct) + } go func() { for range time.Tick(time.Second) { @@ -104,31 +67,25 @@ func main() { } }() - refresh_button := widget.NewButtonWithIcon("Refresh", theme.ViewRefreshIcon(), func() { + refresh_button := widget.NewButton("Refresh", func() { println("Refresh") }) - upall_button := widget.NewButtonWithIcon("Update All", theme.DownloadIcon(), func() { + upall_button := widget.NewButton("Update All", func() { println("Update All") }) - about_button := widget.NewButtonWithIcon("About", theme.InfoIcon(), func() { + about_button := widget.NewButton("About", func() { println("About") }) - settings_button := widget.NewButtonWithIcon("Settings", theme.SettingsIcon(), func() { + settings_button := widget.NewButton("Settings", func() { println("Settings") }) - toprow := container.NewVBox(container.NewHBox(refresh_button, upall_button, - clock, layout.NewSpacer(), about_button, settings_button), - widget.NewSeparator()) + toprow := container.NewHBox(refresh_button, upall_button, clock, layout.NewSpacer(), about_button, settings_button) - c := container.New( - layout.NewBorderLayout(toprow, nil, nil, nil), - toprow, - container.NewStack(list), - ) + c := container.New(layout.NewVBoxLayout(), toprow, widget.NewSeparator(), listContainer) w.SetContent(c)