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

Merge branch 'master' into scrollable-hackernews

This commit is contained in:
Chris Cummer 2018-08-07 20:34:40 -04:00 committed by GitHub
commit fd6f168c93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 25 deletions

View File

@ -47,6 +47,24 @@ var (
) )
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget { func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
widget := Widget{
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
TextWidget: wtf.NewTextWidget("Gerrit", "gerrit", true),
Idx: 0,
}
widget.HelpfulWidget.SetView(widget.View)
widget.View.SetInputCapture(widget.keyboardIntercept)
widget.unselect()
return &widget
}
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
baseURL := wtf.Config.UString("wtf.mods.gerrit.domain") baseURL := wtf.Config.UString("wtf.mods.gerrit.domain")
username := wtf.Config.UString("wtf.mods.gerrit.username") username := wtf.Config.UString("wtf.mods.gerrit.username")
@ -72,34 +90,16 @@ func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
gerritUrl = fmt.Sprintf( gerritUrl = fmt.Sprintf(
"%s://%s:%s@%s", submatch[1], username, password, submatch[2]) "%s://%s:%s@%s", submatch[1], username, password, submatch[2])
} }
gerrit, err := glb.NewClient(gerritUrl, httpClient) gerrit, err := glb.NewClient(gerritUrl, httpClient)
if err != nil { if err != nil {
panic(err) widget.View.SetWrap(true)
widget.View.SetTitle(widget.Name)
widget.View.SetText(err.Error())
return
} }
widget.gerrit = gerrit
widget := Widget{
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
TextWidget: wtf.NewTextWidget("Gerrit", "gerrit", true),
gerrit: gerrit,
Idx: 0,
}
widget.HelpfulWidget.SetView(widget.View)
widget.GerritProjects = widget.buildProjectCollection(wtf.Config.UList("wtf.mods.gerrit.projects")) widget.GerritProjects = widget.buildProjectCollection(wtf.Config.UList("wtf.mods.gerrit.projects"))
widget.View.SetInputCapture(widget.keyboardIntercept)
widget.unselect()
return &widget
}
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
for _, project := range widget.GerritProjects { for _, project := range widget.GerritProjects {
project.Refresh() project.Refresh()
} }

View File

@ -121,8 +121,8 @@ func DefaultFocussedRowColor() string {
} }
func RowColor(module string, idx int) string { func RowColor(module string, idx int) string {
evenKey := fmt.Sprintf("wtf.mods.%s.colors.row.even", module) evenKey := fmt.Sprintf("wtf.mods.%s.colors.rows.even", module)
oddKey := fmt.Sprintf("wtf.mods.%s.colors.row.odd", module) oddKey := fmt.Sprintf("wtf.mods.%s.colors.rows.odd", module)
if idx%2 == 0 { if idx%2 == 0 {
return Config.UString(evenKey, "white") return Config.UString(evenKey, "white")