mirror of https://github.com/miguelmota/cointop
marketbar
Former-commit-id: d1a541c46f5da9debd3c9928f9263b6700978755 [formerly d1a541c46f5da9debd3c9928f9263b6700978755 [formerly 97ac554186e96a62b7b71239c7d5d3a88929adb0 [formerly dd9f2d48b6
]]]
Former-commit-id: bc61122f27cc23ea8df80f510c13372d9448d2ec
Former-commit-id: aee7b531ed7503994b7bea2004f10d810025d142 [formerly 4ed5978aa3faa95f2e5058111dbd487d5a15b202]
Former-commit-id: 897d294659f3a94f556feff81a36057703141928
pull/15/head
parent
a3546916b3
commit
8ec75323e7
@ -0,0 +1,38 @@
|
||||
package cointop
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (ct *Cointop) refreshAll() error {
|
||||
ct.refreshmux.Lock()
|
||||
ct.setRefreshStatus()
|
||||
ct.updateCoins()
|
||||
ct.updateTable()
|
||||
ct.updateMarketbar()
|
||||
ct.updateChart()
|
||||
ct.refreshmux.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ct *Cointop) setRefreshStatus() {
|
||||
go func() {
|
||||
ct.loadingTicks("refreshing", 900)
|
||||
ct.updateStatusbar("")
|
||||
ct.rowChanged()
|
||||
}()
|
||||
}
|
||||
|
||||
func (ct *Cointop) loadingTicks(s string, t int) {
|
||||
interval := 150
|
||||
k := 0
|
||||
for i := 0; i < (t / interval); i++ {
|
||||
ct.updateStatusbar(s + strings.Repeat(".", k))
|
||||
time.Sleep(time.Duration(i*interval) * time.Millisecond)
|
||||
k = k + 1
|
||||
if k > 3 {
|
||||
k = 0
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue