Skip to content

Commit 033ca2e

Browse files
committed
Rework GUI & add Copy button
1 parent 17a53c3 commit 033ca2e

3 files changed

Lines changed: 30 additions & 3 deletions

File tree

bin/rawAccelGraph.exe

-223 KB
Binary file not shown.

rawAccelGraph/FyneApp.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ Website = "https://fr.linkedin.com/in/nicolas-hypolite"
44
Icon = "Icon.png"
55
Name = "rawAccelGraph"
66
Version = "0.0.1"
7-
Build = 12
7+
Build = 16

rawAccelGraph/main.go

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import (
55
"fmt"
66
"io/ioutil"
77
"os"
8+
"os/exec"
9+
"runtime"
810
"strconv"
911

1012
_ "embed"
@@ -150,12 +152,19 @@ func result() *fyne.Container {
150152

151153
bottomBox := container.NewHBox(
152154
&widget.Separator{},
153-
widget.NewButtonWithIcon("Copy", theme.ContentCopyIcon(), func() {
155+
widget.NewButtonWithIcon(" Copy ", theme.ContentCopyIcon(), func() {
154156
fyneApp.Window.Clipboard().SetContent(set.Result.Text)
155157
}),
156158
)
157159

158-
result := container.NewVBox(scroll, container.NewCenter(bottomBox))
160+
aCoffe := container.NewHBox(
161+
&widget.Separator{},
162+
widget.NewButtonWithIcon("Give a coffe", theme.VisibilityIcon(), func() {
163+
openURL("https://www.buymeacoffee.com/laslite")
164+
}),
165+
)
166+
167+
result := container.NewVBox(scroll, container.NewCenter(bottomBox), container.NewCenter(aCoffe))
159168

160169
return result
161170
}
@@ -347,3 +356,21 @@ func errorDialog(err error) {
347356
errorDial.Show()
348357
}
349358
}
359+
360+
func openURL(url string) {
361+
var err error
362+
switch runtime.GOOS {
363+
case "linux":
364+
err = exec.Command("xdg-open", url).Start()
365+
case "windows":
366+
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
367+
case "darwin":
368+
err = exec.Command("open", url).Start()
369+
default:
370+
err = fmt.Errorf("unsupported platform")
371+
errorDialog(err)
372+
}
373+
errorDialog(err)
374+
cmd := exec.Command("open", url)
375+
cmd.Start()
376+
}

0 commit comments

Comments
 (0)