0.2.5 Beads onhand updating working. /JL
This commit is contained in:
19
color.go
19
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
|
||||
|
2
main.go
2
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"
|
||||
|
16
pallette.go
16
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
|
||||
}
|
||||
|
@@ -33,6 +33,10 @@
|
||||
<type>Square 14x14</type>
|
||||
<size>14</size>
|
||||
</pegboard>
|
||||
<pegboard serie="Midi">
|
||||
<type>Round 29</type>
|
||||
<size>29</size>
|
||||
</pegboard>
|
||||
<pegboard serie="Maxi">
|
||||
<type>Square 16x16</type>
|
||||
<size>16</size>
|
||||
@@ -1094,7 +1098,7 @@
|
||||
</serie>
|
||||
<serie name="Midi">
|
||||
<inStock>true</inStock>
|
||||
<onHand>100</onHand>
|
||||
<onHand>500</onHand>
|
||||
</serie>
|
||||
<serie name="Maxi">
|
||||
<inStock>true</inStock>
|
||||
@@ -1121,7 +1125,7 @@
|
||||
</serie>
|
||||
<serie name="Midi">
|
||||
<inStock>true</inStock>
|
||||
<onHand>100</onHand>
|
||||
<onHand>500</onHand>
|
||||
</serie>
|
||||
<serie name="Maxi">
|
||||
<inStock>true</inStock>
|
||||
@@ -1148,7 +1152,7 @@
|
||||
</serie>
|
||||
<serie name="Midi">
|
||||
<inStock>true</inStock>
|
||||
<onHand>100</onHand>
|
||||
<onHand>500</onHand>
|
||||
</serie>
|
||||
<serie name="Maxi">
|
||||
<inStock>true</inStock>
|
||||
|
Reference in New Issue
Block a user