GWeather.Info¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w |
An unique reverse-DNS application ID |
||
r/w |
An email address or contact form URL |
||
r/w |
A bitmask of enabled weather service providers |
||
r/w/c |
The location this info represents |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
This signal is emitted after the initial fetch of the weather data from upstream services, and after every successful call to [method`GWeather`.Info.update]. |
Fields¶
- Inherited:
Class Details¶
- class GWeather.Info(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GWeatherInfoprovides a handy way to access weather conditions and forecasts from a [class`GWeather`.Location], aggregating multiple different web services.It includes also astronomical data such as sunrise times and moon phases.
- classmethod new(location)¶
- Parameters:
location (
GWeather.LocationorNone) – the desidered location- Returns:
a new weather information instance
- Return type:
Builds a new
GWeatherInfothat will provide weather information about the given location.In order to retrieve the weather information, you will need to enable the desired providers and then call [method`GWeather`.Info.update]. If you want to be notified of the completion of the weather information update, you should connect to the [signal`GWeather`.Info::updated] signal before updating the
GWeatherInfoinstance.
- classmethod store_cache()¶
Ensures that any data cached from the network is stored to disk. Calling this is not necessary, as the cache will be saved when the last reference to a
GWeather.Infowill be dropped. On the other hand, it must be called if there is any chance that the application will be closed without unreffing all objects, such as when using a language binding that employs a GC.
- abort()¶
- get_application_id()¶
- Returns:
the application ID
- Return type:
Get the application ID of the application fetching the weather.
- get_attribution()¶
- Returns:
the required attribution text, in Pango markup form, or
Noneif not required- Return type:
Some weather services require the application showing the data to include an attribution text, possibly including links to the service website. This must be shown prominently toghether with the data.
- get_contact_info()¶
- Returns:
the contact information
- Return type:
Get the contact information of the application fetching the weather.
- get_enabled_providers()¶
- Return type:
Gets the bitmask of enabled
GWeather.Providerweather providers.
- get_forecast_list()¶
- Returns:
list of
GWeather.Infoobjects for the forecast. The list is owned by the ‘info’ object thus is alive as long as the ‘info’. The ‘update’ property is the date/time when the forecast info is used for.- Return type:
- get_location()¶
- Return type:
- get_value_apparent(unit)¶
- Parameters:
unit (
GWeather.TemperatureUnit) – the desired unit, as aGWeather.TemperatureUnit- Returns:
Trueis value is valid,Falseotherwise.- value:
the apparent temperature
- Return type:
- get_value_conditions()¶
- Returns:
Trueis out arguments are valid,Falseotherwise.- phenomenon:
a location for a
GWeather.ConditionPhenomenon.- qualifier:
a location for a
GWeather.ConditionQualifier.
- Return type:
(
bool, phenomenon:GWeather.ConditionPhenomenon, qualifier:GWeather.ConditionQualifier)
Fills out phenomenon and qualifier with current weather conditions.
- get_value_dew(unit)¶
- Parameters:
unit (
GWeather.TemperatureUnit) – the desired unit, as aGWeather.TemperatureUnit- Returns:
Trueis value is valid,Falseotherwise.- value:
the dew point
- Return type:
- get_value_moonphase()¶
- get_value_pressure(unit)¶
- Parameters:
unit (
GWeather.PressureUnit) – the desired unit, as aGWeather.PressureUnit- Returns:
Trueif value is valid,Falseotherwise.- value:
forecasted pressure, expressed in unit
- Return type:
- get_value_sky()¶
- Returns:
Trueis sky is valid,Falseotherwise.- sky:
a location for a
GWeather.Sky.
- Return type:
(
bool, sky:GWeather.Sky)
Fills out sky with current sky conditions.
- get_value_sunrise()¶
- get_value_sunset()¶
- get_value_temp(unit)¶
- Parameters:
unit (
GWeather.TemperatureUnit) – the desired unit, as aGWeather.TemperatureUnit- Returns:
Trueis value is valid,Falseotherwise.- value:
the temperature value
- Return type:
- get_value_temp_max(unit)¶
- Parameters:
unit (
GWeather.TemperatureUnit) – the desired unit, as aGWeather.TemperatureUnit- Returns:
Trueis value is valid,Falseotherwise.- value:
the maximum temperature value
- Return type:
- get_value_temp_min(unit)¶
- Parameters:
unit (
GWeather.TemperatureUnit) – the desired unit, as aGWeather.TemperatureUnit- Returns:
Trueis value is valid,Falseotherwise.- value:
the minimum temperature value
- Return type:
- get_value_update()¶
- Returns:
Trueis value is valid,Falseotherwise.- value:
the time self was last updated
- Return type:
Note that value may be 0 if self has not yet been updated.
- get_value_visibility(unit)¶
- Parameters:
unit (
GWeather.DistanceUnit) – the desired unit, as aGWeather.DistanceUnit- Returns:
Trueif value is valid,Falseotherwise.- value:
forecasted visibility, expressed in unit
- Return type:
- get_value_wind(unit)¶
- Parameters:
unit (
GWeather.SpeedUnit) – the desired unit, as aGWeather.SpeedUnit- Returns:
Trueif speed and direction are valid,Falseotherwise.- speed:
forecasted wind speed
- direction:
forecasted wind direction
- Return type:
(
bool, speed:float, direction:GWeather.WindDirection)
- is_daytime()¶
- Returns:
Whether it is daytime (that is, if the sun is visible) or not at the location and the point of time referred by self. This is mostly equivalent to comparing the return value of
GWeather.Info.get_value_sunrise() andGWeather.Info.get_value_sunset(), but it accounts also for midnight sun and polar night, for locations within the Artic and Antartic circles.- Return type:
- set_application_id(application_id)¶
- Parameters:
application_id (
str) – the application ID to set
Sets the application ID of the application fetching the weather. It is a requirement for using any of the online weather providers.
If the application uses
Gio.Application, then the application ID will be automatically filled in.
- set_contact_info(contact_info)¶
- Parameters:
contact_info (
str) – the contact information for the application
Sets the contact information for the application fetching the weather. It is a requirement for using any of the online weather providers as it allows API providers to contact application developers in case of terms of use breaches.
The contact information should be an email address, or the full URL to an online contact form which weather providers can use to contact the application developer. Avoid using bug tracker URLs which require creating accounts.
- set_enabled_providers(providers)¶
- Parameters:
providers (
GWeather.Provider) – a bitmask ofGWeather.Provider
Sets the enabled providers for fetching the weather. Note that it is up to the application developer to make sure that the terms of use for each service are respected.
Online providers will not be enabled if the application ID is not set to a valid value.
- set_location(location)¶
- Parameters:
location (
GWeather.LocationorNone) – a location for which weather is desired
Changes the location of the weather report.
Note that this will clear any forecast or current conditions, and you must call [method`GWeather`.Info.update] to obtain the new data.
- update()¶
Requests a reload of weather conditions and forecast data from enabled network services. This call does no synchronous IO: rather, the result is delivered by emitting the
GWeather.Info::updatedsignal. Note that if no network services are enabled, the signal will not be emitted. SeeGWeather.Info:enabled-providersfor details.
Signal Details¶
- GWeather.Info.signals.updated(info)¶
- Signal Name:
updated- Flags:
- Parameters:
info (
GWeather.Info) – The object which received the signal
This signal is emitted after the initial fetch of the weather data from upstream services, and after every successful call to [method`GWeather`.Info.update].
Property Details¶
- GWeather.Info.props.application_id¶
-
A unique identifier, typically in the form of reverse DNS notation, for the application that is querying the weather information.
Weather providers require this information.
- GWeather.Info.props.contact_info¶
-
An email address or any other contact form URL.
Weather providers require this information.
- GWeather.Info.props.enabled_providers¶
- Name:
enabled-providers- Type:
- Default Value:
- Flags:
The enabled weather providers.