mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Rename TextViewer to Wtfable
This commit is contained in:
parent
b4520f1410
commit
d246cb4c4a
8
wtf.go
8
wtf.go
@ -55,7 +55,7 @@ func displayVersionInfo() {
|
|||||||
|
|
||||||
/* -------------------- Functions -------------------- */
|
/* -------------------- Functions -------------------- */
|
||||||
|
|
||||||
func addToGrid(grid *tview.Grid, widget wtf.TextViewer) {
|
func addToGrid(grid *tview.Grid, widget wtf.Wtfable) {
|
||||||
if widget.Disabled() {
|
if widget.Disabled() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func addToGrid(grid *tview.Grid, widget wtf.TextViewer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grid stores all the widgets onscreen (like an HTML table)
|
// Grid stores all the widgets onscreen (like an HTML table)
|
||||||
func buildGrid(modules []wtf.TextViewer) *tview.Grid {
|
func buildGrid(modules []wtf.Wtfable) *tview.Grid {
|
||||||
grid := tview.NewGrid()
|
grid := tview.NewGrid()
|
||||||
grid.SetColumns(wtf.ToInts(Config.UList("wtf.grid.columns"))...)
|
grid.SetColumns(wtf.ToInts(Config.UList("wtf.grid.columns"))...)
|
||||||
grid.SetRows(wtf.ToInts(Config.UList("wtf.grid.rows"))...)
|
grid.SetRows(wtf.ToInts(Config.UList("wtf.grid.rows"))...)
|
||||||
@ -133,7 +133,7 @@ func refreshAllModules() {
|
|||||||
|
|
||||||
var Config *config.Config
|
var Config *config.Config
|
||||||
var FocusTracker wtf.FocusTracker
|
var FocusTracker wtf.FocusTracker
|
||||||
var Widgets []wtf.TextViewer
|
var Widgets []wtf.Wtfable
|
||||||
|
|
||||||
var result = wtf.CreateConfigDir()
|
var result = wtf.CreateConfigDir()
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ func main() {
|
|||||||
weather.Config = Config
|
weather.Config = Config
|
||||||
wtf.Config = Config
|
wtf.Config = Config
|
||||||
|
|
||||||
Widgets = []wtf.TextViewer{
|
Widgets = []wtf.Wtfable{
|
||||||
bamboohr.NewWidget(),
|
bamboohr.NewWidget(),
|
||||||
clocks.NewWidget(),
|
clocks.NewWidget(),
|
||||||
gcal.NewWidget(),
|
gcal.NewWidget(),
|
||||||
|
@ -17,7 +17,7 @@ const (
|
|||||||
type FocusTracker struct {
|
type FocusTracker struct {
|
||||||
App *tview.Application
|
App *tview.Application
|
||||||
Idx int
|
Idx int
|
||||||
Widgets []TextViewer
|
Widgets []Wtfable
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -------------------- Exported Functions -------------------- */
|
/* -------------------- Exported Functions -------------------- */
|
||||||
@ -89,8 +89,8 @@ func (tracker *FocusTracker) focus(idx int) {
|
|||||||
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.focused", "gray")))
|
view.SetBorderColor(ColorFor(Config.UString("wtf.colors.border.focused", "gray")))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tracker *FocusTracker) focusables() []TextViewer {
|
func (tracker *FocusTracker) focusables() []Wtfable {
|
||||||
focusable := []TextViewer{}
|
focusable := []Wtfable{}
|
||||||
|
|
||||||
for _, widget := range tracker.Widgets {
|
for _, widget := range tracker.Widgets {
|
||||||
if widget.Focusable() {
|
if widget.Focusable() {
|
||||||
@ -101,7 +101,7 @@ func (tracker *FocusTracker) focusables() []TextViewer {
|
|||||||
return focusable
|
return focusable
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tracker *FocusTracker) focusableAt(idx int) TextViewer {
|
func (tracker *FocusTracker) focusableAt(idx int) Wtfable {
|
||||||
if idx < 0 || idx >= len(tracker.focusables()) {
|
if idx < 0 || idx >= len(tracker.focusables()) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,7 @@ import (
|
|||||||
"github.com/rivo/tview"
|
"github.com/rivo/tview"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: I really need to come up with a better name for this now
|
type Wtfable interface {
|
||||||
type TextViewer interface {
|
|
||||||
Enabler
|
Enabler
|
||||||
Scheduler
|
Scheduler
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user