Skip to content

Commit

Permalink
Merge branch 'release/v2.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 4, 2021
2 parents c29a062 + b9b3a57 commit 622d3ef
Show file tree
Hide file tree
Showing 336 changed files with 2,609 additions and 1,529 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/mobile_tests.yml
@@ -0,0 +1,23 @@
name: Mobile Tests
on: [push, pull_request]

jobs:
mobile_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.12.x, 1.15.x]

steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}

- name: Get dependencies
run: sudo apt-get update && sudo apt-get install gcc libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev

- name: Tests
run: go test -tags "ci mobile" ./...

2 changes: 1 addition & 1 deletion .github/workflows/platform_tests.yml
Expand Up @@ -17,7 +17,7 @@ jobs:
go-version: ${{ matrix.go-version }}

- name: Get dependencies
run: sudo apt-get update && sudo apt-get install golang gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
if: ${{ runner.os == 'Linux' }}

#- name: Verify go modules
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/static_analysis.yml
Expand Up @@ -12,8 +12,7 @@ jobs:

- name: Get dependencies
run: |
sudo apt-get update
sudo apt-get install golang gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
GO111MODULE=off go get golang.org/x/tools/cmd/goimports
GO111MODULE=off go get github.com/fzipp/gocyclo/cmd/gocyclo
GO111MODULE=off go get golang.org/x/lint/golint
Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,51 @@
This file lists the main changes with each version of the Fyne toolkit.
More detailed release notes can be found on the [releases page](https://github.com/fyne-io/fyne/releases).

## 2.0.1 - 4 March 2021

### Changed

* An Entry with `Wrapping=fyne.TextWrapOff` no longer blocks scroll events from a parent

### Fixed

* Dialog.Resize() has no effect if called before Dialog.Show() (#1863)
* SelectTab does not always correctly set the blue underline to the selected tab (#1872)
* Entry Validation Broken when using Data binding (#1890)
* Fix background colour not applying until theme change
* android runtime error with fyne.dialog (#1896)
* Fix scale calculations for Wayland phones (PinePhone)
* Correct initial state of entry validation
* fix entry widget mouse drag selection when scrolled
* List widget panic when refreshing after changing content length (#1864)
* Fix image caching that was too agressive on resize
* Pointer and cursor misalignment in widget.Entry (#1937)
* SIGSEGV Sometimes When Closing a Program by Clicking a Button (#1604)
* Advanced Color Picker shows Black for custom primary color as RGBA (#1970)
* Canvas.Focus() before window visible causes application to crash (#1893)
* Menu over Content (#1973)
* Error compiling fyne on Apple M1 arm64 (#1739)
* Cells are not getting draw in correct location after column resize. (#1951)
* Possible panic when selecting text in a widget.Entry (#1983)
* Form validation doesn't enable submit button (#1965)
* Creating a window shows it before calling .Show() and .Hide() does not work (#1835)
* Dialogs are not refreshed correctly on .Show() (#1866)
* Failed creating setting storage : no such directory (#2023)
* Erroneous custom filter types not supported error on mobile (#2012)
* High importance button show no hovered state (#1785)
* List widget does not render all visible content after content data gets shorter (#1948)
* Calling Select on List before draw can crash (#1960)
* Dialog not resizing in newly created window (#1692)
* Dialog not returning to requested size (#1382)
* Entry without scrollable content prevents scrolling of outside scroller (#1939)
* fyne_demo crash after selecting custom Theme and table (#2018)
* Table widget crash when scrolling rapidly (#1887)
* Cursor animation sometimes distorts the text (#1778)
* Extended password entry panics when password revealer is clicked (#2036)
* Data binding limited to 1024 simultaneous operations (#1838)
* Custom theme does not refresh when variant changes (#2006)


## 2.0 - 22 January 2021

### Changes that are not backward compatible
Expand Down
34 changes: 28 additions & 6 deletions README.md
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://pkg.go.dev/fyne.io/fyne/v2?tab=doc" title="Go API Reference" rel="nofollow"><img src="https://img.shields.io/badge/go-documentation-blue.svg?style=flat" alt="Go API Reference"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v2.0.0" title="2.0.0 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-2.0.0-blue.svg?style=flat" alt="2.0.0 release"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v2.0.1" title="2.0.1 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-2.0.1-blue.svg?style=flat" alt="2.0.1 release"></a>
<a href='http://gophers.slack.com/messages/fyne'><img src='https://img.shields.io/badge/join-us%20on%20slack-gray.svg?longCache=true&logo=slack&colorB=blue' alt='Join us on Slack' /></a>
<br />
<a href="https://goreportcard.com/report/fyne.io/fyne/v2"><img src="https://goreportcard.com/badge/fyne.io/fyne/v2" alt="Code Status" /></a>
Expand All @@ -10,7 +10,7 @@

# About

[Fyne](https://fyne.io) is an easy to use UI toolkit and app API written in Go.
[Fyne](https://fyne.io) is an easy-to-use UI toolkit and app API written in Go.
It is designed to build applications that run on desktop and mobile devices with a
single codebase.

Expand Down Expand Up @@ -42,13 +42,19 @@ To run a showcase of the features of Fyne execute the following:
And you should see something like this (after you click a few buttons):

<p align="center" markdown="1" style="max-width: 100%">
<img src="img/widgets-dark.png" width="752" height="617" alt="Fyne Hello Light Theme" style="max-width: 100%" />
<img src="img/widgets-dark.png" width="752" height="617" alt="Fyne Demo Dark Theme" style="max-width: 100%" />
</p>

Or if you are using the light theme:

<p align="center" markdown="1" style="max-width: 100%">
<img src="img/widgets-light.png" width="752" height="617" alt="Fyne Hello Light Theme" style="max-width: 100%" />
<img src="img/widgets-light.png" width="752" height="617" alt="Fyne Demo Light Theme" style="max-width: 100%" />
</p>

And even running on a mobile device:

<p align="center" markdown="1" style="max-width: 100%">
<img src="img/widgets-mobile-light.png" width="348" height="617" alt="Fyne Demo Mobile Light Theme" style="max-width: 100%" />
</p>

# Getting Started
Expand Down Expand Up @@ -86,7 +92,7 @@ func main() {

And you can run that simply as:

go run main.go
$ go run main.go

It should look like this:

Expand All @@ -103,6 +109,12 @@ It should look like this:
> Note that Windows applications load from a command prompt by default, which means if you click an icon you may see a command window.
> To fix this add the parameters `-ldflags -H=windowsgui` to your run or build commands.
## Run in mobile simulation

There is a helpful mobile simulation mode that gives a hint of how your app would work on a mobile device:

$ go run -tags mobile main.go

# Installing

Using `go install` will copy the executable into your go `bin` dir.
Expand All @@ -112,7 +124,17 @@ application location you can use the fyne utility and the "install" subcommand.
$ go get fyne.io/fyne/v2/cmd/fyne
$ fyne install

# Packaging a release
# Packaging for mobile

To run on a mobile device it is necessary to package up the application.
To do this we can use the fyne utility "package" subcommand.
You will need to add appropriate parameters as prompted, but the basic command is shown below.
Once packaged you can install using the platform development tools or the fyne "install" subcommand.

$ fyne package -os android -appID my.domain.appname
$ fyne install -os android

# Preparing a release

Using the fyne utility "release" subcommand you can package up your app for release
to app stores and market places. Make sure you have the standard build tools installed
Expand Down
36 changes: 23 additions & 13 deletions app/settings.go
Expand Up @@ -139,26 +139,36 @@ func (s *settings) fileChanged() {
}

func (s *settings) setupTheme() {
if s.themeSpecified {
return
}
name := s.schema.ThemeName
if env := os.Getenv("FYNE_THEME"); env != "" {
s.themeSpecified = true
name = env
}

if name == "light" {
s.applyTheme(theme.LightTheme(), theme.VariantLight)
} else if name == "dark" {
s.applyTheme(theme.DarkTheme(), theme.VariantDark)
} else {
if defaultVariant() == theme.VariantLight {
s.applyTheme(theme.LightTheme(), theme.VariantLight)
} else {
s.applyTheme(theme.DarkTheme(), theme.VariantDark)
var variant fyne.ThemeVariant
effectiveTheme := s.theme
switch name {
case "light":
variant = theme.VariantLight
if !s.themeSpecified {
effectiveTheme = theme.LightTheme()
}
case "dark":
variant = theme.VariantDark
if !s.themeSpecified {
effectiveTheme = theme.DarkTheme()
}
default:
variant = defaultVariant()
if s.themeSpecified {
break
}
effectiveTheme = theme.DarkTheme()
if variant == theme.VariantLight {
effectiveTheme = theme.LightTheme()
}
}

s.applyTheme(effectiveTheme, variant)
}

func loadSettings() *settings {
Expand Down
2 changes: 1 addition & 1 deletion app/settings_desktop.go
Expand Up @@ -25,7 +25,7 @@ func ensureDirExists(dir string) {
return
}

err := os.Mkdir(dir, 0700)
err := os.MkdirAll(dir, 0700)
if err != nil {
fyne.LogError("Unable to create settings storage:", err)
}
Expand Down
54 changes: 53 additions & 1 deletion app/settings_test.go
Expand Up @@ -76,16 +76,68 @@ func TestOverrideTheme_IgnoresSettingsChange(t *testing.T) {
}
set.setupTheme()
assert.Equal(t, theme.LightTheme(), set.Theme())

err = set.loadFromFile(filepath.Join("testdata", "dark-theme.json"))
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.Equal(t, theme.LightTheme(), set.Theme())
err = os.Setenv("FYNE_THEME", "")
if err != nil {
t.Error(err)
}
}

func TestCustomTheme(t *testing.T) {
type customTheme struct {
fyne.Theme
}
set := &settings{}
ctheme := &customTheme{theme.LightTheme()}
set.SetTheme(ctheme)

set.setupTheme()
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, defaultVariant(), set.ThemeVariant())

err := set.loadFromFile(filepath.Join("testdata", "light-theme.json"))
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, theme.VariantLight, set.ThemeVariant())

err = set.loadFromFile(filepath.Join("testdata", "dark-theme.json"))
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, theme.VariantDark, set.ThemeVariant())

err = os.Setenv("FYNE_THEME", "light")
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.Equal(t, theme.LightTheme(), set.Theme())
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, theme.VariantLight, set.ThemeVariant())

err = os.Setenv("FYNE_THEME", "dark")
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, theme.VariantDark, set.ThemeVariant())

err = os.Setenv("FYNE_THEME", "")
if err != nil {
t.Error(err)
}
set.setupTheme()
assert.True(t, set.Theme() == ctheme)
assert.Equal(t, theme.VariantDark, set.ThemeVariant())
}
22 changes: 11 additions & 11 deletions canvas/base.go
Expand Up @@ -14,48 +14,48 @@ import (
)

type baseObject struct {
size fyne.Size // The current size of the Rectangle
position fyne.Position // The current position of the Rectangle
size fyne.Size // The current size of the canvas object
position fyne.Position // The current position of the object
Hidden bool // Is this object currently hidden

min fyne.Size // The minimum size this object can be

propertyLock sync.RWMutex
}

// CurrentSize returns the current size of this rectangle object
// CurrentSize returns the current size of this canvas object.
func (r *baseObject) Size() fyne.Size {
r.propertyLock.RLock()
defer r.propertyLock.RUnlock()

return r.size
}

// Resize sets a new size for the rectangle object
// Resize sets a new size for the canvas object.
func (r *baseObject) Resize(size fyne.Size) {
r.propertyLock.Lock()
defer r.propertyLock.Unlock()

r.size = size
}

// CurrentPosition gets the current position of this rectangle object, relative to its parent / canvas
// CurrentPosition gets the current position of this canvas object, relative to its parent.
func (r *baseObject) Position() fyne.Position {
r.propertyLock.RLock()
defer r.propertyLock.RUnlock()

return r.position
}

// Move the rectangle object to a new position, relative to its parent / canvas
// Move the object to a new position, relative to its parent.
func (r *baseObject) Move(pos fyne.Position) {
r.propertyLock.Lock()
defer r.propertyLock.Unlock()

r.position = pos
}

// MinSize returns the specified minimum size, if set, or {1, 1} otherwise
// MinSize returns the specified minimum size, if set, or {1, 1} otherwise.
func (r *baseObject) MinSize() fyne.Size {
r.propertyLock.RLock()
defer r.propertyLock.RUnlock()
Expand All @@ -67,31 +67,31 @@ func (r *baseObject) MinSize() fyne.Size {
return r.min
}

// SetMinSize specifies the smallest size this object should be
// SetMinSize specifies the smallest size this object should be.
func (r *baseObject) SetMinSize(size fyne.Size) {
r.propertyLock.Lock()
defer r.propertyLock.Unlock()

r.min = size
}

// IsVisible returns true if this object is visible, false otherwise
// IsVisible returns true if this object is visible, false otherwise.
func (r *baseObject) Visible() bool {
r.propertyLock.RLock()
defer r.propertyLock.RUnlock()

return !r.Hidden
}

// Show will set this object to be visible
// Show will set this object to be visible.
func (r *baseObject) Show() {
r.propertyLock.Lock()
defer r.propertyLock.Unlock()

r.Hidden = false
}

// Hide will set this object to not be visible
// Hide will set this object to not be visible.
func (r *baseObject) Hide() {
r.propertyLock.Lock()
defer r.propertyLock.Unlock()
Expand Down

0 comments on commit 622d3ef

Please sign in to comment.