weather

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HelpText = `` /* 214-byte string literal not displayed */

Variables

View Source
var Config *config.Config

Config is a pointer to the global config object.

Functions

This section is empty.

Types

type Widget

type Widget struct {
	wtf.TextWidget

	APIKey string
	Data   []*owm.CurrentWeatherData
	Idx    int
	// contains filtered or unexported fields
}

Widget is the container for weather data.

func NewWidget

func NewWidget(app *tview.Application, pages *tview.Pages) *Widget

NewWidget creates and returns a new instance of the weather Widget.

func (*Widget) Fetch

func (widget *Widget) Fetch(cityIDs []int) []*owm.CurrentWeatherData

Fetch retrieves OpenWeatherMap data from the OpenWeatherMap API. It takes a list of OpenWeatherMap city IDs. It returns a list of OpenWeatherMap CurrentWeatherData structs, one per valid city code.

func (*Widget) Next

func (widget *Widget) Next()

Next displays data for the next city data in the list. If the current city is the last city, it wraps to the first city.

func (*Widget) Prev

func (widget *Widget) Prev()

Prev displays data for the previous city in the list. If the previous city is the first city, it wraps to the last city.

func (*Widget) Refresh

func (widget *Widget) Refresh()

Refresh fetches new data from the OpenWeatherMap API and loads the new data into the. widget's view for rendering

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL