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"])
def add_taks (self, tasks):
def add_tasks (self, tasks):
pass
def add_crypto (self, crypto):
pass
def __finish_panel__(self):

View file

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

View file

@ -38,9 +38,6 @@ class DayRowDesign (DesignEntity):
def add_rssfeed (self, rss):
pass
def add_crypto (self, crypto):
pass
def __draw_event_list__ (self, calendar):
number_width = daynumber_y_size[0] * 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_infoarea_line__()
def add_cryptofeed (self, crypto):
def add_crypto (self, crypto):
if general_settings["info-area"] == "crypto":
self.__draw_crypto_feed__(crypto)
self.__draw_infoarea_line__()
@ -90,7 +90,7 @@ class DayViewPanel (PanelDesign):
events.pos = pos
self.draw_design(events)
def add_taks (self, tasks):
def add_tasks (self, tasks):
pass
def __finish_panel__ (self):

View file

@ -22,7 +22,7 @@ from AgendaListPanel import AgendaListPanel
import OwmForecasts
import IcalEvents
import RssParserPosts
from GeckoCrypto import GeckoCrypto
import GeckoCrypto
all_locales = locale.locale_alias
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)
events_cal = IcalEvents.IcalEvents(ical_urls, highlighted_ical_urls)
rss = RssParserPosts.RssParserPosts(rss_feeds)
crypto = GeckoCrypto(crypto_coins)
crypto = GeckoCrypto.GeckoCrypto(crypto_coins)
while True:
loop_timer.begin_loop()
@ -78,10 +78,6 @@ def main():
else:
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")
owm.reload()
design.add_weather(owm)
@ -94,6 +90,10 @@ def main():
rss.reload()
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")
for i, output in enumerate(output_adapters):
try:

View file

@ -71,6 +71,9 @@ class MonthOvPanel (PanelDesign):
if general_settings["info-area"] is "crypto":
self.__draw_crypto_post_list_to_bottom__(crypto)
def add_tasks (self, tasks):
pass
def add_calendar (self, calendar):
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()]))

View file

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

View file

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