mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Removed a bunch of common boilerplate code from widget initialization
This commit is contained in:
committed by
Chris Cummer
parent
d812986abc
commit
693a04b5e1
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/color"
|
||||
)
|
||||
|
||||
var Config *config.Config
|
||||
@@ -34,9 +35,23 @@ func NewTextWidget(name string, configKey string) TextWidget {
|
||||
},
|
||||
}
|
||||
|
||||
widget.addView()
|
||||
|
||||
return widget
|
||||
}
|
||||
|
||||
func (widget *TextWidget) addView() {
|
||||
view := tview.NewTextView()
|
||||
|
||||
view.SetBorder(true)
|
||||
view.SetBorderColor(color.ColorFor(Config.UString("wtf.border.normal")))
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTitle(widget.Name)
|
||||
view.SetWrap(false)
|
||||
|
||||
widget.View = view
|
||||
}
|
||||
|
||||
/* -------------------- Exported Functions -------------------- */
|
||||
|
||||
func (widget *TextWidget) Disabled() bool {
|
||||
|
||||
Reference in New Issue
Block a user