0.2.2 Color updating. /JL
This commit is contained in:
16
color.go
16
color.go
@@ -17,8 +17,8 @@ type (
|
|||||||
info *walk.ImageView
|
info *walk.ImageView
|
||||||
warning *walk.ImageView
|
warning *walk.ImageView
|
||||||
Brand string
|
Brand string
|
||||||
Series string
|
Series []string
|
||||||
Weight int
|
Weight []int
|
||||||
Name string
|
Name string
|
||||||
ColorID int
|
ColorID int
|
||||||
Red byte
|
Red byte
|
||||||
@@ -62,12 +62,7 @@ func LoadBeads(mw *MyMainWindow) {
|
|||||||
log.Println("Loading bead: " + bead.ColorName + " ...")
|
log.Println("Loading bead: " + bead.ColorName + " ...")
|
||||||
if !bead.Disabled {
|
if !bead.Disabled {
|
||||||
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
|
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
|
||||||
for _, series := range brand.Series {
|
bc.Series = bead.Series.Serie
|
||||||
if series.Serie == mw.serie_combo.Text() {
|
|
||||||
bc.Series = series.Serie
|
|
||||||
bc.Weight = series.Weight
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bc.Brand = brand.BrandName
|
bc.Brand = brand.BrandName
|
||||||
bc.Name = bead.ColorName
|
bc.Name = bead.ColorName
|
||||||
bc.ColorID = bead.ColorIndex
|
bc.ColorID = bead.ColorIndex
|
||||||
@@ -162,8 +157,3 @@ func (bc *BeadColor) SetInStock(inStock bool) {
|
|||||||
func (bc *BeadColor) GetColorID() int {
|
func (bc *BeadColor) GetColorID() int {
|
||||||
return bc.ColorID
|
return bc.ColorID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) AddOnHand(grams int) {
|
|
||||||
addbeads := grams / bc.Weight * 1000
|
|
||||||
bc.onHand += int(addbeads)
|
|
||||||
}
|
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -30,7 +30,7 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.2.1"
|
Version string = "0.2.2"
|
||||||
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"
|
||||||
|
|||||||
28
pallette.go
28
pallette.go
@@ -67,6 +67,7 @@ type (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
Serie_triggered bool = false
|
Serie_triggered bool = false
|
||||||
|
Disable bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
||||||
@@ -98,20 +99,27 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
|||||||
mw.serie_combo.SetModel(CreateSeriesList(mw))
|
mw.serie_combo.SetModel(CreateSeriesList(mw))
|
||||||
mw.serie_combo.SetText(ConfigSerie)
|
mw.serie_combo.SetText(ConfigSerie)
|
||||||
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
||||||
if !Serie_triggered {
|
log.Println("Serie triggered: ", mw.serie_combo.Text())
|
||||||
for _, color := range mw.beads {
|
for _, color := range mw.beads {
|
||||||
if color.Series != mw.serie_combo.Text() {
|
for _, serie := range color.Series {
|
||||||
color.Color.SetVisible(false)
|
if serie != mw.serie_combo.Text() {
|
||||||
|
Disable = true
|
||||||
} else {
|
} else {
|
||||||
color.Color.SetVisible(true)
|
Disable = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, model := range mw.Pegboards.Boards {
|
if Disable {
|
||||||
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
|
color.Color.SetVisible(false)
|
||||||
mw.pegboard_combo.SetModel(model.model)
|
} else {
|
||||||
}
|
color.Color.SetVisible(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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, _ = walk.NewComposite(pallette_group)
|
||||||
|
|||||||
Reference in New Issue
Block a user