0.2.2 Color updating. /JL

This commit is contained in:
2022-12-18 22:59:49 +01:00
parent 8e2bae5203
commit e325df9fbb
3 changed files with 22 additions and 24 deletions

View File

@@ -17,8 +17,8 @@ type (
info *walk.ImageView
warning *walk.ImageView
Brand string
Series string
Weight int
Series []string
Weight []int
Name string
ColorID int
Red byte
@@ -62,12 +62,7 @@ func LoadBeads(mw *MyMainWindow) {
log.Println("Loading bead: " + bead.ColorName + " ...")
if !bead.Disabled {
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
for _, series := range brand.Series {
if series.Serie == mw.serie_combo.Text() {
bc.Series = series.Serie
bc.Weight = series.Weight
}
}
bc.Series = bead.Series.Serie
bc.Brand = brand.BrandName
bc.Name = bead.ColorName
bc.ColorID = bead.ColorIndex
@@ -162,8 +157,3 @@ func (bc *BeadColor) SetInStock(inStock bool) {
func (bc *BeadColor) GetColorID() int {
return bc.ColorID
}
func (bc *BeadColor) AddOnHand(grams int) {
addbeads := grams / bc.Weight * 1000
bc.onHand += int(addbeads)
}

View File

@@ -30,7 +30,7 @@ type MyMainWindow struct {
const (
AppName string = "BeadImager"
Version string = "0.2.1"
Version string = "0.2.2"
CopyRight string = "©2022 Jan Lerking"
STD_MESS string = "Ready"
LogFile string = "BeadImager.log"

View File

@@ -67,6 +67,7 @@ type (
var (
Serie_triggered bool = false
Disable bool
)
func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
@@ -98,9 +99,16 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
mw.serie_combo.SetModel(CreateSeriesList(mw))
mw.serie_combo.SetText(ConfigSerie)
mw.serie_combo.CurrentIndexChanged().Attach(func() {
if !Serie_triggered {
log.Println("Serie triggered: ", mw.serie_combo.Text())
for _, color := range mw.beads {
if color.Series != 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)
@@ -108,11 +116,11 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
}
for _, model := range mw.Pegboards.Boards {
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
mw.pegboard_combo.SetText("")
mw.pegboard_combo.SetModel(model.model)
log.Println("Pegboard model set to: ", model.model)
}
}
Serie_triggered = true
}
})
comp, _ = walk.NewComposite(pallette_group)
comp.SetLayout(walk.NewHBoxLayout())