show/hide

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-09 03:46:41 -06:00
parent 1aacff60a1
commit cdb0808c22
3 changed files with 34 additions and 16 deletions

10
args.go
View File

@ -4,12 +4,8 @@ package digitalocean
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/log"
)
var NOW *log.LogFlag
var INFO *log.LogFlag
var POLL *log.LogFlag
var argDo ArgsDo
// This struct can be used with the go-arg package
@ -19,10 +15,4 @@ type ArgsDo struct {
func init() {
arg.Register(&argDo)
full := "go.wit.com/lib/gui/digitalocean"
short := "DOgui"
NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff")
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
INFO = log.NewFlag("POLL", false, full, short, "show droplet status polling")
}

20
flags.go Normal file
View File

@ -0,0 +1,20 @@
package digitalocean
// initializes logging and command line options
import (
"go.wit.com/log"
)
var NOW *log.LogFlag
var INFO *log.LogFlag
var POLL *log.LogFlag
func init() {
full := "go.wit.com/lib/gui/digitalocean"
short := "DOgui"
NOW = log.NewFlag("NOW", true, full, short, "temp debugging stuff")
INFO = log.NewFlag("INFO", false, full, short, "normal debugging stuff")
POLL = log.NewFlag("POLL", false, full, short, "show droplet status polling")
}

20
new.go
View File

@ -48,9 +48,7 @@ func (d *DigitalOcean) Show() {
return
}
log.Info("digitalocean.Show() window")
if d.hidden {
d.window.Show()
}
d.window.Show()
d.hidden = false
}
@ -59,12 +57,22 @@ func (d *DigitalOcean) Hide() {
return
}
log.Info("digitalocean.Hide() window")
if !d.hidden {
d.window.Hide()
}
d.window.Hide()
d.hidden = true
}
func (d *DigitalOcean) Toggle() {
if !d.Ready() {
return
}
log.Info("digitalocean.Hide() window")
if d.hidden {
d.Show()
} else {
d.Hide()
}
}
func (d *DigitalOcean) Update() bool {
if !d.Ready() {
return false