0.2.3 Pallette updating working. /JL
This commit is contained in:
@@ -29,6 +29,18 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func ShowBeads(mw *MyMainWindow, serie string) {
|
||||||
|
log.Println("Showing beads...")
|
||||||
|
for _, bead := range mw.beads {
|
||||||
|
bead.Color.SetVisible(false)
|
||||||
|
for _, s := range bead.Series {
|
||||||
|
if s == serie {
|
||||||
|
bead.Color.SetVisible(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func CreateBeadsGroup(mw *MyMainWindow) {
|
func CreateBeadsGroup(mw *MyMainWindow) {
|
||||||
gb, _ := walk.NewGroupBox(mw.leftPanel)
|
gb, _ := walk.NewGroupBox(mw.leftPanel)
|
||||||
gb.SetTitle("Beads")
|
gb.SetTitle("Beads")
|
||||||
@@ -46,38 +58,29 @@ func CreateBeadsGroup(mw *MyMainWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func LoadBeads(mw *MyMainWindow) {
|
func LoadBeads(mw *MyMainWindow) {
|
||||||
var located bool
|
|
||||||
|
|
||||||
for _, brand := range mw.pallette.Brand {
|
for _, brand := range mw.pallette.Brand {
|
||||||
if brand.BrandName == mw.brand_combo.Text() {
|
if brand.BrandName == mw.brand_combo.Text() {
|
||||||
log.Println("Loading beads for brand: " + brand.BrandName + " ...")
|
log.Println("Loading beads for brand: " + brand.BrandName + " ...")
|
||||||
log.Println("Loading beads for serie: " + mw.serie_combo.Text() + " ...")
|
log.Println("Loading beads for serie: " + mw.serie_combo.Text() + " ...")
|
||||||
for _, bead := range brand.Colors {
|
for _, bead := range brand.Colors {
|
||||||
for _, serie := range bead.Series.Serie {
|
log.Println("Loading bead: " + bead.ColorName + " ...")
|
||||||
if serie == mw.serie_combo.Text() {
|
if !bead.Disabled {
|
||||||
located = true
|
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
|
||||||
}
|
bc.Series = bead.Series.Serie
|
||||||
}
|
bc.Brand = brand.BrandName
|
||||||
if located {
|
bc.Name = bead.ColorName
|
||||||
log.Println("Loading bead: " + bead.ColorName + " ...")
|
bc.ColorID = bead.ColorIndex
|
||||||
if !bead.Disabled {
|
bc.Red = bead.Red
|
||||||
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
|
bc.Green = bead.Green
|
||||||
bc.Series = bead.Series.Serie
|
bc.Blue = bead.Blue
|
||||||
bc.Brand = brand.BrandName
|
bc.inStock = bead.InStock
|
||||||
bc.Name = bead.ColorName
|
mw.beads = append(mw.beads, bc)
|
||||||
bc.ColorID = bead.ColorIndex
|
if bead.OnHand <= 200 {
|
||||||
bc.Red = bead.Red
|
bc.warning.SetVisible(true)
|
||||||
bc.Green = bead.Green
|
bc.info.SetVisible(false)
|
||||||
bc.Blue = bead.Blue
|
} else {
|
||||||
bc.inStock = bead.InStock
|
bc.warning.SetVisible(false)
|
||||||
mw.beads = append(mw.beads, bc)
|
bc.info.SetVisible(true)
|
||||||
if bead.OnHand <= 200 {
|
|
||||||
bc.warning.SetVisible(true)
|
|
||||||
bc.info.SetVisible(false)
|
|
||||||
} else {
|
|
||||||
bc.warning.SetVisible(false)
|
|
||||||
bc.info.SetVisible(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.2.2"
|
Version string = "0.2.3"
|
||||||
CopyRight string = "©2022 Jan Lerking"
|
CopyRight string = "©2022 Jan Lerking"
|
||||||
STD_MESS string = "Ready"
|
STD_MESS string = "Ready"
|
||||||
LogFile string = "BeadImager.log"
|
LogFile string = "BeadImager.log"
|
||||||
|
|||||||
+2
-14
@@ -100,20 +100,7 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
|||||||
mw.serie_combo.SetText(ConfigSerie)
|
mw.serie_combo.SetText(ConfigSerie)
|
||||||
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
||||||
log.Println("Serie triggered: ", mw.serie_combo.Text())
|
log.Println("Serie triggered: ", mw.serie_combo.Text())
|
||||||
for _, color := range mw.beads {
|
ShowBeads(mw, mw.serie_combo.Text())
|
||||||
for _, serie := range color.Series {
|
|
||||||
if serie != mw.serie_combo.Text() {
|
|
||||||
Disable = true
|
|
||||||
} else {
|
|
||||||
Disable = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if Disable {
|
|
||||||
color.Color.SetVisible(false)
|
|
||||||
} else {
|
|
||||||
color.Color.SetVisible(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for _, model := range mw.Pegboards.Boards {
|
for _, model := range mw.Pegboards.Boards {
|
||||||
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
|
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
|
||||||
mw.pegboard_combo.SetText("")
|
mw.pegboard_combo.SetText("")
|
||||||
@@ -135,6 +122,7 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mw.pegboard_combo.SetText(ConfigPegboard)
|
mw.pegboard_combo.SetText(ConfigPegboard)
|
||||||
|
ShowBeads(mw, mw.serie_combo.Text())
|
||||||
return pallette_group
|
return pallette_group
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user