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

Add a global Redraw method for TextWidget

Partially addresses #429, by centralizing widget drawing
This commit is contained in:
Sean Smith
2019-05-07 20:49:46 -04:00
committed by Chris Cummer
parent aedcf9dd51
commit 018d2af3ae
48 changed files with 194 additions and 412 deletions

View File

@@ -8,13 +8,12 @@ import (
func (widget *Widget) display() {
repo := widget.currentGithubRepo()
title := fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.title(repo))
if repo == nil {
widget.View.SetText(" GitHub repo data is unavailable ")
widget.TextWidget.Redraw(title, " GitHub repo data is unavailable ", false)
return
}
widget.View.SetTitle(widget.ContextualTitle(fmt.Sprintf("%s - %s", widget.CommonSettings.Title, widget.title(repo))))
_, _, width, _ := widget.View.GetRect()
str := widget.settings.common.SigilStr(len(widget.GithubRepos), widget.Idx, width) + "\n"
str = str + " [red]Stats[white]\n"
@@ -26,7 +25,7 @@ func (widget *Widget) display() {
str = str + " [red]My Pull Requests[white]\n"
str = str + widget.displayMyPullRequests(repo, widget.settings.username)
widget.View.SetText(str)
widget.TextWidget.Redraw(title, str, false)
}
func (widget *Widget) displayMyPullRequests(repo *GithubRepo, username string) string {