0.0.23 Added warning icon for colors. /JL
This commit is contained in:
34
color.go
34
color.go
@@ -9,13 +9,15 @@ import (
|
||||
|
||||
type (
|
||||
BeadColor struct {
|
||||
Brand string
|
||||
Series string
|
||||
Name string
|
||||
ColorID int
|
||||
Checkbox *walk.CheckBox
|
||||
backgroundColor walk.Brush
|
||||
tooltip walk.ToolTip
|
||||
warning *walk.ImageView
|
||||
Brand string
|
||||
Series string
|
||||
Weight int
|
||||
Name string
|
||||
ColorID int
|
||||
Red byte
|
||||
Green 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.Brand = brand.BrandName
|
||||
bc.Series = series.SerieName
|
||||
bc.Weight = series.Weight
|
||||
bc.Name = bead.ColorName
|
||||
bc.ColorID = bead.ColorIndex
|
||||
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")
|
||||
color.Checkbox.SetText(name)
|
||||
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)
|
||||
lbl, _ := walk.NewLabel(cm)
|
||||
lbl.SetText(fmt.Sprint("Color ID: ", id))
|
||||
@@ -89,6 +98,19 @@ func (bc *BeadColor) GetOnHand() int {
|
||||
return bc.onHand
|
||||
}
|
||||
|
||||
func (bc *BeadColor) SetOnHand(onHand int) {
|
||||
bc.onHand = onHand
|
||||
func (bc *BeadColor) GetInStock() bool {
|
||||
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)
|
||||
}
|
||||
|
||||
6
main.go
6
main.go
@@ -28,7 +28,7 @@ type MyMainWindow struct {
|
||||
|
||||
const (
|
||||
AppName string = "BeadImager"
|
||||
Version string = "0.0.22"
|
||||
Version string = "0.0.23"
|
||||
CopyRight string = "©2022 Jan Lerking"
|
||||
STD_MESS string = "Ready"
|
||||
LogFile string = "BeadImager.log"
|
||||
@@ -172,7 +172,7 @@ func main() {
|
||||
Children: []Widget{
|
||||
Composite{
|
||||
Layout: VBox{MarginsZero: true},
|
||||
MaxSize: Size{220, 0},
|
||||
MaxSize: Size{260, 0},
|
||||
Children: []Widget{
|
||||
DD_Pallette,
|
||||
DD_Beads,
|
||||
@@ -199,7 +199,7 @@ func main() {
|
||||
GroupBox{
|
||||
Title: "Settings",
|
||||
Layout: VBox{},
|
||||
MaxSize: Size{220, 0},
|
||||
MaxSize: Size{260, 0},
|
||||
Children: []Widget{
|
||||
ScrollView{
|
||||
AssignTo: &mw.propScroll,
|
||||
|
||||
@@ -32,6 +32,7 @@ type (
|
||||
Seriestruct struct {
|
||||
XMLName xml.Name `xml:"serie"`
|
||||
SerieName string `xml:"seriename"`
|
||||
Weight int `xml:"weightPerThousand"`
|
||||
Pegboards Pegboardsstruct `xml:"pegboards"`
|
||||
Beads Beadsstruct `xml:"beads"`
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
</serie>
|
||||
<serie>
|
||||
<seriename>Midi</seriename>
|
||||
// Weight is per 1000 beads in grams
|
||||
<weightPerThousand>60</weightPerThousand>
|
||||
<pegboards>
|
||||
<pegboard>
|
||||
|
||||
Reference in New Issue
Block a user