~eliasnaur/giobtc

ed79701facedbf387e602091873a2f87aefaa030 — Elias Naur 1 year, 8 days ago 2001c5e master
update gio version

Signed-off-by: Elias Naur <mail@eliasnaur.com>
4 files changed, 21 insertions(+), 14 deletions(-)

M go.mod
M go.sum
M golab-workshop-2019.slide
M main.go
M go.mod => go.mod +2 -1
@@ 3,7 3,8 @@ module eliasnaur.com/giobtc
go 1.14

require (
	gioui.org v0.0.0-20191020230431-dafb18017651
	eliasnaur.com/giox v0.0.0-20200114124148-7ce24a79aa1d
	gioui.org v0.0.0-20200113204813-a7dc7c01c0f5
	github.com/btcsuite/btcd v0.0.0-20191011231409-07282a6656b8
	github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
	github.com/skip2/go-qrcode v0.0.0-20190110000554-dc11ecdae0a9

M go.sum => go.sum +4 -2
@@ 1,6 1,8 @@
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20191020230431-dafb18017651 h1:+0jQrLAVAgr0Pg3HRhDXnSSxW+tE0h4eDMLiLXfUQzo=
gioui.org v0.0.0-20191020230431-dafb18017651/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
eliasnaur.com/giox v0.0.0-20200114124148-7ce24a79aa1d h1:HR5wUSj4mv0mHyyRqa2TZhT6BYAdNWpnmmPwL0jXYOo=
eliasnaur.com/giox v0.0.0-20200114124148-7ce24a79aa1d/go.mod h1:EteDxd8W89s/4o3YyqQaF+DG8kVqEnxyPliHSkqwwqE=
gioui.org v0.0.0-20200113204813-a7dc7c01c0f5 h1:1CDWs+aNGYck65Hcqmp4ySl5zD8UrjRq3nqD07j5hZc=
gioui.org v0.0.0-20200113204813-a7dc7c01c0f5/go.mod h1:KqFFi2Dq5gYA3FJ0sDOt8OBXoMsuxMtE8v2f0JExXAY=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/btcsuite/btcd v0.0.0-20191011231409-07282a6656b8 h1:VtBbiBsPRCedNPZELoycBnfoMcpSPnc5ktPh+ORniJw=

M golab-workshop-2019.slide => golab-workshop-2019.slide +2 -0
@@ 26,6 26,8 @@ $ go run .

* Blank window

Copy paste from: *http://tiny.cc/golab2019*

  package main

  import (

M main.go => main.go +13 -11
@@ 16,6 16,7 @@ import (
	"gioui.org/io/system"
	"gioui.org/layout"
	"gioui.org/op"
	"gioui.org/op/clip"
	"gioui.org/op/paint"
	"gioui.org/text"
	"gioui.org/unit"


@@ 24,7 25,9 @@ import (

	"github.com/skip2/go-qrcode"

	_ "gioui.org/font/gofont"
	xlayout "eliasnaur.com/giox/layout"

	"gioui.org/font/gofont"
)

type fill color.RGBA


@@ 34,6 37,7 @@ var (
)

func init() {
	gofont.Register()
	theme = material.NewTheme()
	theme.Color.Primary = rgb(0x1b5e20)
	//theme.TextSize = unit.Sp(20)


@@ 78,9 82,7 @@ func NewApp() *App {
func runUI() {
	a := NewApp()
	w := app.NewWindow()
	gtx := &layout.Context{
		Queue: w.Queue(),
	}
	gtx := layout.NewContext(w.Queue())
	for {
		select {
		case e := <-a.wallet.events:


@@ 106,7 108,7 @@ func runUI() {
}

func (a *App) Layout(gtx *layout.Context) {
	layout.Format(gtx, "stack(southeast, r(max(_)), r(inset(16dp, _)))",
	xlayout.Format(gtx, "stack(southeast, r(max(_)), r(inset(16dp, _)))",
		func() {
			a.layoutMain(gtx)
		},


@@ 118,10 120,10 @@ func (a *App) Layout(gtx *layout.Context) {
		},
	)
	if a.showQR {
		layout.Format(gtx, "center(inset(16dp, _))",
		xlayout.Format(gtx, "center(inset(16dp, _))",
			func() {
				Corners(unit.Dp(10)).Layout(gtx, func() {
					layout.Format(gtx, "stack(center, r(_), e(min(inset(16dp, south(_)))))",
					xlayout.Format(gtx, "stack(center, r(_), e(min(inset(16dp, south(_)))))",
						func() {
							sz := gtx.Constraints.Width.Constrain(gtx.Px(unit.Dp(500)))
							a.addrQR.Add(gtx.Ops)


@@ 156,7 158,7 @@ func (a *App) layoutMain(gtx *layout.Context) {
			r(_)
		)
	`
	layout.Format(gtx, f,
	xlayout.Format(gtx, f,
		func() {
			fill(rgb(0x1b5e20)).Layout(gtx)
		},


@@ 211,7 213,7 @@ func (a *App) layoutTrans(gtx *layout.Context) {
				r(_)
			)
		)`
		layout.Format(gtx, f,
		xlayout.Format(gtx, f,
			func() {
				tim := theme.Body1(t.FormatTime())
				tim.Color = alpha(a, tim.Color)


@@ 261,7 263,7 @@ func (c Corners) Layout(gtx *layout.Context, w layout.Widget) {
	var stack op.StackOp
	stack.Push(gtx.Ops)
	rrect(gtx.Ops, float32(sz.X), float32(sz.Y), rr, rr, rr, rr)
	macro.Add(gtx.Ops)
	macro.Add()
	stack.Pop()
}



@@ 288,7 290,7 @@ func (f fill) Layout(gtx *layout.Context) {
func rrect(ops *op.Ops, width, height, se, sw, nw, ne float32) {
	w, h := float32(width), float32(height)
	const c = 0.55228475 // 4*(sqrt(2)-1)/3
	var b paint.Path
	var b clip.Path
	b.Begin(ops)
	b.Move(f32.Point{X: w, Y: h - se})
	b.Cube(f32.Point{X: 0, Y: se * c}, f32.Point{X: -se + se*c, Y: se}, f32.Point{X: -se, Y: se}) // SE