Added design option in settings-file and renamed general design settings
This commit is contained in:
parent
964570bc4a
commit
cec0ee83da
3 changed files with 16 additions and 6 deletions
|
@ -14,6 +14,7 @@ import locale
|
|||
from DebugConsole import DebugConsole
|
||||
from settings import *
|
||||
from MonthOvPanel import MonthOvPanel
|
||||
from DayListPanel import DayListPanel
|
||||
import OwmForecasts
|
||||
import IcalEvents
|
||||
import RssParserPosts
|
||||
|
@ -37,6 +38,11 @@ if render_to_display:
|
|||
epd = Epd7in5Adapter.Epd7in5Adapter()
|
||||
output_adapters.append(epd)
|
||||
|
||||
available_panels = {
|
||||
"day-list" : DayListPanel,
|
||||
"month-overview" : MonthOvPanel
|
||||
}
|
||||
|
||||
"""Main loop starts from here"""
|
||||
def main ():
|
||||
while True:
|
||||
|
@ -54,7 +60,10 @@ def main ():
|
|||
for output in output_adapters:
|
||||
output.calibrate()
|
||||
|
||||
design = MonthOvPanel((epd.width, epd.height))
|
||||
if choosen_design in available_panels.keys():
|
||||
design = available_panels[choosen_design]((epd.width, epd.height))
|
||||
else:
|
||||
raise ImportError("choosen_design must be valid (" + choosen_design + ")")
|
||||
|
||||
debug.print_line("Fetching weather information from open weather map")
|
||||
owm = OwmForecasts.OwmForecasts(api_key)
|
||||
|
|
|
@ -54,16 +54,16 @@ class MonthOvPanel (PanelDesign):
|
|||
self.draw_design(WeatherHeaderDesign(self.__abs_pos__(weatherheadersize), weather))
|
||||
|
||||
def add_rssfeed (self, rss):
|
||||
if weather_month_info_settings["info-area"] is "rss":
|
||||
if general_settings["info-area"] is "rss":
|
||||
self.__draw_rss_post_list_to_bottom__(rss)
|
||||
|
||||
def add_calendar (self, calendar):
|
||||
if weather_month_info_settings["highlight-event-days"]:
|
||||
if general_settings["highlight-event-days"]:
|
||||
month_events = list(set([ (event.begin_datetime.day, event.begin_datetime.month, event.begin_datetime.year) for event in calendar.get_month_events()]))
|
||||
for event in month_events:
|
||||
self.__draw_highlight_event_day__(event)
|
||||
|
||||
if weather_month_info_settings["info-area"] is "events":
|
||||
if general_settings["info-area"] is "events":
|
||||
self.__draw_event_list_to_bottom__(calendar)
|
||||
|
||||
def __draw_rss_post_list_to_bottom__ (self, rss):
|
||||
|
|
|
@ -18,9 +18,10 @@ hours = "24"
|
|||
|
||||
|
||||
"""DESIGN"""
|
||||
weather_month_info_settings = {
|
||||
choosen_design = "month-overview" # month-overview, day-list
|
||||
general_settings = { # General settings that designs may use
|
||||
"info-area" : "rss", # empty, events, rss
|
||||
"highligh-event-days" : True,
|
||||
"highlight-event-days" : True
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue