chutney/chutney.py

49 lines
983 B
Python
Raw Normal View History

import sys
from character_display import CharacterDisplay
from signal import signal, SIGTERM
from time import sleep
from time_display import TimeDisplay
2022-12-24 10:59:04 -05:00
from weather_display import WeatherDisplay
try:
import unicornhathd as unicorn
unicorn.rotation(90)
except ImportError:
from unicorn_hat_sim import unicornhathd as unicorn
unicorn.rotation(180)
def cleanExit(unicorn):
def _exit_(signum, frame):
unicorn.off()
sys.exit(0)
return _exit_
def main():
signal(SIGTERM, cleanExit(unicorn))
unicorn.brightness(0.3)
2022-12-23 14:57:33 -05:00
characterDisplay = CharacterDisplay(unicorn)
timeDisplay = TimeDisplay(characterDisplay, topRow=15)
2022-12-24 10:59:04 -05:00
weatherDisplay = WeatherDisplay(characterDisplay, topRow=9, configFile='chutney.cfg')
x = 0
while True:
timeDisplay.showTime()
2022-12-24 10:59:04 -05:00
if (x == 0):
weatherDisplay.showWeather()
x = x + 1
x = x % 120
sleep(1)
if __name__ == '__main__':
main()