0.0.12 Added Groupboxes. /JL

This commit is contained in:
2022-12-11 17:34:42 +01:00
parent 05fbb17ff6
commit ee07323106
3 changed files with 52 additions and 30 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ type (
func LoadBeads(mw *MyMainWindow) { func LoadBeads(mw *MyMainWindow) {
for _, brand := range mw.pallette.Brands.Brand { for _, brand := range mw.pallette.Brands.Brand {
if brand.BrandName == mw.pallette_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 + " ...")
for _, series := range brand.Series.Serie { for _, series := range brand.Series.Serie {
if series.SerieName == mw.serie_combo.Text() { if series.SerieName == mw.serie_combo.Text() {
+46 -24
View File
@@ -14,7 +14,7 @@ type MyMainWindow struct {
properties *walk.ScrollView properties *walk.ScrollView
pallette Pallette pallette Pallette
beads []*BeadColor beads []*BeadColor
pallette_combo *walk.ComboBox brand_combo *walk.ComboBox
brand_model []string brand_model []string
serie_combo *walk.ComboBox serie_combo *walk.ComboBox
serie_model []string serie_model []string
@@ -24,7 +24,7 @@ type MyMainWindow struct {
const ( const (
AppName string = "BeadImager" AppName string = "BeadImager"
Version string = "0.0.11" Version string = "0.0.12"
CopyRight string = "©2022 Jan Lerking" CopyRight string = "©2022 Jan Lerking"
STD_MESS string = "Ready" STD_MESS string = "Ready"
UserPath string = "C:\\Users\\janle\\BeadImager" UserPath string = "C:\\Users\\janle\\BeadImager"
@@ -45,31 +45,32 @@ func main() {
CreatePallette(mw) CreatePallette(mw)
log.Println("Pallette created: ", mw.pallette) log.Println("Pallette created: ", mw.pallette)
mw.brand_model = CreateBrandsList(mw) mw.brand_model = CreateBrandsList(mw)
pallette_trigged := false brand_trigged := false
serie_trigged := false serie_trigged := false
pegboard_trigged := false pegboard_trigged := false
DD_Pallette := Composite{ DD_Pallette := GroupBox{
Layout: VBox{MarginsZero: true}, Title: "Pallette",
Layout: VBox{},
Children: []Widget{ Children: []Widget{
Composite{ Composite{
Layout: HBox{MarginsZero: true}, Layout: HBox{MarginsZero: true},
Children: []Widget{ Children: []Widget{
Label{ Label{
Text: "Pallette:", Text: "Brand:",
}, },
ComboBox{ ComboBox{
Alignment: AlignHFarVCenter, Alignment: AlignHFarVCenter,
AssignTo: &mw.pallette_combo, AssignTo: &mw.brand_combo,
Model: mw.brand_model, Model: mw.brand_model,
OnCurrentIndexChanged: func() { OnCurrentIndexChanged: func() {
if !pallette_trigged { if !brand_trigged {
log.Println("Pallette changed to: ", mw.pallette_combo.Text()) log.Println("Brand changed to: ", mw.brand_combo.Text())
mw.serie_model = CreateSeriesList(mw) mw.serie_model = CreateSeriesList(mw)
mw.serie_combo.SetModel(mw.serie_model) mw.serie_combo.SetModel(mw.serie_model)
mw.serie_combo.SetEnabled(true) mw.serie_combo.SetEnabled(true)
} }
pallette_trigged = true brand_trigged = true
}, },
}, },
}, },
@@ -120,21 +121,10 @@ func main() {
}, },
} }
if _, err := (MainWindow{ DD_Beads := GroupBox{
AssignTo: &mw.MainWindow, Title: "Beads",
Title: AppName + " " + Version, Layout: VBox{},
MinSize: Size{800, 600},
Layout: VBox{MarginsZero: true},
Children: []Widget{ Children: []Widget{
Composite{
Layout: HBox{},
Children: []Widget{
Composite{
Layout: VBox{MarginsZero: true},
MaxSize: Size{200, 0},
Children: []Widget{
DD_Pallette,
PushButton{ PushButton{
Text: "Select all colors", Text: "Select all colors",
OnClicked: func() { OnClicked: func() {
@@ -148,11 +138,41 @@ func main() {
Layout: VBox{MarginsZero: true}, Layout: VBox{MarginsZero: true},
}, },
}, },
}
if _, err := (MainWindow{
AssignTo: &mw.MainWindow,
Title: AppName + " " + Version,
MinSize: Size{800, 600},
Layout: VBox{MarginsZero: true},
Children: []Widget{
Composite{
Layout: HBox{},
Children: []Widget{
Composite{
Layout: VBox{MarginsZero: true},
MaxSize: Size{220, 0},
Children: []Widget{
DD_Pallette,
DD_Beads,
}, },
},
GroupBox{
Title: "Canvas",
Layout: VBox{},
Children: []Widget{
ScrollView{ ScrollView{
AssignTo: &mw.canvas, AssignTo: &mw.canvas,
Layout: VBox{MarginsZero: true}, Layout: VBox{MarginsZero: true},
}, },
},
},
GroupBox{
Title: "Settings",
Layout: VBox{},
MaxSize: Size{220, 0},
Children: []Widget{
ScrollView{ ScrollView{
AssignTo: &mw.properties, AssignTo: &mw.properties,
Layout: VBox{MarginsZero: true}, Layout: VBox{MarginsZero: true},
@@ -160,6 +180,8 @@ func main() {
}, },
}, },
}, },
},
},
}.Run()); err != nil { }.Run()); err != nil {
log.Fatal(err) log.Fatal(err)
} }
+2 -2
View File
@@ -73,7 +73,7 @@ type (
func CreatePegboardsList(mw *MyMainWindow) []string { func CreatePegboardsList(mw *MyMainWindow) []string {
pegboards := make([]string, 0) pegboards := make([]string, 0)
for _, brand := range mw.pallette.Brands.Brand { for _, brand := range mw.pallette.Brands.Brand {
if brand.BrandName == mw.pallette_combo.Text() { if brand.BrandName == mw.brand_combo.Text() {
for _, serie := range brand.Series.Serie { for _, serie := range brand.Series.Serie {
if serie.SerieName == mw.serie_combo.Text() { if serie.SerieName == mw.serie_combo.Text() {
for _, pegboard := range serie.Pegboards.Pegboard { for _, pegboard := range serie.Pegboards.Pegboard {
@@ -89,7 +89,7 @@ func CreatePegboardsList(mw *MyMainWindow) []string {
func CreateSeriesList(mw *MyMainWindow) []string { func CreateSeriesList(mw *MyMainWindow) []string {
series := make([]string, 0) series := make([]string, 0)
for _, brand := range mw.pallette.Brands.Brand { for _, brand := range mw.pallette.Brands.Brand {
if brand.BrandName == mw.pallette_combo.Text() { if brand.BrandName == mw.brand_combo.Text() {
for _, serie := range brand.Series.Serie { for _, serie := range brand.Series.Serie {
series = append(series, serie.SerieName) series = append(series, serie.SerieName)
} }