Skip to content

Commit

Permalink
Merge branch 'release/v1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 19, 2019
2 parents df5294e + 16f1fa7 commit d8ddc74
Show file tree
Hide file tree
Showing 2,320 changed files with 1,621,384 additions and 809 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea

cmd/fyne/fyne
cmd/fyne_demo/fyne_demo
cmd/hello/hello
38 changes: 24 additions & 14 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
language: go

go:
- "1.10"
- "1.10.x"
- "1.11.x"
go_import_path: fyne.io/fyne

os:
- linux
- osx

addons:
apt:
packages:
- libgl1-mesa-dev
- xorg-dev

gobuild_args: "-v -tags ci"

before_script:
# - go get github.com/golang/lint/golint
- NO_VENDOR=$(find . -iname '*.go' -type f | grep -v /vendor/)
- go get golang.org/x/lint/golint
- go get github.com/mattn/goveralls
- go get github.com/stretchr/testify

script:
- test -z $(gofmt -s -l .)
- go test -v -race -covermode=atomic -coverprofile=coverage.out ./...
- go vet ./...
# - golint -set_exit_status $(go list ./...)
- test -z $(gofmt -s -l $NO_VENDOR)
- go test -tags ci ./...
- go vet -tags ci -unsafeptr=false ./...
- golint -set_exit_status $(go list -tags ci ./...) || exit 1
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit; fi'
- go test -tags ci -covermode=atomic -coverprofile=coverage.out ./...
- $(go env GOPATH | awk 'BEGIN{FS=":"} {print $1}')/bin/goveralls -coverprofile=coverage.out -service=travis-ci -repotoken $COVERALLS_TOKEN

notifications:
irc:
channels:
- "irc.freenode.net#fyne"
on_success: change
template:
- "Build %{repository_name}#%{build_number} %{result} (%{branch} %{commit} \"%{commit_subject}\")"

env:
global:
secure: dxsvChfy84dx85yoDA08UQL9/uwuab2St/yzWGfI++tlY1yL+kUNTfaTTY0uiT6Fqwg8rfUdXPA95Z/9bwLPkMJ8p1zwRlxBKjzICTGjB/NDLUYWrZVW+kXOOWrLHEluccrAc5mvWY1/k6KaxqYslanIPOj8j9/7sZJBMsvH8teHjRDGn402sCIBO3SUwthGKktLuAUL5MCiVgo/Eym4mQ2a4OAbZBWqKRQ+7HJunbEzwA/2zOUm/WX3NTy8dg67yyPNLXgMarVsmRXRDYPMlSGfV6Y3kBGizhEGy/u8zXe17KmPjqEKDLWHZZxt0wWYVidERLk1EG2Sm0maIV0i6a+wunCLqQXKHPF8BDwZGftYNbbrED7+4Jnp2h5Y8fS5FlpNAgPZp4YWbOhMpZIhahms3qwGloTGrCj+YvnUu6wnKOnhsvcz2Ibgi+pXr2/3H8lSjAg//P7wRYQN0pvIdacDRD0Vx10bENPAO2IKV7COv/NI0WLrBezDcRS4j60m4EgAdmambKye/mYqERY2P+2e1pMVcn4xaehXxfdyb5MGsZtIh7h0vP9LxVpj+mIVE/WDk36sWPVlTtumVioC5vhr087RrTOj3fNAjHeEMvJa5uiyKxT3UOCx6YORGHkH0i9fz/2QHCA2FBrOdTFv3oe1L2W23iqs9cSx+FxaVCE=
5 changes: 4 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Andy Williams <[email protected]>
Andy Williams <[email protected]>
Steve OConnor <[email protected]>
Luca Corbo <[email protected]>
Paul Hovey <[email protected]>
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq
167 changes: 137 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,63 @@
<p align="center">
<a href="https://godoc.org/fyne.io/fyne" title="GoDoc Reference" rel="nofollow"><img src="https://img.shields.io/badge/go-documentation-blue.svg?style=flat" alt="GoDoc Reference"></a>
<a href="https://github.com/fyne-io/fyne/releases/tag/v1.0.0" title="1.0.0 Release" rel="nofollow"><img src="https://img.shields.io/badge/version-1.0.0-blue.svg?style=flat" alt="1.0.0 release"></a>
<a href='https://github.com/avelino/awesome-go'><img src='https://awesome.re/mentioned-badge.svg' alt='Mentioned in Awesome' /></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"><img src="https://goreportcard.com/badge/fyne.io/fyne" alt="Code Status" /></a>
<a href="https://travis-ci.org/fyne-io/fyne"><img src="https://travis-ci.org/fyne-io/fyne.svg" alt="Build Status" /></a>
<a href="https://goreportcard.com/report/github.com/fyne-io/fyne"><img src="https://goreportcard.com/badge/github.com/fyne-io/fyne" alt="Code Status" /></a>
<a href='https://coveralls.io/github/fyne-io/fyne?branch=develop'><img src='https://coveralls.io/repos/github/fyne-io/fyne/badge.svg?branch=develop' alt='Coverage Status' /></a>
<!--a href='https://sourcegraph.com/github.com/fyne-io/fyne?badge'><img src='https://sourcegraph.com/github.com/fyne-io/fyne/-/badge.svg' alt='Used By' /></a-->
</p>

# About

[Fyne](http://fyne.io) is an easy to use UI toolkit and app API written in Go. We use the EFL render pipeline to provide cross platform graphics.
[Fyne](http://fyne.io) is an easy to use UI toolkit and app API written in Go. We use OpenGL (through the go-gl and go-glfw projects) to provide cross platform graphics.

This is under heavy development and is not yet capable of supporting a full application
The 1.0 release is now out and we encourage feedback and requests for the next major releae :).

# Prerequisites
# Getting Started

Before you can use the Fyne tools you need to have a stable copy of EFL installed. This will be automated by our [bootstrap](https://github.com/fyne-io/bootstrap/) scripts soon, but for now you can follow our [setup instructions](https://github.com/fyne-io/bootstrap/blob/master/README.md).
Fyne is designed to be really easy to code with, here are the steps to your first app.

# Getting Started
## Prerequisites

As Fyne uses CGo you will require a C compiler (typically gcc).
If you don't have one set up the instructions at [Compiling](https://github.com/fyne-io/fyne/wiki/Compiling) may help.

By default Fyne uses the [gl golang bindings](https://github.com/go-gl/gl) which means you need a working OpenGL configuration.
Debian/Ubuntu based systems may need to also need to install the `libgl1-mesa-dev` and `xorg-dev` packages.

Using the standard go tools you can install Fyne's core library using:

Using standard go tools you can install Fyne's core library using:
go get fyne.io/fyne

go get github.com/fyne-io/fyne-app
## Code

And then you're ready to write your first app - this example shows how:
And then you're ready to write your first app!

package main
```go
package main

import "github.com/fyne-io/fyne/ui"
import "github.com/fyne-io/fyne/ui/event"
import "github.com/fyne-io/fyne/ui/layout"
import "github.com/fyne-io/fyne/ui/widget"
import "github.com/fyne-io/fyne-app"
import (
"fyne.io/fyne/widget"
"fyne.io/fyne/app"
)

func main() {
app := fyneapp.NewApp()
func main() {
app := app.New()

w := app.NewWindow("Hello")
quit := widget.NewButton("Quit", func(*event.MouseEvent) {
app.Quit()
})
w.Canvas().SetContent(ui.NewContainer(
[]ui.CanvasObject{
widget.NewLabel("Hello Fyne!"),
quit,
},
layout.NewGridLayout(1)))
w := app.NewWindow("Hello")
w.SetContent(widget.NewVBox(
widget.NewLabel("Hello Fyne!"),
widget.NewButton("Quit", func() {
app.Quit()
}),
))

w.Show()
}
w.ShowAndRun()
}
```

And you can run that simply as:

Expand All @@ -54,5 +66,100 @@ And you can run that simply as:
It should look like this:

<p align="center" markdown="1">
<img src="hello.png" alt="Fyne Screenshot" />
<img src="img/hello-normal.png" width="207" height="204" alt="Fyne Hello Dark Theme" />
</p>

> 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.
# Scaling

Fyne is built entirely using vector graphics which means that applications
that are written using it will scale to any value beautifully (not just whole number values).
The default scale value is calculated from your screen's DPI - and if you move
a window to another screen it will re-scale and adjust the window size accordingly!
We call this "auto scaling" and it is designed to keep an app GUI the same size as you change monitor.
You can override this behaviour by setting a specific scale using the FYNE_SCALE environment variable.

<table style="text-align: center"><tr>
<td><img src="img/hello-normal.png" width="207" height="204" alt="Hello normal size" />
<br />Standard size</td>
<td><img src="img/hello-small.png" width="160" height="169" alt="Hello small size" />
<br />FYNE_SCALE=0.5</td>
<td><img src="img/hello-large.png" width="350" height="309" alt="Hello large size" />
<br />FYNE_SCALE=2.5</td>
</tr></table>

# Themes

Fyne ships with two themes by default, "light" and "dark". You can choose
which to use with the environment variable ```FYNE_THEME```.
The default is dark:

<p align="center" markdown="1">
<img src="img/hello-normal.png" width="207" height="204" alt="Fyne Hello Dark Theme" />
</p>

If you prefer a light theme then you could run:

FYNE_THEME=light go run main.go

It should then look like this:

<p align="center" markdown="1">
<img src="img/hello-light.png" width="207" height="204" alt="Fyne Hello Light Theme" />
</p>

# Widget demo

To run a showcase of the features of fyne execute the following:

cd $GOPATH/src/fyne.io/fyne/cmd/fyne_demo/
go build
./fyne_demo

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" alt="Fyne Hello Light 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" alt="Fyne Hello Light Theme" />
</p>

# Declarative API

If you prefer a more declarative API then that is provided too.
The following is exactly the same as the code above but in this different style.

```go
package main

import (
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
)

func main() {
app := app.New()

w := app.NewWindow("Hello")
w.SetContent(&widget.Box{Children: []fyne.CanvasObject{
&widget.Label{Text: "Hello Fyne!"},
&widget.Button{Text: "Quit", OnTapped: func() {
app.Quit()
}},
}})

w.ShowAndRun()
}
```

# Examples

The main examples have been moved - you can find them in their [own repository](https://github.com/fyne-io/examples/).

54 changes: 54 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package fyne

import "net/url"

// An App is the definition of a graphical application.
// Apps can have multiple windows, it will exit when the first window to be
// shown is closed. You can also cause the app to exit by calling Quit().
// To start an application you need to call Run() somewhere in your main() function.
// Alternatively use the window.ShowAndRun() function for your main window.
type App interface {
// Create a new window for the application.
// The first window to open is considered the "master" and when closed
// the application will exit.
NewWindow(title string) Window

// Open a URL in the default browser application.
OpenURL(url *url.URL) error

// Icon returns the application icon, this is used in various ways
// depending on operating system.
// This is also the default icon for new windows.
Icon() Resource

// SetIcon sets the icon resource used for this application instance.
SetIcon(Resource)

// Run the application - this starts the event loop and waits until Quit()
// is called or the last window closes.
// This should be called near the end of a main() function as it will block.
Run()

// Calling Quit on the application will cause the application to exit
// cleanly, closing all open windows.
Quit()

// Driver returns the driver that is rendering this application.
// Typically not needed for day to day work, mostly internal functionality.
Driver() Driver

// Settings return the application settings, determining theme and so on.
Settings() Settings
}

var app App

// SetCurrentApp is an internal function to set the app instance currently running.
func SetCurrentApp(current App) {
app = current
}

// CurrentApp returns the current application, for which there is only 1 per process.
func CurrentApp() App {
return app
}
Loading

0 comments on commit d8ddc74

Please sign in to comment.