Clean up code
This commit is contained in:
parent
73fda1111c
commit
b2e20763d9
|
@ -1,4 +1,5 @@
|
|||
__pycache__/
|
||||
*.swp
|
||||
*.tmp
|
||||
chutney.cfg
|
||||
weather.txt
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue