0.1.0 Refactoring from declarative. /JL
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
type MyMainWindow struct {
|
type MyMainWindow struct {
|
||||||
*walk.MainWindow
|
*walk.MainWindow
|
||||||
|
leftPanel *walk.Composite
|
||||||
colors *walk.ScrollView
|
colors *walk.ScrollView
|
||||||
canvasScroll *walk.ScrollView
|
canvasScroll *walk.ScrollView
|
||||||
drawWidget *walk.CustomWidget
|
drawWidget *walk.CustomWidget
|
||||||
@@ -28,7 +29,7 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.0.28"
|
Version string = "0.1.0"
|
||||||
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"
|
||||||
@@ -188,6 +189,7 @@ func main() {
|
|||||||
Layout: VBox{MarginsZero: true},
|
Layout: VBox{MarginsZero: true},
|
||||||
Children: []Widget{
|
Children: []Widget{
|
||||||
Composite{
|
Composite{
|
||||||
|
AssignTo: &mw.leftPanel,
|
||||||
Layout: HBox{},
|
Layout: HBox{},
|
||||||
Children: []Widget{
|
Children: []Widget{
|
||||||
Composite{
|
Composite{
|
||||||
|
|||||||
+43
@@ -5,6 +5,8 @@ import (
|
|||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/lxn/walk"
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@@ -73,6 +75,47 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func CreatePalletteGroup(mw *MyMainWindow) *walk.GroupBox {
|
||||||
|
pallette_group, _ := walk.NewGroupBox(mw.leftPanel)
|
||||||
|
pallette_group.SetTitle("Pallette")
|
||||||
|
pallette_group.SetLayout(walk.NewVBoxLayout())
|
||||||
|
comp, _ := walk.NewComposite(pallette_group)
|
||||||
|
comp.SetLayout(walk.NewHBoxLayout())
|
||||||
|
comp.Layout().SetMargins(walk.Margins{0, 0, 0, 0})
|
||||||
|
lbl, _ := walk.NewLabel(comp)
|
||||||
|
lbl.SetText("Brand:")
|
||||||
|
mw.brand_combo, _ = walk.NewComboBox(comp)
|
||||||
|
mw.brand_combo.SetModel(CreateBrandsList(mw))
|
||||||
|
mw.brand_combo.SetCurrentIndex(0)
|
||||||
|
mw.brand_combo.CurrentIndexChanged().Attach(func() {
|
||||||
|
mw.serie_combo.SetModel(CreateSeriesList(mw))
|
||||||
|
mw.serie_combo.SetCurrentIndex(0)
|
||||||
|
mw.pegboard_combo.SetModel(CreatePegboardsList(mw))
|
||||||
|
mw.pegboard_combo.SetCurrentIndex(0)
|
||||||
|
})
|
||||||
|
comp, _ = walk.NewComposite(pallette_group)
|
||||||
|
comp.SetLayout(walk.NewHBoxLayout())
|
||||||
|
comp.Layout().SetMargins(walk.Margins{0, 0, 0, 0})
|
||||||
|
lbl, _ = walk.NewLabel(comp)
|
||||||
|
lbl.SetText("Serie:")
|
||||||
|
mw.serie_combo, _ = walk.NewComboBox(comp)
|
||||||
|
mw.serie_combo.SetModel(CreateSeriesList(mw))
|
||||||
|
mw.serie_combo.SetCurrentIndex(0)
|
||||||
|
mw.serie_combo.CurrentIndexChanged().Attach(func() {
|
||||||
|
mw.pegboard_combo.SetModel(CreatePegboardsList(mw))
|
||||||
|
mw.pegboard_combo.SetCurrentIndex(0)
|
||||||
|
})
|
||||||
|
comp, _ = walk.NewComposite(pallette_group)
|
||||||
|
comp.SetLayout(walk.NewHBoxLayout())
|
||||||
|
comp.Layout().SetMargins(walk.Margins{0, 0, 0, 0})
|
||||||
|
lbl, _ = walk.NewLabel(comp)
|
||||||
|
lbl.SetText("Pegboard:")
|
||||||
|
mw.pegboard_combo, _ = walk.NewComboBox(comp)
|
||||||
|
mw.pegboard_combo.SetModel(CreatePegboardsList(mw))
|
||||||
|
mw.pegboard_combo.SetCurrentIndex(0)
|
||||||
|
return pallette_group
|
||||||
|
}
|
||||||
|
|
||||||
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user