1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Constantize the defaultFocus value for each module

This commit is contained in:
Chris Cummer
2019-09-18 20:34:53 -07:00
parent d6208b4730
commit bf877f5fa7
120 changed files with 421 additions and 255 deletions

View File

@@ -28,9 +28,9 @@ type Bar struct {
}
// NewBarGraph creates and returns an instance of BarGraph
func NewBarGraph(app *tview.Application, name string, commonSettings *cfg.Common, focusable bool) BarGraph {
func NewBarGraph(app *tview.Application, name string, commonSettings *cfg.Common) BarGraph {
widget := BarGraph{
Base: NewBase(app, commonSettings, focusable),
Base: NewBase(app, commonSettings),
maxStars: commonSettings.Config.UInt("graphStars", 20),
starChar: commonSettings.Config.UString("graphIcon", "|"),

View File

@@ -23,16 +23,14 @@ type Base struct {
enabledMutex *sync.Mutex
}
func NewBase(app *tview.Application, commonSettings *cfg.Common, defaultFocusable bool) Base {
focusable := commonSettings.Focusable || defaultFocusable
func NewBase(app *tview.Application, commonSettings *cfg.Common) Base {
base := Base{
commonSettings: commonSettings,
app: app,
bordered: commonSettings.Bordered,
enabled: commonSettings.Enabled,
focusChar: commonSettings.FocusChar(),
focusable: focusable,
focusable: commonSettings.Focusable,
name: commonSettings.Name,
quitChan: make(chan bool),
refreshInterval: commonSettings.RefreshInterval,

View File

@@ -15,9 +15,9 @@ type ScrollableWidget struct {
RenderFunction func()
}
func NewScrollableWidget(app *tview.Application, commonSettings *cfg.Common, focusable bool) ScrollableWidget {
func NewScrollableWidget(app *tview.Application, commonSettings *cfg.Common) ScrollableWidget {
widget := ScrollableWidget{
TextWidget: NewTextWidget(app, commonSettings, focusable),
TextWidget: NewTextWidget(app, commonSettings),
}
widget.Unselect()

View File

@@ -13,9 +13,9 @@ type TextWidget struct {
}
// NewTextWidget creates and returns an instance of TextWidget
func NewTextWidget(app *tview.Application, commonSettings *cfg.Common, defaultFocusable bool) TextWidget {
func NewTextWidget(app *tview.Application, commonSettings *cfg.Common) TextWidget {
widget := TextWidget{
Base: NewBase(app, commonSettings, defaultFocusable),
Base: NewBase(app, commonSettings),
}
widget.View = widget.createView(widget.bordered)

View File

@@ -15,7 +15,6 @@ func testTextWidget() TextWidget {
Name: "test widget",
},
},
true,
)
return txtWid
}