Add a window title and run go fmt.

This commit is contained in:
Greg 2019-09-06 21:14:06 -04:00
parent dd18765a80
commit 44cab96fff
3 changed files with 21 additions and 20 deletions

View File

@ -135,7 +135,9 @@ func saveConf(fds ...*os.File) {
} }
func eventLoop() { func eventLoop() {
w := app.NewWindow(app.WithWidth(ui.Dp(250))) w := app.NewWindow(
app.WithWidth(ui.Dp(250)),
app.WithTitle("passgo"))
q := w.Queue() q := w.Queue()
var c ui.Config var c ui.Config
ops := new(ui.Ops) ops := new(ui.Ops)
@ -237,13 +239,13 @@ func eventLoop() {
anim := &time.Ticker{} anim := &time.Ticker{}
animating := false animating := false
animOn := func() { animOn := func() {
log(Info,"animOn()") log(Info, "animOn()")
anim = time.NewTicker(time.Second / 120) anim = time.NewTicker(time.Second / 120)
animating = true animating = true
w.Invalidate() w.Invalidate()
} }
animOff := func() { animOff := func() {
log(Info,"animOff()") log(Info, "animOff()")
anim.Stop() anim.Stop()
animating = false animating = false
} }
@ -261,7 +263,7 @@ func eventLoop() {
// timing variables used for animation // timing variables used for animation
fade1a, fade1b := 1.5, 2.0 fade1a, fade1b := 1.5, 2.0
start2 := float64(Config.ClearDelay) start2 := float64(Config.ClearDelay)
fade2a, end := start2 + 1.5, start2 + 2.0 fade2a, end := start2+1.5, start2+2.0
cs = flex.Flexible(1.0) cs = flex.Flexible(1.0)
mux.Lock() mux.Lock()
@ -286,7 +288,7 @@ func eventLoop() {
log(Info, "Clicked ", btn.Label) log(Info, "Clicked ", btn.Label)
// don't block UI thread on decryption attempt // don't block UI thread on decryption attempt
go func(name string) { go func(name string) {
p,err := store.Decrypt(name, prompt) p, err := store.Decrypt(name, prompt)
//p, err := store.Decrypt(name) //p, err := store.Decrypt(name)
if err == nil { if err == nil {
passgo.Clip(p) passgo.Clip(p)
@ -324,9 +326,9 @@ func eventLoop() {
if x >= fade1b && x < start2 && animating { if x >= fade1b && x < start2 && animating {
animOff() animOff()
go func() { go func() {
time.Sleep(time.Millisecond * time.Duration((start2 - x)*1000)) time.Sleep(time.Millisecond * time.Duration((start2-x)*1000))
w.Invalidate() w.Invalidate()
time.Sleep(time.Millisecond * time.Duration((fade2a - start2)*1000)) time.Sleep(time.Millisecond * time.Duration((fade2a-start2)*1000))
animOn() animOn()
}() }()
} }
@ -435,7 +437,7 @@ func eventLoop() {
if submit || okBtn.Clicked() { if submit || okBtn.Clicked() {
log(Info, "Ok") log(Info, "Ok")
go func() { // do not block UI thread go func() { // do not block UI thread
passch <-[]byte(promptEd.Text()) passch <- []byte(promptEd.Text())
}() }()
w.Invalidate() w.Invalidate()
page = listPage page = listPage

View File

@ -127,4 +127,3 @@ func (b *Button) Layout(c ui.Config, q input.Queue, ops *ui.Ops, cs layout.Const
func (b *Button) Clicked() bool { func (b *Button) Clicked() bool {
return b.clicked return b.clicked
} }

View File

@ -8,5 +8,5 @@ import (
//Clip copies a string to the clipboard //Clip copies a string to the clipboard
func Clip(x string) { func Clip(x string) {
log(Info,"Clipboard not implemented for this platform") log(Info, "Clipboard not implemented for this platform")
} }