help view box

Former-commit-id: 2009e9710ca8f95d05bab3d8f95e7f0c2d9a45c8 [formerly 2009e9710ca8f95d05bab3d8f95e7f0c2d9a45c8 [formerly ed77cf94acc5d40169f7223affe4c56d1cc15e7b [formerly a10c081473193a8f72e8ddd014d2307429f98584]]]
Former-commit-id: a657654df076e43aed26e78aa94ba8dbdc11b250
Former-commit-id: 708da56884602ea1d315d7b2e48ebf22da03c352 [formerly 5905b7db96967db239e5e96d472e955706974734]
Former-commit-id: 5765a8a72f349ca1c3ed47116633ea578af47e86
pull/15/head
Miguel Mota 6 years ago
parent c0fffae086
commit 9f7977a065

@ -1,6 +1,11 @@
language: go
go:
- "1.4.x"
- "1.5.x"
- "1.6.x"
- "1.7.x"
- "1.8.x"
- "1.9.x"
- "1.10.x"
- "master"

@ -45,6 +45,7 @@ type Cointop struct {
savemux sync.Mutex
cache *cache.Cache
debug bool
helpview *gocui.View
}
// Run runs cointop

@ -1,15 +1,6 @@
package cointop
import (
"github.com/miguelmota/cointop/pkg/open"
)
// TODO: create a help menu
func (ct *Cointop) openHelp() error {
open.URL(ct.helpLink())
ct.setActiveView("help")
return nil
}
func (ct *Cointop) helpLink() string {
return "https://github.com/miguelmota/cointop#shortcuts"
}

@ -78,13 +78,34 @@ func (ct *Cointop) layout(g *gocui.Gui) error {
ct.searchfield.Wrap = true
ct.searchfield.Frame = false
ct.searchfield.FgColor = gocui.ColorWhite
}
// run only once on init
helpwidth := 50
helpheight := 25
tablewidth := 182
helpX := (tablewidth / 2) - (helpwidth / 2)
helpY := topOffset + 2
if helpX <= 0 {
helpX = 5
}
if v, err := g.SetView("help", helpX, helpY, helpX+helpwidth, helpY+helpheight); err != nil {
if err != gocui.ErrUnknownView {
return err
}
ct.helpview = v
ct.helpview.Frame = true
ct.helpview.BgColor = gocui.ColorBlack
ct.helpview.FgColor = gocui.ColorWhite
// run only once on init.
// this bit of code should be at the bottom
ct.g = g
g.SetViewOnBottom("searchfield")
g.SetViewOnBottom("searchfield") // hide
g.SetViewOnBottom("help") // hide
ct.setActiveView("table")
ct.intervalFetchData()
}
return nil
}

Loading…
Cancel
Save