0.0.23 Added warning icon for colors. /JL

This commit is contained in:
Jan Lerking
2022-12-15 12:52:24 +01:00
parent a75c035ca8
commit 32c90eee33
4 changed files with 33 additions and 9 deletions
+28 -6
View File
@@ -9,13 +9,15 @@ import (
type ( type (
BeadColor struct { BeadColor struct {
Brand string
Series string
Name string
ColorID int
Checkbox *walk.CheckBox Checkbox *walk.CheckBox
backgroundColor walk.Brush backgroundColor walk.Brush
tooltip walk.ToolTip tooltip walk.ToolTip
warning *walk.ImageView
Brand string
Series string
Weight int
Name string
ColorID int
Red byte Red byte
Green byte Green byte
Blue byte Blue byte
@@ -37,6 +39,7 @@ func LoadBeads(mw *MyMainWindow) {
bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.Red, bead.Green, bead.Blue) bc := NewBeadColor(mw, bead.ColorName, bead.ColorIndex, bead.Red, bead.Green, bead.Blue)
bc.Brand = brand.BrandName bc.Brand = brand.BrandName
bc.Series = series.SerieName bc.Series = series.SerieName
bc.Weight = series.Weight
bc.Name = bead.ColorName bc.Name = bead.ColorName
bc.ColorID = bead.ColorIndex bc.ColorID = bead.ColorIndex
bc.Red = bead.Red bc.Red = bead.Red
@@ -73,6 +76,12 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b
log.Println("Setting checkbox name") log.Println("Setting checkbox name")
color.Checkbox.SetText(name) color.Checkbox.SetText(name)
log.Println("Checkbox name set") log.Println("Checkbox name set")
color.warning, err = walk.NewImageView(cm)
if err != nil {
log.Println("Error creating image view: ", err)
}
color.warning.SetImage(walk.IconInformation())
color.warning.SetVisible(false)
walk.NewHSpacer(cm) walk.NewHSpacer(cm)
lbl, _ := walk.NewLabel(cm) lbl, _ := walk.NewLabel(cm)
lbl.SetText(fmt.Sprint("Color ID: ", id)) lbl.SetText(fmt.Sprint("Color ID: ", id))
@@ -89,6 +98,19 @@ func (bc *BeadColor) GetOnHand() int {
return bc.onHand return bc.onHand
} }
func (bc *BeadColor) SetOnHand(onHand int) { func (bc *BeadColor) GetInStock() bool {
bc.onHand = onHand return bc.inStock
}
func (bc *BeadColor) SetInStock(inStock bool) {
bc.inStock = inStock
}
func (bc *BeadColor) GetColorID() int {
return bc.ColorID
}
func (bc *BeadColor) AddOnHand(grams int) {
addbeads := bc.Weight * grams / 1000
bc.onHand += int(addbeads)
} }
+3 -3
View File
@@ -28,7 +28,7 @@ type MyMainWindow struct {
const ( const (
AppName string = "BeadImager" AppName string = "BeadImager"
Version string = "0.0.22" Version string = "0.0.23"
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"
@@ -172,7 +172,7 @@ func main() {
Children: []Widget{ Children: []Widget{
Composite{ Composite{
Layout: VBox{MarginsZero: true}, Layout: VBox{MarginsZero: true},
MaxSize: Size{220, 0}, MaxSize: Size{260, 0},
Children: []Widget{ Children: []Widget{
DD_Pallette, DD_Pallette,
DD_Beads, DD_Beads,
@@ -199,7 +199,7 @@ func main() {
GroupBox{ GroupBox{
Title: "Settings", Title: "Settings",
Layout: VBox{}, Layout: VBox{},
MaxSize: Size{220, 0}, MaxSize: Size{260, 0},
Children: []Widget{ Children: []Widget{
ScrollView{ ScrollView{
AssignTo: &mw.propScroll, AssignTo: &mw.propScroll,
+1
View File
@@ -32,6 +32,7 @@ type (
Seriestruct struct { Seriestruct struct {
XMLName xml.Name `xml:"serie"` XMLName xml.Name `xml:"serie"`
SerieName string `xml:"seriename"` SerieName string `xml:"seriename"`
Weight int `xml:"weightPerThousand"`
Pegboards Pegboardsstruct `xml:"pegboards"` Pegboards Pegboardsstruct `xml:"pegboards"`
Beads Beadsstruct `xml:"beads"` Beads Beadsstruct `xml:"beads"`
} }
+1
View File
@@ -11,6 +11,7 @@
</serie> </serie>
<serie> <serie>
<seriename>Midi</seriename> <seriename>Midi</seriename>
// Weight is per 1000 beads in grams
<weightPerThousand>60</weightPerThousand> <weightPerThousand>60</weightPerThousand>
<pegboards> <pegboards>
<pegboard> <pegboard>