E-Paper-Calendar/Calendar/DebugConsole.py

66 lines
2.6 KiB
Python
Raw Normal View History

from DebugInterface import DebugInterface
from Assets import weathericons
2019-04-11 07:59:58 +02:00
from datetime import datetime
import traceback
2019-07-13 08:05:35 +02:00
class DebugConsole (DebugInterface):
"""Defines concrete console export of debug objects"""
2019-07-13 08:05:35 +02:00
def print_event(self, event):
print("\nCalendarEvent:")
print("---------------------")
print('Begin datetime: ' + str(event.begin_datetime))
print('End datetime: ' + str(event.end_datetime))
2019-04-02 14:36:17 +02:00
print('Duration: ' + str(event.duration))
print('All day: ' + str(event.allday))
2019-04-11 07:59:58 +02:00
print('Multi-day: ' + str(event.multiday))
2019-04-02 14:36:17 +02:00
print('RRULE: ' + str(event.rrule))
print('Title: ' + str(event.title))
print('Description: ' + str(event.description))
print('Attendees: ' + str(event.attendees))
print('Highlight: ' + str(event.highlight))
print('Calendar name: ' + str(event.calendar_name))
print('Location: ' + str(event.location))
print('Fetch datetime: ' + str(event.fetch_datetime))
2019-07-13 08:05:35 +02:00
def print_forecast(self, forecast):
print("\nWeatherForecast:")
print("---------------------")
print('Air temperature: ' + str(forecast.air_temperature))
print('Air humidity: ' + str(forecast.air_humidity))
print('Air pressure: ' + str(forecast.air_pressure))
print('Rain probability: ' + str(forecast.rain_probability))
print('Rain amount: ' + str(forecast.rain_amount))
print('Snow amount: ' + str(forecast.snow_amount))
print('Sunrise-time: ' + str(forecast.sunrise))
print('Sunset time: ' + str(forecast.sunset))
print('Moon phase: ' + str(forecast.moon_phase))
print('Wind speed: ' + str(forecast.wind_speed))
print('Cloudiness: ' + str(forecast.clouds))
print('Icon code: ' + str(forecast.icon))
print('weather-icon name: ' + str(weathericons[forecast.icon]))
print('Short description: ' + str(forecast.short_description))
print('Detailed description: ' + str(forecast.detailed_description))
print('Units: ' + str(forecast.units))
print('Datetime: ' + str(forecast.datetime))
print('Location: ' + str(forecast.location))
print('Fetch datetime: ' + str(forecast.fetch_datetime))
2019-07-13 08:05:35 +02:00
def print_line(self, content):
if content is None:
return
2019-04-11 07:59:58 +02:00
print(str(content))
2019-07-13 08:05:35 +02:00
def print_err(self, exception, msg=""):
2019-04-11 07:59:58 +02:00
if exception is None:
return
content = "[ERR: "
content += datetime.now().strftime("")
content += "]\n" + str(exception)
content += "\n" + str(msg) + "\n"
traceback.print_exc()
2019-07-13 08:05:35 +02:00
self.print_line(str(content))