diff --git a/README.md b/README.md index b936b2f..a4b9033 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ sudo pip3 install unicornhathd ## Configuration ``` -TODO +cp chutney.sample.cfg chutney.cfg ``` ## Installation diff --git a/colors.py b/colors.py index 6bdb1bb..1304b15 100644 --- a/colors.py +++ b/colors.py @@ -1,4 +1,6 @@ -BLACK = [0, 0, 0 ] -RED = [255, 0, 0 ] -PINK = [255, 0, 64 ] -BLUE = [0, 64, 128] +BLACK = [0, 0, 0 ] +RED = [255, 0, 0 ] +PINK = [255, 0, 64 ] +GREEN = [0, 255, 0 ] +BLUE = [0, 64, 128] + diff --git a/time_display.py b/time_display.py index 1f939fd..979f715 100644 --- a/time_display.py +++ b/time_display.py @@ -11,7 +11,7 @@ class TimeDisplay: self.currentHour = [-1, -1] self.currentMinute = [-1, -1] self.currentColor = colors.BLACK - self.color = colors.PINK + self.color = colors.RED self.hourStartColumn = -1 self.timeDotsColumn = 7 self.minuteStartColumn = 9 diff --git a/weather_display.py b/weather_display.py index b2ae529..1e51dd9 100644 --- a/weather_display.py +++ b/weather_display.py @@ -1,13 +1,14 @@ import colors -import requests class WeatherDisplay: def __init__(self, characterDisplay, topRow): self.characterDisplay = characterDisplay self.topRow = topRow + self.twoDigitStartColumn = 9 + self.oneDigitStartColumn = 13 self.currentTemperature = [9, 9] - self.color = colors.BLUE + self.color = colors.GREEN self.weatherFile = 'weather.txt' def showWeather(self): @@ -33,8 +34,9 @@ class WeatherDisplay: if temperature != self.currentTemperature: self.characterDisplay.clearRow(self.topRow) - start = 13 if ( - len(temperature) == 2 and temperature[0] == '-') or len(temperature) == 1 else 9 + start = self.oneDigitStartColumn if ( + self.isOneDigit(temperature) + ) else self.twoDigitStartColumn for c in temperature: if c == '-': @@ -46,3 +48,6 @@ class WeatherDisplay: start = start + 4 self.currentTemperature = temperature + + def isOneDigit(self, temperature): + return (len(temperature) == 2 and temperature[0] == '-') or len(temperature) == 1