diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-05-09 17:32:54 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-05-09 17:32:54 -0400 |
| commit | d463bb90ad629dfc8f1cd4f4b6b9590b0008832d (patch) | |
| tree | bf8763649c6a2f1af1fe46821216e327c094dcfa /main.go | |
| parent | 76980fe3014b5c133c4e30590e92bd922aa9b9c1 (diff) | |
| download | volute-d463bb90ad629dfc8f1cd4f4b6b9590b0008832d.zip | |
tree widget
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 84 |
1 files changed, 81 insertions, 3 deletions
@@ -2,12 +2,16 @@ package main import ( "fmt" - "image" "os" "sync" + "image" + _ "image/jpeg" + _ "image/png" + "github.com/faiface/mainthread" "volute/gui" + "volute/gui/text" "volute/gui/widget" "volute/gui/win" ) @@ -28,7 +32,7 @@ func run() { wg := new(sync.WaitGroup) defer wg.Wait() - focus := widget.NewFocusMaster([]int{1, POINTS, POINTS, POINTS, POINTS}) + focus := widget.NewFocusMaster([]int{1, POINTS, POINTS, POINTS, POINTS, 1}) defer focus.Close() displacementChan := make(chan uint) @@ -63,15 +67,89 @@ func run() { wg, ) + compressors := []widget.Node[string]{ + { + Label: "BorgWarner", + Value: "bw", + Children: []widget.Node[string]{ + { + Label: "EFR", + Value: "efr", + Children: []widget.Node[string]{ + { + Label: "6258", + Value: "6258", + Children: nil, + }, { + Label: "7064", + Value: "7064", + Children: nil, + }, + }, + }, { + Label: "K", + Value: "k", + Children: []widget.Node[string]{ + { + Label: "03", + Value: "03", + Children: nil, + }, { + Label: "04", + Value: "04", + Children: nil, + }, + }, + }, + }, + }, { + Label: "Garrett", + Value: "garrett", + Children: []widget.Node[string]{ + { + Label: "G", + Value: "g", + Children: []widget.Node[string]{ + { + Label: "25-550", + Value: "25-550", + Children: nil, + }, + }, + }, + }, + }, + } + wg.Add(1) + go widget.Tree( + compressors, + image.Rect(text.PAD, 125, 250, HEIGHT-text.PAD), + focus.Slave(5, 0), + mux, + wg, + ) + imChan := make(chan image.Image) defer close(imChan) wg.Add(1) go widget.Image( imChan, - image.Rect(0, 200, 100, 300), + image.Rect(250+text.PAD, 125, WIDTH-text.PAD, HEIGHT-text.PAD), mux.MakeEnv(), wg, ) + f, err := os.Open("compressor_maps/borgwarner/efr/8374.jpg") + if err != nil { + fmt.Fprintln(os.Stderr, err) + return + } + im, _, err := image.Decode(f) + if err != nil { + fmt.Fprintln(os.Stderr, err) + return + } + f.Close() + imChan <- im for i := 0; i < POINTS; i++ { wg.Add(1) |