0.2.3 Pallette updating working. /JL
This commit is contained in:
21
color.go
21
color.go
@@ -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) {
|
||||
gb, _ := walk.NewGroupBox(mw.leftPanel)
|
||||
gb.SetTitle("Beads")
|
||||
@@ -46,19 +58,11 @@ func CreateBeadsGroup(mw *MyMainWindow) {
|
||||
}
|
||||
|
||||
func LoadBeads(mw *MyMainWindow) {
|
||||
var located bool
|
||||
|
||||
for _, brand := range mw.pallette.Brand {
|
||||
if brand.BrandName == mw.brand_combo.Text() {
|
||||
log.Println("Loading beads for brand: " + brand.BrandName + " ...")
|
||||
log.Println("Loading beads for serie: " + mw.serie_combo.Text() + " ...")
|
||||
for _, bead := range brand.Colors {
|
||||
for _, serie := range bead.Series.Serie {
|
||||
if serie == mw.serie_combo.Text() {
|
||||
located = true
|
||||
}
|
||||
}
|
||||
if located {
|
||||
log.Println("Loading bead: " + bead.ColorName + " ...")
|
||||
if !bead.Disabled {
|
||||
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.OnHand, bead.Red, bead.Green, bead.Blue)
|
||||
@@ -82,7 +86,6 @@ func LoadBeads(mw *MyMainWindow) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func NewBeadColor(mw *MyMainWindow, name string, id int, onhand int, red byte, green byte, blue byte) *BeadColor {
|
||||
|
||||
2
main.go
2
main.go
@@ -30,7 +30,7 @@ type MyMainWindow struct {
|
||||
|
||||
const (
|
||||
AppName string = "BeadImager"
|
||||
Version string = "0.2.2"
|
||||
Version string = "0.2.3"
|
||||
CopyRight string = "©2022 Jan Lerking"
|
||||
STD_MESS string = "Ready"
|
||||
LogFile string = "BeadImager.log"
|
||||
|
||||
16
pallette.go
16
pallette.go
@@ -100,20 +100,7 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
||||
mw.serie_combo.SetText(ConfigSerie)
|
||||
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
||||
log.Println("Serie triggered: ", mw.serie_combo.Text())
|
||||
for _, color := range mw.beads {
|
||||
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)
|
||||
}
|
||||
}
|
||||
ShowBeads(mw, mw.serie_combo.Text())
|
||||
for _, model := range mw.Pegboards.Boards {
|
||||
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
|
||||
mw.pegboard_combo.SetText("")
|
||||
@@ -135,6 +122,7 @@ func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
||||
}
|
||||
}
|
||||
mw.pegboard_combo.SetText(ConfigPegboard)
|
||||
ShowBeads(mw, mw.serie_combo.Text())
|
||||
return pallette_group
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user