Clean up code

This commit is contained in:
Mike Cifelli 2022-12-26 09:22:28 -05:00
parent 73fda1111c
commit b2e20763d9
2 changed files with 5 additions and 4 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
__pycache__/
*.swp
*.tmp
chutney.cfg
weather.txt

View File

@ -7,21 +7,21 @@ class WeatherDisplay:
self.topRow = topRow
self.twoDigitStartColumn = 9
self.oneDigitStartColumn = 13
self.digitWidth = 4
self.currentTemperature = ''
self.color = colors.GREEN
self.color = colors.BLUE
self.weatherFile = 'weather.txt'
def showWeather(self):
temperature = self.getTemperature()
if temperature != self.currentTemperature:
self.currentTemperature = temperature
self.characterDisplay.clearRow(self.topRow)
if self.isTemperatureValid(temperature):
self.showTemperature(list(temperature))
self.currentTemperature = temperature
def getTemperature(self):
try:
with open(self.weatherFile) as file:
@ -50,7 +50,7 @@ class WeatherDisplay:
digit=c,
color=self.color
)
start = start + 4
start = start + self.digitWidth
def getStartColumn(self, temperature):
return self.oneDigitStartColumn if (self.isOneDigit(temperature)) else self.twoDigitStartColumn