From 89b4a4aea27d7b19d9ab0891661aa4a068b8b02c Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Fri, 20 Oct 2023 07:49:50 +0100 Subject: [PATCH 1/2] Fix image HTML so image aspect is retained --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f6d022bd..d2db502e 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ or resized. * [More Detail](./widget/diagramwidget/README.md)

- Diagram Widget + Diagram Widget

@@ -138,7 +138,7 @@ tree.Sorter = func(u1, u2 fyne.URI) bool { ```

- FileTree Widget + FileTree Widget

### CompletionEntry From 0b5901d0781a7756758129682e9fec6f140d039e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Alz=C3=A9n?= Date: Mon, 1 Jan 2024 00:09:42 +0100 Subject: [PATCH 2/2] Modernize the project setup (#82) --- .github/workflows/platform_tests.yml | 40 ++++++++---------- .github/workflows/static_analysis.yml | 56 ++++++++++++++++++------- go.mod | 31 +++++++++++++- go.sum | 19 +++++---- widget/diagramwidget/geometry/r2/box.go | 26 ++++++------ 5 files changed, 112 insertions(+), 60 deletions(-) diff --git a/.github/workflows/platform_tests.yml b/.github/workflows/platform_tests.yml index aaf234f5..27119e41 100644 --- a/.github/workflows/platform_tests.yml +++ b/.github/workflows/platform_tests.yml @@ -1,5 +1,7 @@ name: Platform Tests on: [push, pull_request] +permissions: + contents: read jobs: platform_tests: @@ -11,32 +13,26 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] steps: - - uses: actions/checkout@v2 - - uses: WillAbides/setup-go-faster@v1.9.1 - id: setup-go-faster + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: WillAbides/setup-go-faster@v1.13.0 with: go-version: ${{ matrix.go-version }} - name: Get dependencies - run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev bc + run: >- + sudo apt-get update && + sudo apt-get install + bc + gcc + libgl1-mesa-dev + libwayland-dev + libx11-dev + libxkbcommon-dev + xorg-dev + xvfb if: ${{ runner.os == 'Linux' }} - name: Tests - run: go test -tags ci ./... - - - name: Update coverage - run: | - GO111MODULE=off go get github.com/mattn/goveralls - set -e - go test -tags ci -covermode=atomic -coverprofile=coverage.out ./... - coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'` - if (( $(echo "$coverage < 48" | bc) )) ; then echo "Test coverage lowered"; exit 1; fi - if: ${{ runner.os == 'Linux' }} - - - name: Update PR Coverage - uses: shogo82148/actions-goveralls@v1 - env: - GOROOT: ${{steps.setup-go-faster.outputs.GOROOT}} - with: - path-to-profile: coverage.out - if: ${{ runner.os == 'Linux' && matrix.go-version == '1.17.x' && github.event_name == 'push' }} + run: go test "-test.benchtime" 10ms -tags ci ./... diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 0a548696..cde29496 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -1,37 +1,61 @@ name: Static Analysis on: [push, pull_request] +permissions: + contents: read jobs: - checks: + static_analysis: runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: - - uses: actions/checkout@v2 - - uses: WillAbides/setup-go-faster@v1.6.0 + - uses: actions/checkout@v4 + with: + persist-credentials: false + - uses: WillAbides/setup-go-faster@v1.13.0 with: - go-version: '1.17.x' + go-version: '1.21.x' - name: Get dependencies + run: >- + sudo apt-get update && + sudo apt-get install + gcc + libegl1-mesa-dev + libgl1-mesa-dev + libgles2-mesa-dev + libx11-dev + xorg-dev + xvfb + + - name: Install analysis tools run: | - sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev go install golang.org/x/tools/cmd/goimports@latest go install github.com/fzipp/gocyclo/cmd/gocyclo@latest - go install golang.org/x/lint/golint@latest - go install honnef.co/go/tools/cmd/staticcheck@v0.2.1 - - - name: Cleanup repository - run: rm -rf vendor/ + go install honnef.co/go/tools/cmd/staticcheck@v0.4.6 + go install github.com/mattn/goveralls@latest - name: Vet - run: go vet -tags ci ./... + run: go vet ./... - name: Goimports - run: test -z $(goimports -e -d . | tee /dev/stderr) + run: test -z "$(goimports -e -d . | tee /dev/stderr)" - name: Gocyclo run: gocyclo -over 30 . - - name: Golint - run: golint -set_exit_status $(go list -tags ci ./...) - - name: Staticcheck - run: staticcheck -go 1.14 ./... + run: staticcheck ./... + + - name: Update coverage + run: | + set -e + xvfb-run go test -covermode=atomic -coverprofile=coverage.out ./... + coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'` + if (( $(echo "$coverage < 48" | bc) )); then echo "Test coverage lowered"; exit 1; fi + + - name: Update PR Coverage + uses: shogo82148/actions-goveralls@v1 + with: + path-to-profile: coverage.out diff --git a/go.mod b/go.mod index a42681e8..0e4e7332 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ module fyne.io/x/fyne -go 1.14 +go 1.17 require ( - fyne.io/fyne/v2 v2.4.1 + fyne.io/fyne/v2 v2.4.3 github.com/Andrew-M-C/go.jsonvalue v1.1.2-0.20211223013816-e873b56b4a84 github.com/eclipse/paho.mqtt.golang v1.3.5 github.com/gorilla/websocket v1.4.2 @@ -14,3 +14,30 @@ require ( github.com/wagslane/go-password-validator v0.3.0 golang.org/x/image v0.11.0 ) + +require ( + fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/fredbi/uri v1.0.0 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fyne-io/gl-js v0.0.0-20220119005834-d2da28d9ccfe // indirect + github.com/fyne-io/glfw-js v0.0.0-20220120001248-ee7290d23504 // indirect + github.com/fyne-io/image v0.0.0-20220602074514-4956b0afb3d2 // indirect + github.com/go-gl/gl v0.0.0-20211210172815-726fda9656d6 // indirect + github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect + github.com/go-text/render v0.0.0-20230619120952-35bccb6164b8 // indirect + github.com/go-text/typesetting v0.0.0-20230616162802-9c17dd34aa4a // indirect + github.com/godbus/dbus/v5 v5.1.0 // indirect + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/jsummers/gobmp v0.0.0-20151104160322-e2ba15ffa76e // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/srwiley/oksvg v0.0.0-20221011165216-be6e8873101c // indirect + github.com/tevino/abool v1.2.0 // indirect + github.com/yuin/goldmark v1.5.5 // indirect + golang.org/x/mobile v0.0.0-20230531173138-3c911d8e3eda // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/text v0.13.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + honnef.co/go/js/dom v0.0.0-20210725211120-f030747120f2 // indirect +) diff --git a/go.sum b/go.sum index 7ddeca3c..c6546775 100644 --- a/go.sum +++ b/go.sum @@ -40,10 +40,10 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -fyne.io/fyne/v2 v2.4.1 h1:Es100N6HIhJGg8H2ZAS2j5H/YibfxecXHs2V4A4hbq8= -fyne.io/fyne/v2 v2.4.1/go.mod h1:AWM1iPM2YfliduZ4u/kQzP9E6ARIWm0gg+57GpYzWro= -fyne.io/systray v1.10.1-0.20230722100817-88df1e0ffa9a h1:6Xf9fP3/mt72NrqlQhJWhQGcNf6GoG9X96NTaXr+K6A= -fyne.io/systray v1.10.1-0.20230722100817-88df1e0ffa9a/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= +fyne.io/fyne/v2 v2.4.3 h1:v2wncjEAcwXZ8UNmTCWTGL9+sGyPc5RuzBvM96GcC78= +fyne.io/fyne/v2 v2.4.3/go.mod h1:1h3BKxmQYRJlr2g+RGVxedzr6vLVQ/AJmFWcF9CJnoQ= +fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e h1:Hvs+kW2VwCzNToF3FmnIAzmivNgrclwPgoUdVSrjkP8= +fyne.io/systray v1.10.1-0.20231115130155-104f5ef7839e/go.mod h1:oM2AQqGJ1AMo4nNqZFYU8xYygSBZkW2hmdJ7n4yjedE= github.com/Andrew-M-C/go.jsonvalue v1.1.2-0.20211223013816-e873b56b4a84 h1:L2C3QKBQwuHuiKwaBj8HDs2r0bAUGqtBYe3ymG0S6Z4= github.com/Andrew-M-C/go.jsonvalue v1.1.2-0.20211223013816-e873b56b4a84/go.mod h1:oTJGG91FhtsxvUFVwHSvr6zuaTcAuroj/ToxfT7Ox8U= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -343,6 +343,7 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= +golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -434,8 +435,9 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14= golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -519,14 +521,16 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -539,8 +543,9 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc= golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/widget/diagramwidget/geometry/r2/box.go b/widget/diagramwidget/geometry/r2/box.go index 1acba780..5ca87265 100644 --- a/widget/diagramwidget/geometry/r2/box.go +++ b/widget/diagramwidget/geometry/r2/box.go @@ -2,20 +2,20 @@ package r2 // Box defines a box in R2 // -// A -// | -// | -// | -// v -// (1) A.X,A.Y +------+ A.X+S.X,A.Y (2) -// |\ | -// | \ | -// | \ | -// | \S | -// | \ | -// | \| -// (3)A.X,A.Y+S.Y +------+ A.X+S.X,A.Y+S.Y (4) +// A +// | +// | +// | +// v +// (1) A.X,A.Y +------+ A.X+S.X,A.Y (2) +// |\ | +// | \ | +// | \ | +// | \S | +// | \ | +// | \| // +// (3)A.X,A.Y+S.Y +------+ A.X+S.X,A.Y+S.Y (4) type Box struct { // A defines the top-left corner of the box