Implemented crypto interface to panels

This commit is contained in:
Maximilian Giller 2019-05-19 22:25:59 +02:00
parent ad79095a9d
commit 0200116d88
8 changed files with 30 additions and 20 deletions

View file

@ -40,7 +40,10 @@ class AgendaListPanel (PanelDesign):
self.__draw_seperator__(1-infolist_size[1], colors["fg"]) self.__draw_seperator__(1-infolist_size[1], colors["fg"])
def add_taks (self, tasks): def add_tasks (self, tasks):
pass
def add_crypto (self, crypto):
pass pass
def __finish_panel__(self): def __finish_panel__(self):

View file

@ -51,11 +51,12 @@ class DayListPanel (PanelDesign):
self.__draw_rss_infoarea__(rss) self.__draw_rss_infoarea__(rss)
def add_crypto (self, crypto): def add_crypto (self, crypto):
for row in self.__day_rows__:
row.add_crypto(crypto)
if general_settings["info-area"] is "crypto": if general_settings["info-area"] is "crypto":
self.__draw_crypto_infoarea__(crypto) self.__draw_crypto_infoarea__(crypto)
def add_tasks (self, tasks):
pass
def __draw_rss_infoarea__ (self, rss): def __draw_rss_infoarea__ (self, rss):
height = infoarea_replacedrowscount * self.dayrow_size[1] * self.size[1] - rss_y_padding height = infoarea_replacedrowscount * self.dayrow_size[1] * self.size[1] - rss_y_padding
ypos = self.size[1] - height ypos = self.size[1] - height

View file

@ -38,9 +38,6 @@ class DayRowDesign (DesignEntity):
def add_rssfeed (self, rss): def add_rssfeed (self, rss):
pass pass
def add_crypto (self, crypto):
pass
def __draw_event_list__ (self, calendar): def __draw_event_list__ (self, calendar):
number_width = daynumber_y_size[0] * self.size[1] number_width = daynumber_y_size[0] * self.size[1]
ypos = eventlist_ypos * self.size[1] ypos = eventlist_ypos * self.size[1]

View file

@ -49,7 +49,7 @@ class DayViewPanel (PanelDesign):
self.__draw_rss_feed__(rss) self.__draw_rss_feed__(rss)
self.__draw_infoarea_line__() self.__draw_infoarea_line__()
def add_cryptofeed (self, crypto): def add_crypto (self, crypto):
if general_settings["info-area"] == "crypto": if general_settings["info-area"] == "crypto":
self.__draw_crypto_feed__(crypto) self.__draw_crypto_feed__(crypto)
self.__draw_infoarea_line__() self.__draw_infoarea_line__()
@ -90,7 +90,7 @@ class DayViewPanel (PanelDesign):
events.pos = pos events.pos = pos
self.draw_design(events) self.draw_design(events)
def add_taks (self, tasks): def add_tasks (self, tasks):
pass pass
def __finish_panel__ (self): def __finish_panel__ (self):

View file

@ -22,7 +22,7 @@ from AgendaListPanel import AgendaListPanel
import OwmForecasts import OwmForecasts
import IcalEvents import IcalEvents
import RssParserPosts import RssParserPosts
from GeckoCrypto import GeckoCrypto import GeckoCrypto
all_locales = locale.locale_alias all_locales = locale.locale_alias
if language.lower() not in all_locales.keys(): if language.lower() not in all_locales.keys():
@ -62,7 +62,7 @@ def main():
owm = OwmForecasts.OwmForecasts(location, api_key, paid_api=owm_paid_subscription) owm = OwmForecasts.OwmForecasts(location, api_key, paid_api=owm_paid_subscription)
events_cal = IcalEvents.IcalEvents(ical_urls, highlighted_ical_urls) events_cal = IcalEvents.IcalEvents(ical_urls, highlighted_ical_urls)
rss = RssParserPosts.RssParserPosts(rss_feeds) rss = RssParserPosts.RssParserPosts(rss_feeds)
crypto = GeckoCrypto(crypto_coins) crypto = GeckoCrypto.GeckoCrypto(crypto_coins)
while True: while True:
loop_timer.begin_loop() loop_timer.begin_loop()
@ -78,10 +78,6 @@ def main():
else: else:
raise ImportError("choosen_design must be valid (" + choosen_design + ")") raise ImportError("choosen_design must be valid (" + choosen_design + ")")
debug.print_line('Fetching crypto prices from coin gecko')
crypto.reload()
design.add_crypto(crypto)
debug.print_line("Fetching weather information from open weather map") debug.print_line("Fetching weather information from open weather map")
owm.reload() owm.reload()
design.add_weather(owm) design.add_weather(owm)
@ -94,6 +90,10 @@ def main():
rss.reload() rss.reload()
design.add_rssfeed(rss) design.add_rssfeed(rss)
debug.print_line('Fetching crypto prices from coin gecko')
crypto.reload()
design.add_crypto(crypto)
debug.print_line("\nStarting to render") debug.print_line("\nStarting to render")
for i, output in enumerate(output_adapters): for i, output in enumerate(output_adapters):
try: try:

View file

@ -71,6 +71,9 @@ class MonthOvPanel (PanelDesign):
if general_settings["info-area"] is "crypto": if general_settings["info-area"] is "crypto":
self.__draw_crypto_post_list_to_bottom__(crypto) self.__draw_crypto_post_list_to_bottom__(crypto)
def add_tasks (self, tasks):
pass
def add_calendar (self, calendar): def add_calendar (self, calendar):
if general_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()])) month_events = list(set([ (event.begin_datetime.day, event.begin_datetime.month, event.begin_datetime.year) for event in calendar.get_month_events()]))

View file

@ -74,7 +74,10 @@ class MonthViewPanel (PanelDesign):
rss.pos = pos rss.pos = pos
self.draw_design(rss) self.draw_design(rss)
def add_taks (self, tasks): def add_tasks (self, tasks):
pass
def add_crypto (self, crypto):
pass pass
def __finish_panel__(self): def __finish_panel__(self):

View file

@ -10,16 +10,19 @@ class PanelDesign (DesignEntity):
self.start_timestamp = datetime.now() self.start_timestamp = datetime.now()
def add_weather (self, weather): def add_weather (self, weather):
raise NotImplementedError("Functions needs to be implemented") raise NotImplementedError("Function needs to be implemented")
def add_calendar (self, calendar): def add_calendar (self, calendar):
raise NotImplementedError("Functions needs to be implemented") raise NotImplementedError("Function needs to be implemented")
def add_rssfeed (self, rss): def add_rssfeed (self, rss):
raise NotImplementedError("Functions needs to be implemented") raise NotImplementedError("Function needs to be implemented")
def add_taks (self, tasks): def add_tasks (self, tasks):
raise NotImplementedError("Functions needs to be implemented") raise NotImplementedError("Function needs to be implemented")
def add_crypto (self, crypto):
raise NotImplementedError("Function needs to be implemented")
def __finish_panel__(self): def __finish_panel__(self):
pass pass