From b2e20763d9af56bd5f16ea381061a512199ba43f Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Mon, 26 Dec 2022 09:22:28 -0500 Subject: [PATCH] Clean up code --- .gitignore | 1 + weather_display.py | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 0e5b2d9..18b6291 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ __pycache__/ *.swp +*.tmp chutney.cfg weather.txt diff --git a/weather_display.py b/weather_display.py index 8c405e2..7039d35 100644 --- a/weather_display.py +++ b/weather_display.py @@ -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