From 4f654973e5139f14d6fa63357a274ad0e3cbb202 Mon Sep 17 00:00:00 2001 From: sam-anthony Date: Sat, 9 Apr 2022 12:05:19 -0230 Subject: selecteable compressor and add BW K03 --- ui.go | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'ui.go') 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)), ) } -- cgit v1.2.3