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
@@ -4,9 +4,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell"
|
||||
"github.com/olebedev/config"
|
||||
"github.com/rivo/tview"
|
||||
"github.com/senorprogrammer/wtf/wtf"
|
||||
)
|
||||
|
||||
@@ -21,8 +19,6 @@ func NewWidget() *Widget {
|
||||
TextWidget: wtf.NewTextWidget(" 👽 BambooHR ", "bamboohr"),
|
||||
}
|
||||
|
||||
widget.addView()
|
||||
|
||||
return &widget
|
||||
}
|
||||
|
||||
@@ -52,18 +48,6 @@ func (widget *Widget) Refresh() {
|
||||
|
||||
/* -------------------- Unexported Functions -------------------- */
|
||||
|
||||
func (widget *Widget) addView() {
|
||||
view := tview.NewTextView()
|
||||
|
||||
view.SetBorder(true)
|
||||
view.SetBorderColor(tcell.ColorGray)
|
||||
view.SetDynamicColors(true)
|
||||
view.SetTitle(widget.Name)
|
||||
view.SetWrap(false)
|
||||
|
||||
widget.View = view
|
||||
}
|
||||
|
||||
func (widget *Widget) contentFrom(items []Item) string {
|
||||
if len(items) == 0 {
|
||||
return fmt.Sprintf("\n\n\n\n\n\n\n\n%s", wtf.CenterText("[grey]no one[white]", 50))
|
||||
|
||||
Reference in New Issue
Block a user