0.2.4 Updated pallette. /JL
This commit is contained in:
@@ -17,15 +17,19 @@ type (
|
|||||||
info *walk.ImageView
|
info *walk.ImageView
|
||||||
warning *walk.ImageView
|
warning *walk.ImageView
|
||||||
Brand string
|
Brand string
|
||||||
Series []string
|
Series []*Serie
|
||||||
Weight []int
|
Weight []int
|
||||||
Name string
|
Name string
|
||||||
ColorID int
|
ColorID int
|
||||||
Red byte
|
Red byte
|
||||||
Green byte
|
Green byte
|
||||||
Blue byte
|
Blue byte
|
||||||
inStock bool
|
}
|
||||||
onHand int
|
|
||||||
|
Serie struct {
|
||||||
|
Name string
|
||||||
|
inStock bool
|
||||||
|
onHand int
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -34,7 +38,7 @@ func ShowBeads(mw *MyMainWindow, serie string) {
|
|||||||
for _, bead := range mw.beads {
|
for _, bead := range mw.beads {
|
||||||
bead.Color.SetVisible(false)
|
bead.Color.SetVisible(false)
|
||||||
for _, s := range bead.Series {
|
for _, s := range bead.Series {
|
||||||
if s == serie {
|
if s.Name == serie {
|
||||||
bead.Color.SetVisible(true)
|
bead.Color.SetVisible(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,30 +69,37 @@ func LoadBeads(mw *MyMainWindow) {
|
|||||||
for _, bead := range brand.Colors {
|
for _, bead := range brand.Colors {
|
||||||
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.Red, bead.Green, bead.Blue)
|
||||||
bc.Series = bead.Series.Serie
|
for _, s := range bead.Series.Serie {
|
||||||
|
se := new(Serie)
|
||||||
|
se.Name = s.Name
|
||||||
|
se.inStock = s.InStock
|
||||||
|
se.onHand = s.OnHand
|
||||||
|
bc.Series = append(bc.Series, se)
|
||||||
|
bc.InfoTooltip.SetText(bc.info, "Approx. "+fmt.Sprint(se.onHand)+" left on hand")
|
||||||
|
bc.WarningTooltip.SetText(bc.warning, "Only "+fmt.Sprint(se.onHand)+" left on hand")
|
||||||
|
if se.onHand <= 200 {
|
||||||
|
bc.warning.SetVisible(true)
|
||||||
|
bc.info.SetVisible(false)
|
||||||
|
} else {
|
||||||
|
bc.warning.SetVisible(false)
|
||||||
|
bc.info.SetVisible(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
bc.Brand = brand.BrandName
|
bc.Brand = brand.BrandName
|
||||||
bc.Name = bead.ColorName
|
bc.Name = bead.ColorName
|
||||||
bc.ColorID = bead.ColorIndex
|
bc.ColorID = bead.ColorIndex
|
||||||
bc.Red = bead.Red
|
bc.Red = bead.Red
|
||||||
bc.Green = bead.Green
|
bc.Green = bead.Green
|
||||||
bc.Blue = bead.Blue
|
bc.Blue = bead.Blue
|
||||||
bc.inStock = bead.InStock
|
|
||||||
mw.beads = append(mw.beads, bc)
|
mw.beads = append(mw.beads, bc)
|
||||||
if bead.OnHand <= 200 {
|
|
||||||
bc.warning.SetVisible(true)
|
|
||||||
bc.info.SetVisible(false)
|
|
||||||
} else {
|
|
||||||
bc.warning.SetVisible(false)
|
|
||||||
bc.info.SetVisible(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBeadColor(mw *MyMainWindow, name string, id int, onhand int, red byte, green byte, blue byte) *BeadColor {
|
func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, blue byte) *BeadColor {
|
||||||
var err error
|
var err error
|
||||||
log.Println("Creating bead color: " + name + " ...")
|
log.Println("Creating bead color: " + name + " ...")
|
||||||
cm, _ := walk.NewComposite(mw.colors)
|
cm, _ := walk.NewComposite(mw.colors)
|
||||||
@@ -100,7 +111,6 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, onhand int, red byte, g
|
|||||||
color.Color = cm
|
color.Color = cm
|
||||||
log.Println("Bead color struct: ", color)
|
log.Println("Bead color struct: ", color)
|
||||||
color.SetBackgroundColor(walk.RGB(red, green, blue))
|
color.SetBackgroundColor(walk.RGB(red, green, blue))
|
||||||
color.onHand = onhand
|
|
||||||
log.Println("Creating checkbox")
|
log.Println("Creating checkbox")
|
||||||
color.Checkbox, err = walk.NewCheckBox(cm)
|
color.Checkbox, err = walk.NewCheckBox(cm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -120,7 +130,6 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, onhand int, red byte, g
|
|||||||
color.InfoTooltip.SetInfoTitle(name + " - " + fmt.Sprint(id))
|
color.InfoTooltip.SetInfoTitle(name + " - " + fmt.Sprint(id))
|
||||||
color.info.SetImage(walk.IconInformation())
|
color.info.SetImage(walk.IconInformation())
|
||||||
color.InfoTooltip.AddTool(color.info)
|
color.InfoTooltip.AddTool(color.info)
|
||||||
color.InfoTooltip.SetText(color.info, "Approx. "+fmt.Sprint(color.onHand)+" left on hand")
|
|
||||||
color.info.SetVisible(false)
|
color.info.SetVisible(false)
|
||||||
color.warning, err = walk.NewImageView(cm)
|
color.warning, err = walk.NewImageView(cm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -131,7 +140,6 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, onhand int, red byte, g
|
|||||||
color.WarningTooltip.SetWarningTitle(name + " - " + fmt.Sprint(id))
|
color.WarningTooltip.SetWarningTitle(name + " - " + fmt.Sprint(id))
|
||||||
color.warning.SetImage(walk.IconWarning())
|
color.warning.SetImage(walk.IconWarning())
|
||||||
color.WarningTooltip.AddTool(color.warning)
|
color.WarningTooltip.AddTool(color.warning)
|
||||||
color.WarningTooltip.SetText(color.warning, "Only "+fmt.Sprint(color.onHand)+" left on hand")
|
|
||||||
color.warning.SetVisible(false)
|
color.warning.SetVisible(false)
|
||||||
|
|
||||||
lbl, _ := walk.NewLabel(cm)
|
lbl, _ := walk.NewLabel(cm)
|
||||||
@@ -145,16 +153,30 @@ func (bc *BeadColor) SetBackgroundColor(col walk.Color) {
|
|||||||
bc.backgroundColor, _ = walk.NewSolidColorBrush(col)
|
bc.backgroundColor, _ = walk.NewSolidColorBrush(col)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) GetOnHand() int {
|
func (bc *BeadColor) GetOnHand(serie string) int {
|
||||||
return bc.onHand
|
for _, s := range bc.Series {
|
||||||
|
if s.Name == serie {
|
||||||
|
return s.onHand
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) GetInStock() bool {
|
func (bc *BeadColor) GetInStock(serie string) bool {
|
||||||
return bc.inStock
|
for _, s := range bc.Series {
|
||||||
|
if s.Name == serie {
|
||||||
|
return s.inStock
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) SetInStock(inStock bool) {
|
func (bc *BeadColor) SetInStock(serie string, inStock bool) {
|
||||||
bc.inStock = inStock
|
for _, s := range bc.Series {
|
||||||
|
if s.Name == serie {
|
||||||
|
s.inStock = inStock
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BeadColor) GetColorID() int {
|
func (bc *BeadColor) GetColorID() int {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.2.3"
|
Version string = "0.2.4"
|
||||||
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"
|
||||||
|
|||||||
+6
-3
@@ -36,7 +36,12 @@ type (
|
|||||||
Colorstruct struct {
|
Colorstruct struct {
|
||||||
Series struct {
|
Series struct {
|
||||||
XMLName xml.Name `xml:"series"`
|
XMLName xml.Name `xml:"series"`
|
||||||
Serie []string `xml:"serie"`
|
Serie []struct {
|
||||||
|
XMLName xml.Name `xml:"serie"`
|
||||||
|
Name string `xml:"name,attr"`
|
||||||
|
InStock bool `xml:"inStock"`
|
||||||
|
OnHand int `xml:"onHand"`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ColorIndex int `xml:"colorIndex,attr"`
|
ColorIndex int `xml:"colorIndex,attr"`
|
||||||
ColorName string `xml:"colorname"`
|
ColorName string `xml:"colorname"`
|
||||||
@@ -50,8 +55,6 @@ type (
|
|||||||
IsNeutral bool `xml:"isNeutral"`
|
IsNeutral bool `xml:"isNeutral"`
|
||||||
IsGrayscale bool `xml:"isGrayscale"`
|
IsGrayscale bool `xml:"isGrayscale"`
|
||||||
Disabled bool `xml:"disabled"`
|
Disabled bool `xml:"disabled"`
|
||||||
InStock bool `xml:"inStock"`
|
|
||||||
OnHand int `xml:"onHand"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pegboards struct {
|
Pegboards struct {
|
||||||
|
|||||||
+636
-305
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user