package name renaming

This commit is contained in:
sqshq 2019-02-23 23:49:09 -05:00
parent ecd6344269
commit ee2b2ab3e2
12 changed files with 20 additions and 20 deletions

View File

@ -1,4 +1,4 @@
package widgets
package component
import (
"github.com/sqshq/sampler/config"

View File

@ -1,9 +1,9 @@
package widgets
package component
import (
"github.com/sqshq/sampler/component/runchart"
"github.com/sqshq/sampler/config"
"github.com/sqshq/sampler/console"
"github.com/sqshq/sampler/widgets/runchart"
ui "github.com/sqshq/termui"
)

View File

@ -1,4 +1,4 @@
package widgets
package component
import (
"github.com/sqshq/sampler/config"

View File

@ -2,9 +2,9 @@ package config
import (
"fmt"
"github.com/sqshq/sampler/component/asciibox"
"github.com/sqshq/sampler/console"
"github.com/sqshq/sampler/data"
"github.com/sqshq/sampler/widgets/asciibox"
"gopkg.in/yaml.v2"
"io/ioutil"
"log"

View File

@ -1,12 +1,12 @@
package config
import (
"github.com/sqshq/sampler/component/asciibox"
"github.com/sqshq/sampler/console"
"github.com/sqshq/sampler/widgets/asciibox"
)
const (
defaultRefreshRateMs = 1000
defaultRefreshRateMs = 200
defaultScale = 1
defaultTheme = console.ThemeDark
)

View File

@ -1,25 +1,25 @@
package event
import (
"github.com/sqshq/sampler/component"
"github.com/sqshq/sampler/config"
"github.com/sqshq/sampler/console"
"github.com/sqshq/sampler/widgets"
ui "github.com/sqshq/termui"
"time"
)
const (
refreshRateToRenderRateRatio = 0.8
refreshRateToRenderRateRatio = 0.6
)
type Handler struct {
layout *widgets.Layout
layout *component.Layout
renderTicker *time.Ticker
consoleEvents <-chan ui.Event
renderRate time.Duration
}
func NewHandler(layout *widgets.Layout) Handler {
func NewHandler(layout *component.Layout) Handler {
renderRate := calcMinRenderRate(layout)
return Handler{
layout: layout,
@ -58,13 +58,13 @@ func (h *Handler) HandleEvents() {
}
}
func (h *Handler) handleModeChange(m widgets.Mode) {
func (h *Handler) handleModeChange(m component.Mode) {
// render mode change before switching the tickers
// render change before switching the tickers
ui.Render(h.layout)
h.renderTicker.Stop()
if m == widgets.ModeDefault {
if m == component.ModeDefault {
h.renderTicker = time.NewTicker(h.renderRate)
} else {
h.renderTicker = time.NewTicker(console.MinRenderInterval)
@ -80,7 +80,7 @@ func (h *Handler) handleExit() {
config.Update(settings)
}
func calcMinRenderRate(layout *widgets.Layout) time.Duration {
func calcMinRenderRate(layout *component.Layout) time.Duration {
minRefreshRateMs := layout.Components[0].RefreshRateMs
for _, c := range layout.Components {

10
main.go
View File

@ -1,14 +1,14 @@
package main
import (
"github.com/sqshq/sampler/component"
"github.com/sqshq/sampler/component/asciibox"
"github.com/sqshq/sampler/component/barchart"
"github.com/sqshq/sampler/component/runchart"
"github.com/sqshq/sampler/config"
"github.com/sqshq/sampler/console"
"github.com/sqshq/sampler/data"
"github.com/sqshq/sampler/event"
"github.com/sqshq/sampler/widgets"
"github.com/sqshq/sampler/widgets/asciibox"
"github.com/sqshq/sampler/widgets/barchart"
"github.com/sqshq/sampler/widgets/runchart"
ui "github.com/sqshq/termui"
)
@ -20,7 +20,7 @@ func main() {
defer csl.Close()
width, height := ui.TerminalDimensions()
layout := widgets.NewLayout(width, height, widgets.NewMenu())
layout := component.NewLayout(width, height, component.NewMenu())
for _, c := range cfg.RunCharts {