mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Simplify the inclusion of the Common config settings into each module
Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
@@ -15,8 +15,8 @@ func (widget *Widget) display() {
|
||||
func (widget *Widget) content() (string, string, bool) {
|
||||
str := ""
|
||||
newList := checklist.NewChecklist(
|
||||
widget.settings.common.Sigils.Checkbox.Checked,
|
||||
widget.settings.common.Sigils.Checkbox.Unchecked,
|
||||
widget.settings.Sigils.Checkbox.Checked,
|
||||
widget.settings.Sigils.Checkbox.Unchecked,
|
||||
)
|
||||
|
||||
offset := 0
|
||||
@@ -45,7 +45,7 @@ func (widget *Widget) formattedItemLine(idx int, currItem *checklist.ChecklistIt
|
||||
rowColor := widget.RowColor(idx)
|
||||
|
||||
if currItem.Checked {
|
||||
rowColor = widget.settings.common.Colors.CheckboxTheme.Checked
|
||||
rowColor = widget.settings.Colors.CheckboxTheme.Checked
|
||||
}
|
||||
|
||||
if widget.View.HasFocus() && (currItem == selectedItem) {
|
||||
|
||||
@@ -12,7 +12,7 @@ const (
|
||||
|
||||
// Settings defines the configuration properties for this module
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
*cfg.Common
|
||||
|
||||
filePath string
|
||||
checked string
|
||||
@@ -24,7 +24,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
|
||||
common := cfg.NewCommonSettingsFromModule(name, defaultTitle, defaultFocusable, ymlConfig, globalConfig)
|
||||
|
||||
settings := Settings{
|
||||
common: common,
|
||||
Common: common,
|
||||
|
||||
filePath: ymlConfig.UString("filename"),
|
||||
checked: ymlConfig.UString("checkedIcon", common.Checkbox.Checked),
|
||||
|
||||
@@ -34,12 +34,12 @@ type Widget struct {
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
widget := Widget{
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.common),
|
||||
ScrollableWidget: view.NewScrollableWidget(app, pages, settings.Common),
|
||||
|
||||
app: app,
|
||||
settings: settings,
|
||||
filePath: settings.filePath,
|
||||
list: checklist.NewChecklist(settings.common.Sigils.Checkbox.Checked, settings.common.Sigils.Checkbox.Unchecked),
|
||||
list: checklist.NewChecklist(settings.Sigils.Checkbox.Checked, settings.Sigils.Checkbox.Unchecked),
|
||||
pages: pages,
|
||||
}
|
||||
|
||||
@@ -219,8 +219,8 @@ func (widget *Widget) modalFocus(form *tview.Form) {
|
||||
}
|
||||
|
||||
func (widget *Widget) modalForm(lbl, text string) *tview.Form {
|
||||
form := tview.NewForm().SetFieldBackgroundColor(wtf.ColorFor(widget.settings.common.Colors.Background))
|
||||
form.SetButtonsAlign(tview.AlignCenter).SetButtonTextColor(wtf.ColorFor(widget.settings.common.Colors.Text))
|
||||
form := tview.NewForm().SetFieldBackgroundColor(wtf.ColorFor(widget.settings.Colors.Background))
|
||||
form.SetButtonsAlign(tview.AlignCenter).SetButtonTextColor(wtf.ColorFor(widget.settings.Colors.Text))
|
||||
|
||||
form.AddInputField(lbl, text, 60, nil, nil)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user