diff options
| author | sam-anthony <samanthony6@protonmail.com> | 2022-04-09 12:05:19 -0230 |
|---|---|---|
| committer | sam-anthony <samanthony6@protonmail.com> | 2022-04-09 12:05:19 -0230 |
| commit | 4f654973e5139f14d6fa63357a274ad0e3cbb202 (patch) | |
| tree | 45bbc6716382eb2cee8cf5fef77a55cb4e143015 /ui.go | |
| parent | 4cbd64e7ab6d976496c5e36c1ebae7526eceb375 (diff) | |
| download | volute-4f654973e5139f14d6fa63357a274ad0e3cbb202.zip | |
selecteable compressor and add BW K03
Diffstat (limited to 'ui.go')
| -rw-r--r-- | ui.go | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -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)), ) } |