Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fyne v2 migration #14

Merged
merged 2 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ run: ## Run app locally

.PHONY: build-linux
build-linux: ## Build linux package
command -v fyne >/dev/null 2>&1 || { go get fyne.io/fyne/cmd/fyne; }
fyne package -os linux -icon icon.png -release
command -v fyne >/dev/null 2>&1 || { go get fyne.io/fyne/v2/cmd/fyne; }
fyne package -os linux -icon icon.png -release -appID com.github.mikan.arpg

.PHONY: build-mac
build-mac: ## Build mac package
command -v fyne >/dev/null 2>&1 || { go get fyne.io/fyne/cmd/fyne; }
fyne package -os darwin -icon icon.png -release
command -v fyne >/dev/null 2>&1 || { go get fyne.io/fyne/v2/cmd/fyne; }
fyne package -os darwin -icon icon.png -release -appID com.github.mikan.arpg
zip -r arpg_macos.zip arpg.app

.PHONY: build-win
build-win: ## Build windows package
if not exist fyne go get fyne.io/fyne/cmd/fyne
fyne package -os windows -icon icon.png -release
if not exist %GOPATH%\bin\fyne go get fyne.io/fyne/v2/cmd/fyne
fyne package -os windows -icon icon.png -release -appID com.github.mikan.arpg

.PHONY: help
help:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/mikan/arpg

go 1.14

require fyne.io/fyne v1.3.0
require fyne.io/fyne/v2 v2.0.0
19 changes: 11 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
fyne.io/fyne v1.3.0 h1:FLlgX/JkD3Chal7tEhRL7fOONVAjQJM/yrVNA+cK/dc=
fyne.io/fyne v1.3.0/go.mod h1:AcBUeR8hetITnnfaLvuVqioWM/lT18WPeMVAobhMbg8=
fyne.io/fyne v1.4.3 h1:356CnXCiYrrfaLGsB7qLK3c6ktzyh8WR05v/2RBu51I=
fyne.io/fyne/v2 v2.0.0 h1:TfsS3bNq5663BpXsoz1OfzyjcaMqqOf9usI8ZKkw4IE=
fyne.io/fyne/v2 v2.0.0/go.mod h1:FmobqvPpBW+nG1nDyxZWf1SQLED9g/vXIxiIIVjHazY=
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9 h1:1ltqoej5GtaWF8jaiA49HwsZD459jqm9YFz9ZtMFpQA=
github.com/Kodeworks/golang-image-ico v0.0.0-20141118225523-73f0f4cfade9/go.mod h1:7uhhqiBaR4CpN0k9rMjOtjpcfGd6DG2m04zQxKnWQ0I=
github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw=
github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3 h1:FDqhDm7pcsLhhWl1QtD8vlzI4mm59llRvNzrFg6/LAA=
github.com/fredbi/uri v0.0.0-20181227131451-3dcfdacbaaf3/go.mod h1:CzM2G82Q9BDUvMTGHnXf/6OExw/Dz2ivDj48nVg7Lg8=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fyne-io/mobile v0.0.2/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
github.com/fyne-io/mobile v0.1.2/go.mod h1:/kOrWrZB6sasLbEy2JIvr4arEzQTXBTZGb3Y96yWbHY=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4 h1:WtGNWLvXpe6ZudgnXrq0barxBImvnnJoMEhXAzcbM0I=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200625191551-73d3c3675aa3 h1:q521PfSp5/z6/sD9FZZOWj4d1MLmfQW8PkRnI9M6PCE=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200625191551-73d3c3675aa3/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff h1:W71vTCKoxtdXgnm1ECDFkfQnpdqAO00zzGXLA5yaEX8=
github.com/goki/freetype v0.0.0-20181231101311-fa8a33aabaff/go.mod h1:wfqRWLHRBsRgkp5dmbG56SA0DmVtwrF5N3oPdI8t+Aw=
Expand All @@ -39,6 +41,7 @@ github.com/srwiley/oksvg v0.0.0-20200311192757-870daf9aa564/go.mod h1:afMbS0qvv1
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9 h1:m59mIOBO4kfcNCEzJNy71UkeF4XIx2EVmL9KLwDQdmM=
github.com/srwiley/rasterx v0.0.0-20200120212402-85cb7272f5e9/go.mod h1:mvWM0+15UqyrFKqdRjY6LuAVJR0HOVhJlEgZ5JWtSWU=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
Expand All @@ -59,8 +62,8 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200327173247-9dae0f8f5775 h1:TC0v2RSO1u2kn1ZugjrFXkRZAEaqMN/RW+OTZkBzmLE=
golang.org/x/sys v0.0.0-20200327173247-9dae0f8f5775/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666 h1:gVCS+QOncANNPlmlO1AhlU3oxs4V9z+gTtPwIk3p2N8=
golang.org/x/sys v0.0.0-20200720211630-cb9d2d5c5666/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
Expand Down
14 changes: 7 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"regexp"

"fyne.io/fyne/app"
"fyne.io/fyne/dialog"
"fyne.io/fyne/widget"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
)

var (
Expand All @@ -20,12 +20,12 @@ func main() {
w.SetMainMenu(newMainMenu(a, w))
adapters, err := adapters()
if err != nil {
dialog.NewError(err, w)
dialog.NewError(err, w).Show()
}
w.SetContent(
widget.NewTabContainer(
widget.NewTabItem("IP to MAC", newIP2MACTab(w, adapters)),
widget.NewTabItem("MAC to IP", newMAC2IPTab(w, adapters)),
container.NewAppTabs(
container.NewTabItem("IP to MAC", newIP2MACTab(w, adapters)),
container.NewTabItem("MAC to IP", newMAC2IPTab(w, adapters)),
),
)
w.ShowAndRun()
Expand Down
4 changes: 2 additions & 2 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"os"
"runtime"

"fyne.io/fyne"
"fyne.io/fyne/widget"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
)

var (
Expand Down
9 changes: 5 additions & 4 deletions ui_ip2mac.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"fyne.io/fyne"
"fyne.io/fyne/widget"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)

func newIP2MACTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
Expand All @@ -21,7 +22,7 @@ func newIP2MACTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
macCopyButton.Disable()
macCopyButton.SetText("Copied!")
})
macResult := widget.NewVBox(
macResult := container.NewVBox(
widget.NewLabel("MAC address:"),
macEntry,
macCopyButton,
Expand Down Expand Up @@ -60,7 +61,7 @@ func newIP2MACTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
}

// layout
return widget.NewVBox(
return container.NewVBox(
widget.NewLabel("Target IP address:"),
ipEntry,
widget.NewLabel("Network adapter:"),
Expand Down
9 changes: 5 additions & 4 deletions ui_mac2ip.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package main

import (
"fyne.io/fyne"
"fyne.io/fyne/widget"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)

func newMAC2IPTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
Expand All @@ -21,7 +22,7 @@ func newMAC2IPTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
ipCopyButton.Disable()
ipCopyButton.SetText("Copied!")
})
ipResult := widget.NewVBox(
ipResult := container.NewVBox(
widget.NewLabel("IP address:"),
ipEntry,
ipCopyButton,
Expand Down Expand Up @@ -60,7 +61,7 @@ func newMAC2IPTab(w fyne.Window, adapters []adapter) fyne.CanvasObject {
}

// layout
return widget.NewVBox(
return container.NewVBox(
widget.NewLabel("Target MAC address:"),
macEntry,
widget.NewLabel("Network adapter:"),
Expand Down
11 changes: 6 additions & 5 deletions ui_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import (
"fmt"
"net/url"

"fyne.io/fyne"
"fyne.io/fyne/dialog"
"fyne.io/fyne/widget"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/widget"
)

func newMainMenu(a fyne.App, w fyne.Window) *fyne.MainMenu {
Expand All @@ -17,12 +18,12 @@ func newMainMenu(a fyne.App, w fyne.Window) *fyne.MainMenu {
return fyne.NewMainMenu(
fyne.NewMenu("File", fyne.NewMenuItem("Quit", func() { a.Quit() })),
fyne.NewMenu("Help", fyne.NewMenuItem("About...", func() {
dialog.NewCustom("About", "OK", widget.NewVBox(
dialog.NewCustom("About", "OK", container.NewVBox(
widget.NewHyperlinkWithStyle("ARPG", homepage, fyne.TextAlignCenter, boldText),
widget.NewLabelWithStyle("A simple ARP support tool", fyne.TextAlignCenter, italicText),
widget.NewLabelWithStyle("Licensed under the", fyne.TextAlignCenter, normalText),
widget.NewLabelWithStyle("BSD 3-Clause", fyne.TextAlignCenter, normalText),
), w)
), w).Show()
})),
)
}