aboutsummaryrefslogtreecommitdiffstats
path: root/ui.go
diff options
context:
space:
mode:
authorsam-anthony <samanthony6@protonmail.com>2022-04-09 12:05:19 -0230
committersam-anthony <samanthony6@protonmail.com>2022-04-09 12:05:19 -0230
commit4f654973e5139f14d6fa63357a274ad0e3cbb202 (patch)
tree45bbc6716382eb2cee8cf5fef77a55cb4e143015 /ui.go
parent4cbd64e7ab6d976496c5e36c1ebae7526eceb375 (diff)
downloadvolute-4f654973e5139f14d6fa63357a274ad0e3cbb202.zip
selecteable compressor and add BW K03
Diffstat (limited to 'ui.go')
-rw-r--r--ui.go29
1 files changed, 28 insertions, 1 deletions
diff --git a/ui.go b/ui.go
index 8d56f87..74a3fd5 100644
--- a/ui.go
+++ b/ui.go
@@ -8,6 +8,7 @@ import (
"image/draw"
"strconv"
+ "github.com/sam-anthony/volute/compressor"
"github.com/sam-anthony/volute/mass"
"github.com/sam-anthony/volute/pressure"
"github.com/sam-anthony/volute/temperature"
@@ -272,6 +273,32 @@ func columns() []*g.TableColumnWidget {
return widgets
}
+var compressorTree []g.Widget
+
+func init() {
+ compressors := compressor.Compressors()
+ for manufacturer := range compressors {
+ manufacturerNode := g.TreeNode(manufacturer)
+ for series := range compressors[manufacturer] {
+ seriesNode := g.TreeNode(series)
+ for model, c := range compressors[manufacturer][series] {
+ seriesNode = seriesNode.Layout(
+ g.Selectable(model).OnClick(func() {
+ go setCompressor(c)
+ }),
+ )
+ }
+ manufacturerNode = manufacturerNode.Layout(seriesNode)
+ }
+ compressorTree = append(compressorTree, manufacturerNode)
+ }
+}
+
+func selectCompressor() g.Widget {
+ return g.ComboCustom("Compressor", selectedCompressor.Name).
+ Layout(compressorTree...)
+}
+
var updatedCompImg = make(chan image.Image)
func updateCompImg() {
@@ -321,7 +348,7 @@ func compressorWidget() {
winWidth, winHeight := g.GetAvailableRegion()
canvas.AddImage(
compressorTexture,
- image.Pt(0, 225),
+ image.Pt(0, 250),
image.Pt(int(winWidth), int(winHeight)),
)
}