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:
@@ -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", "|"),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -15,7 +15,6 @@ func testTextWidget() TextWidget {
|
||||
Name: "test widget",
|
||||
},
|
||||
},
|
||||
true,
|
||||
)
|
||||
return txtWid
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user