Client changes, now uses rex model

This commit is contained in:
Imbus 2025-01-26 11:21:26 +01:00
parent 7b4fb82ab7
commit f769adfee6
2 changed files with 8 additions and 47 deletions

View file

@ -1,4 +1,4 @@
module rexforge module rex_client
go 1.23.4 go 1.23.4

View file

@ -11,63 +11,24 @@ import (
"fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
)
// Define your custom struct model "rex_model"
type MyStruct struct { )
Name string
}
//go:generate sh -c "printf %s $(git rev-parse --short HEAD) > commit.txt" //go:generate sh -c "printf %s $(git rev-parse --short HEAD) > commit.txt"
//go:embed commit.txt //go:embed commit.txt
var git_rev string var git_rev string
// Download method for the struct
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() { func main() {
a := app.New() a := app.New()
w := a.NewWindow(fmt.Sprintf("RexForge %s", strings.ToUpper(git_rev))) w := a.NewWindow(fmt.Sprintf("RexForge %s", strings.ToUpper(git_rev)))
w.Resize(fyne.NewSize(900, 600)) w.Resize(fyne.NewSize(900, 600))
addons := model.AddonIndex
list := widget.NewList( list := widget.NewList(
func() int { func() int {
return len(myList) return len(addons)
}, },
func() fyne.CanvasObject { func() fyne.CanvasObject {
btn := widget.NewButton("", func() {}) btn := widget.NewButton("", func() {})
@ -79,11 +40,11 @@ func main() {
o.(*fyne.Container).RemoveAll() o.(*fyne.Container).RemoveAll()
btn := widget.NewButtonWithIcon("Download", theme.DownloadIcon(), func() { btn := widget.NewButtonWithIcon("Download", theme.DownloadIcon(), func() {
myList[i].Download() fmt.Println("Downloading: " + addons[i])
}) })
btn.Importance = widget.LowImportance btn.Importance = widget.LowImportance
label := widget.NewLabel(myList[i].Name) label := widget.NewLabel(addons[i])
row := container.NewBorder(nil, nil, label, btn) row := container.NewBorder(nil, nil, label, btn)
o.(*fyne.Container).Add(row) o.(*fyne.Container).Add(row)