From c8afaf8ceac697dea3bd6f6a27efdc3366e600f7 Mon Sep 17 00:00:00 2001 From: joan Date: Sat, 21 Mar 2015 09:44:02 -0500 Subject: [PATCH] Zero turbulence when we disable-it. Don't update metar if downloads are disabled. --- PI_noaaWeather.py | 6 +++++- noaweather/conf.py | 2 +- noaweather/metar.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/PI_noaaWeather.py b/PI_noaaWeather.py index d080a8a..8e2b4d7 100644 --- a/PI_noaaWeather.py +++ b/PI_noaaWeather.py @@ -221,12 +221,12 @@ def setWinds(self, winds, elapsed): extra['dew'] = self.weatherData['metar']['temperature'][1] + 273.15 # remove first wind layer if is too close (for high altitude airports) + # TODO: This can break transitions in some cases. if len(winds) > 1 and winds[0][0] < alt+ self.conf.metar_agl_limit: winds.pop(0) winds = [[alt, hdg, speed, extra]] + winds - # Search current top and bottom layer: blayer = False nlayers = len(winds) @@ -761,7 +761,11 @@ def aboutWindowHandler(self, inMessage, inWidget, inParam1, inParam2): self.conf.set_clouds = XPGetWidgetProperty(self.cloudsCheck, xpProperty_ButtonState, None) self.conf.set_temp = XPGetWidgetProperty(self.tempCheck, xpProperty_ButtonState, None) self.conf.set_pressure = XPGetWidgetProperty(self.pressureCheck, xpProperty_ButtonState, None) + + # Zero turbulence data if disabled self.conf.set_turb = XPGetWidgetProperty(self.turbCheck, xpProperty_ButtonState, None) + if not self.conf.set_turb: + for i in range(3): self.weather.winds[i]['turbulence'].value = 0 self.conf.download = XPGetWidgetProperty(self.downloadCheck, xpProperty_ButtonState, None) diff --git a/noaweather/conf.py b/noaweather/conf.py index 590bece..33d4995 100644 --- a/noaweather/conf.py +++ b/noaweather/conf.py @@ -18,7 +18,7 @@ class Conf: Configuration variables ''' syspath, dirsep = '', os.sep - __VERSION__ = '2.0rc5' + __VERSION__ = '2.0' def __init__(self, syspath): # Inits conf diff --git a/noaweather/metar.py b/noaweather/metar.py index adbee48..f2cd0ed 100644 --- a/noaweather/metar.py +++ b/noaweather/metar.py @@ -351,7 +351,7 @@ def run(self, lat, lon, rate): # No file downloaded pass - else: + elif self.conf.download: # Download new data if required cycle, timestamp = self.getCycle() if (timestamp - self.last_timestamp) > self.UPDATE_RATE * 60: