0.4.2 Added out of stock info. /JL
This commit is contained in:
20
color.go
20
color.go
@@ -14,9 +14,11 @@ type (
|
|||||||
backgroundColor walk.Brush
|
backgroundColor walk.Brush
|
||||||
InfoTooltip *walk.ToolTip
|
InfoTooltip *walk.ToolTip
|
||||||
WarningTooltip *walk.ToolTip
|
WarningTooltip *walk.ToolTip
|
||||||
|
ErrorTooltip *walk.ToolTip
|
||||||
add *walk.ImageView
|
add *walk.ImageView
|
||||||
info *walk.ImageView
|
info *walk.ImageView
|
||||||
warning *walk.ImageView
|
warning *walk.ImageView
|
||||||
|
error *walk.ImageView
|
||||||
Brand string
|
Brand string
|
||||||
Series []*Serie
|
Series []*Serie
|
||||||
Weight []int
|
Weight []int
|
||||||
@@ -47,12 +49,20 @@ func ShowBeads(mw *MyMainWindow, serie string) {
|
|||||||
bead.Color.SetVisible(true)
|
bead.Color.SetVisible(true)
|
||||||
bead.InfoTooltip.SetText(bead.info, "Approx. "+fmt.Sprint(s.onHand)+" left on hand")
|
bead.InfoTooltip.SetText(bead.info, "Approx. "+fmt.Sprint(s.onHand)+" left on hand")
|
||||||
bead.WarningTooltip.SetText(bead.warning, "Only "+fmt.Sprint(s.onHand)+" left on hand")
|
bead.WarningTooltip.SetText(bead.warning, "Only "+fmt.Sprint(s.onHand)+" left on hand")
|
||||||
|
bead.ErrorTooltip.SetText(bead.error, "Out of stock")
|
||||||
if s.onHand <= 200 {
|
if s.onHand <= 200 {
|
||||||
bead.warning.SetVisible(true)
|
bead.warning.SetVisible(true)
|
||||||
bead.info.SetVisible(false)
|
bead.info.SetVisible(false)
|
||||||
|
bead.error.SetVisible(false)
|
||||||
} else {
|
} else {
|
||||||
bead.warning.SetVisible(false)
|
bead.warning.SetVisible(false)
|
||||||
bead.info.SetVisible(true)
|
bead.info.SetVisible(true)
|
||||||
|
bead.error.SetVisible(false)
|
||||||
|
}
|
||||||
|
if s.onHand <= 0 {
|
||||||
|
bead.warning.SetVisible(false)
|
||||||
|
bead.info.SetVisible(false)
|
||||||
|
bead.error.SetVisible(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,6 +210,16 @@ func NewBeadColor(mw *MyMainWindow, name string, id int, red byte, green byte, b
|
|||||||
color.warning.SetImage(walk.IconWarning())
|
color.warning.SetImage(walk.IconWarning())
|
||||||
color.WarningTooltip.AddTool(color.warning)
|
color.WarningTooltip.AddTool(color.warning)
|
||||||
color.warning.SetVisible(false)
|
color.warning.SetVisible(false)
|
||||||
|
color.error, err = walk.NewImageView(cm)
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Error creating error image view: ", err)
|
||||||
|
}
|
||||||
|
//Setup error tooltip
|
||||||
|
color.ErrorTooltip, _ = walk.NewToolTip()
|
||||||
|
color.ErrorTooltip.SetErrorTitle(name + " - " + fmt.Sprint(id))
|
||||||
|
color.error.SetImage(walk.IconError())
|
||||||
|
color.ErrorTooltip.AddTool(color.error)
|
||||||
|
color.error.SetVisible(false)
|
||||||
|
|
||||||
lbl, _ := walk.NewLabel(cm)
|
lbl, _ := walk.NewLabel(cm)
|
||||||
lbl.SetText(fmt.Sprint("Color ID: ", id))
|
lbl.SetText(fmt.Sprint("Color ID: ", id))
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -32,7 +32,7 @@ type MyMainWindow struct {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
AppName string = "BeadImager"
|
AppName string = "BeadImager"
|
||||||
Version string = "0.4.1"
|
Version string = "0.4.2"
|
||||||
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"
|
||||||
|
|||||||
Reference in New Issue
Block a user