diff options
author | Mattias Andrée <maandree@kth.se> | 2017-03-21 15:50:09 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2017-03-21 15:50:12 +0100 |
commit | e3fe0f1c7fecb233f900628a8b1fd0287729d37a (patch) | |
tree | 9e244b7e82227294a7587a88956bfdffb22a4edd | |
parent | Improve lid plugin (diff) | |
download | xpybar-e3fe0f1c7fecb233f900628a8b1fd0287729d37a.tar.gz xpybar-e3fe0f1c7fecb233f900628a8b1fd0287729d37a.tar.bz2 xpybar-e3fe0f1c7fecb233f900628a8b1fd0287729d37a.tar.xz |
Fix wind gusts
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r-- | examples/compact | 10 | ||||
-rw-r--r-- | src/plugins/weather.py | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/examples/compact b/examples/compact index d751adf..8f4df79 100644 --- a/examples/compact +++ b/examples/compact @@ -753,7 +753,7 @@ class MyWeather(Entry): self.in_deg_f = button == SCROLL_UP elif index == 2: # wind speed/gusts if button == LEFT_BUTTON: - if self.plusminus is None or col < self.plusminus: + if self.towards is None or col < self.towards: self.show_wind_speed = False else: self.show_wind_gusts = False @@ -909,7 +909,7 @@ class MyWeather(Entry): if beaufort >= 7: colour = '33' if beaufort >= 10: colour = '31' if beaufort >= 12: colour = '39;41' - wind += '±\033[%sm%.0f\033[0m' % (colour, value) + wind += '→\033[%sm%.0f\033[0m' % (colour, value) wind += unit text.append(wind) else: @@ -1045,13 +1045,13 @@ class MyWeather(Entry): else: segments.append(None) x -= 1 - self.plusminus = None + self.towards = None for i, segment in enumerate(text): if segment is None: segments.append(None) else: - if i == 1 and '±' in segment: - self.plusminus = x + Bar.coloured_length(segment.split('±')[0]) + if i == 1 and '→' in segment: + self.towards = x + Bar.coloured_length(segment.split('→')[0]) w = Bar.coloured_length(segment) x += 1 segments.append((x, w)) diff --git a/src/plugins/weather.py b/src/plugins/weather.py index cb0d8ae..61e1202 100644 --- a/src/plugins/weather.py +++ b/src/plugins/weather.py @@ -38,7 +38,7 @@ class Weather: @variable wind_dir:float? The wind direction, `None` if variable @variable wind_speed:float The wind speed in knots - @variable wind_gusts:float? The wind gusts (variability of the wind speed) in knots + @variable wind_gusts:float? The wind gusts (variability of the wind speed; towards) in knots @variable wind_var:(float, float)? The wind direction range, `None` if less than 60° variation @variable temp:float The temperature in °C @variable dew:float The dew point in °C @@ -80,13 +80,13 @@ class Weather: self.station, station_header = station_header[0], ', '.join(station_header[1:]) self.location = station_header.split(' (')[0] self.latitude, self.longitude = station_header.split(') ')[1].split(' ')[:2] - self.latitude, ysign = self.latitude[:-1], self.latitude[-1] == 'S' + self.latitude, ysign = self.latitude[:-1], self.latitude[-1] == 'S' self.longitude, xsign = self.longitude[:-1], self.longitude[-1] == 'W' - self.latitude = [float(x) for x in self.latitude.split('-')] - self.longitude = [float(x) for x in self.longitude.split('-')] - self.latitude = self.latitude[0] + self.latitude[1] / 100 + self.latitude = [float(x) for x in self.latitude.split('-')] + self.longitude = [float(x) for x in self.longitude.split('-')] + self.latitude = self.latitude[0] + self.latitude[1] / 100 self.longitude = self.longitude[0] + self.longitude[1] / 100 - self.latitude = -(self.latitude) if ysign else self.latitude + self.latitude = -(self.latitude) if ysign else self.latitude self.longitude = -(self.longitude) if xsign else self.longitude self.fields = {} |