Show degree character in temperature
This commit is contained in:
parent
11f3ed7679
commit
bbc7e505ae
|
@ -56,7 +56,7 @@ class CharacterDisplay:
|
||||||
|
|
||||||
self.unicorn.show()
|
self.unicorn.show()
|
||||||
|
|
||||||
def displayTimeDots(self, x, y, color,):
|
def displayTimeDots(self, x, y, color):
|
||||||
self.setPixel(x, y, colors.BLACK)
|
self.setPixel(x, y, colors.BLACK)
|
||||||
self.setPixel(x, y-1, color)
|
self.setPixel(x, y-1, color)
|
||||||
self.setPixel(x, y-2, colors.BLACK)
|
self.setPixel(x, y-2, colors.BLACK)
|
||||||
|
@ -64,6 +64,19 @@ class CharacterDisplay:
|
||||||
self.setPixel(x, y-4, colors.BLACK)
|
self.setPixel(x, y-4, colors.BLACK)
|
||||||
self.unicorn.show()
|
self.unicorn.show()
|
||||||
|
|
||||||
|
def displayDegree(self, x, y, color):
|
||||||
|
self.setPixel(x, y, color)
|
||||||
|
self.setPixel(x, y-1, color)
|
||||||
|
self.setPixel(x, y-2, colors.BLACK)
|
||||||
|
self.setPixel(x, y-3, colors.BLACK)
|
||||||
|
self.setPixel(x, y-4, colors.BLACK)
|
||||||
|
self.setPixel(x+1, y, color)
|
||||||
|
self.setPixel(x+1, y-1, color)
|
||||||
|
self.setPixel(x+1, y-2, colors.BLACK)
|
||||||
|
self.setPixel(x+1, y-3, colors.BLACK)
|
||||||
|
self.setPixel(x+1, y-4, colors.BLACK)
|
||||||
|
self.unicorn.show()
|
||||||
|
|
||||||
def displayNegative(self, x, y, color):
|
def displayNegative(self, x, y, color):
|
||||||
self.setPixel(x, y, colors.BLACK)
|
self.setPixel(x, y, colors.BLACK)
|
||||||
self.setPixel(x, y-1, colors.BLACK)
|
self.setPixel(x, y-1, colors.BLACK)
|
||||||
|
|
|
@ -11,7 +11,7 @@ class TimeDisplay:
|
||||||
self.currentHour = [-1, -1]
|
self.currentHour = [-1, -1]
|
||||||
self.currentMinute = [-1, -1]
|
self.currentMinute = [-1, -1]
|
||||||
self.currentColor = colors.BLACK
|
self.currentColor = colors.BLACK
|
||||||
self.color = colors.RED
|
self.color = colors.PINK
|
||||||
self.hourStartColumn = -1
|
self.hourStartColumn = -1
|
||||||
self.timeDotsColumn = 7
|
self.timeDotsColumn = 7
|
||||||
self.minuteStartColumn = 9
|
self.minuteStartColumn = 9
|
||||||
|
|
|
@ -5,11 +5,11 @@ class WeatherDisplay:
|
||||||
def __init__(self, characterDisplay, topRow):
|
def __init__(self, characterDisplay, topRow):
|
||||||
self.characterDisplay = characterDisplay
|
self.characterDisplay = characterDisplay
|
||||||
self.topRow = topRow
|
self.topRow = topRow
|
||||||
self.twoDigitStartColumn = 9
|
self.twoDigitStartColumn = 6
|
||||||
self.oneDigitStartColumn = 13
|
self.oneDigitStartColumn = 10
|
||||||
self.digitWidth = 4
|
self.digitWidth = 4
|
||||||
self.currentTemperature = ''
|
self.currentTemperature = ''
|
||||||
self.color = colors.PINK
|
self.color = colors.BLUE
|
||||||
self.weatherFile = 'weather.txt'
|
self.weatherFile = 'weather.txt'
|
||||||
|
|
||||||
def showWeather(self):
|
def showWeather(self):
|
||||||
|
@ -52,6 +52,12 @@ class WeatherDisplay:
|
||||||
)
|
)
|
||||||
start = start + self.digitWidth
|
start = start + self.digitWidth
|
||||||
|
|
||||||
|
self.characterDisplay.displayDegree(
|
||||||
|
x=start,
|
||||||
|
y=self.topRow,
|
||||||
|
color=self.color
|
||||||
|
)
|
||||||
|
|
||||||
def getStartColumn(self, temperature):
|
def getStartColumn(self, temperature):
|
||||||
return self.oneDigitStartColumn if (self.isOneDigit(temperature)) else self.twoDigitStartColumn
|
return self.oneDigitStartColumn if (self.isOneDigit(temperature)) else self.twoDigitStartColumn
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue