From 387aef521d539e90dc0f5765a4fe2c38e2857b54 Mon Sep 17 00:00:00 2001 From: Lerking Date: Tue, 20 Dec 2022 00:13:16 +0100 Subject: [PATCH] 0.2.5 Beads onhand updating working. /JL --- color.go | 19 ++++++++++--------- main.go | 2 +- pallette.go | 16 +++++++++------- pallettes/pallette.xml | 10 +++++++--- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/color.go b/color.go index f7b7ece..7c196fa 100644 --- a/color.go +++ b/color.go @@ -40,6 +40,15 @@ func ShowBeads(mw *MyMainWindow, serie string) { for _, s := range bead.Series { if s.Name == serie { bead.Color.SetVisible(true) + bead.InfoTooltip.SetText(bead.info, "Approx. "+fmt.Sprint(s.onHand)+" left on hand") + bead.WarningTooltip.SetText(bead.warning, "Only "+fmt.Sprint(s.onHand)+" left on hand") + if s.onHand <= 200 { + bead.warning.SetVisible(true) + bead.info.SetVisible(false) + } else { + bead.warning.SetVisible(false) + bead.info.SetVisible(true) + } } } } @@ -59,6 +68,7 @@ func CreateBeadsGroup(mw *MyMainWindow) { mw.colors, _ = walk.NewScrollView(gb) mw.colors.SetLayout(walk.NewVBoxLayout()) LoadBeads(mw) + ShowBeads(mw, mw.serie_combo.Text()) } func LoadBeads(mw *MyMainWindow) { @@ -76,15 +86,6 @@ func LoadBeads(mw *MyMainWindow) { se.inStock = s.InStock se.onHand = s.OnHand bc.Series = append(bc.Series, se) - bc.InfoTooltip.SetText(bc.info, "Approx. "+fmt.Sprint(se.onHand)+" left on hand") - bc.WarningTooltip.SetText(bc.warning, "Only "+fmt.Sprint(se.onHand)+" left on hand") - if se.onHand <= 200 { - bc.warning.SetVisible(true) - bc.info.SetVisible(false) - } else { - bc.warning.SetVisible(false) - bc.info.SetVisible(true) - } } bc.Brand = brand.BrandName bc.Name = bead.ColorName diff --git a/main.go b/main.go index 182a5a8..b15e805 100644 --- a/main.go +++ b/main.go @@ -30,7 +30,7 @@ type MyMainWindow struct { const ( AppName string = "BeadImager" - Version string = "0.2.4" + Version string = "0.2.5" CopyRight string = "©2022 Jan Lerking" STD_MESS string = "Ready" LogFile string = "BeadImager.log" diff --git a/pallette.go b/pallette.go index 4af4539..b37e91b 100644 --- a/pallette.go +++ b/pallette.go @@ -35,13 +35,8 @@ type ( Colorstruct struct { Series struct { - XMLName xml.Name `xml:"series"` - Serie []struct { - XMLName xml.Name `xml:"serie"` - Name string `xml:"name,attr"` - InStock bool `xml:"inStock"` - OnHand int `xml:"onHand"` - } + XMLName xml.Name `xml:"series"` + Serie []SerieData `xml:"serie"` } ColorIndex int `xml:"colorIndex,attr"` ColorName string `xml:"colorname"` @@ -57,6 +52,13 @@ type ( Disabled bool `xml:"disabled"` } + SerieData struct { + XMLName xml.Name `xml:"serie"` + Name string `xml:"name,attr"` + InStock bool `xml:"inStock"` + OnHand int `xml:"onHand"` + } + Pegboards struct { Boards []Pegboard } diff --git a/pallettes/pallette.xml b/pallettes/pallette.xml index f502e5e..e890fdb 100644 --- a/pallettes/pallette.xml +++ b/pallettes/pallette.xml @@ -33,6 +33,10 @@ Square 14x14 14 + + Round 29 + 29 + Square 16x16 16 @@ -1094,7 +1098,7 @@ true - 100 + 500 true @@ -1121,7 +1125,7 @@ true - 100 + 500 true @@ -1148,7 +1152,7 @@ true - 100 + 500 true