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
+18 -10
View File
@@ -67,6 +67,7 @@ type (
var (
Serie_triggered bool = false
Disable bool
)
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.SetText(ConfigSerie)
mw.serie_combo.CurrentIndexChanged().Attach(func() {
if !Serie_triggered {
for _, color := range mw.beads {
if color.Series != mw.serie_combo.Text() {
color.Color.SetVisible(false)
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 {
color.Color.SetVisible(true)
Disable = false
}
}
for _, model := range mw.Pegboards.Boards {
if model.brand == mw.brand_combo.Text() && model.serie == mw.serie_combo.Text() {
mw.pegboard_combo.SetModel(model.model)
}
if Disable {
color.Color.SetVisible(false)
} 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)