Revert "Improved some code logic to better support new web-ui"
This reverts commit 5327d12f0e
.
This commit is contained in:
parent
5327d12f0e
commit
baf89c0d80
@ -66,18 +66,13 @@ class Agenda(inkycal_module):
|
||||
self.date_format = config['date_format']
|
||||
self.time_format = config['time_format']
|
||||
self.language = config['language']
|
||||
self.ical_urls = config['ical_urls'].split(',')
|
||||
|
||||
# Check if ical_files is an empty string
|
||||
if config['ical_urls']:
|
||||
self.ical_urls = config['ical_urls'].split(',')
|
||||
else:
|
||||
self.ical_urls = config['ical_urls']
|
||||
|
||||
# Check if ical_files is an empty string
|
||||
if config['ical_files']:
|
||||
if config['ical_files'] != "":
|
||||
self.ical_files = config['ical_files'].split(',')
|
||||
else:
|
||||
self.ical_files = config['ical_files']
|
||||
self.ical_files = []
|
||||
|
||||
# Additional config
|
||||
self.timezone = get_system_tz()
|
||||
|
@ -65,20 +65,20 @@ class Calendar(inkycal_module):
|
||||
|
||||
# optional parameters
|
||||
self.weekstart = config['week_starts_on']
|
||||
self.show_events = config['show_events']
|
||||
self.show_events = bool(config['show_events'])
|
||||
self.date_format = config["date_format"]
|
||||
self.time_format = config['time_format']
|
||||
self.language = config['language']
|
||||
|
||||
if config['ical_urls']:
|
||||
if config['ical_urls'] != "":
|
||||
self.ical_urls = config['ical_urls'].split(',')
|
||||
else:
|
||||
self.ical_urls = config['ical_urls']
|
||||
self.ical_urls = []
|
||||
|
||||
if config['ical_files']:
|
||||
if config['ical_files'] != "":
|
||||
self.ical_files = config['ical_files'].split(',')
|
||||
else:
|
||||
self.ical_files = config['ical_files']
|
||||
self.ical_files = []
|
||||
|
||||
# additional configuration
|
||||
self.timezone = get_system_tz()
|
||||
@ -117,7 +117,7 @@ class Calendar(inkycal_module):
|
||||
logger.debug(f'events-section size: {im_width} x {events_height} px')
|
||||
else:
|
||||
logger.debug("Not allocating space for events")
|
||||
calendar_height = im_height - month_name_height - weekdays_height
|
||||
calendar_height = im_height - month_name_height - weekday_height
|
||||
logger.debug(f'calendar-section size: {im_width} x {calendar_height} px')
|
||||
|
||||
# Create a 7x6 grid and calculate icon sizes
|
||||
|
@ -60,7 +60,7 @@ class Feeds(inkycal_module):
|
||||
self.feed_urls = self.config["feed_urls"].split(",")
|
||||
|
||||
# optional parameters
|
||||
self.shuffle_feeds = self.config["shuffle_feeds"]
|
||||
self.shuffle_feeds = bool(self.config["shuffle_feeds"])
|
||||
|
||||
# give an OK message
|
||||
print('{0} loaded'.format(filename))
|
||||
|
@ -1,47 +1,30 @@
|
||||
import unittest
|
||||
from inkycal.modules import Feeds as Module
|
||||
|
||||
tests = [
|
||||
{
|
||||
test = {
|
||||
"position": 1,
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": True,
|
||||
"shuffle_feeds": "True",
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
{
|
||||
"position": 1,
|
||||
"name": "Feeds",
|
||||
"config": {
|
||||
"size": [400,100],
|
||||
"feed_urls": "http://feeds.bbci.co.uk/news/world/rss.xml#",
|
||||
"shuffle_feeds": False,
|
||||
"padding_x": 10,
|
||||
"padding_y": 10,
|
||||
"fontsize": 12,
|
||||
"language": "en"
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
module = Module(test)
|
||||
|
||||
class module_test(unittest.TestCase):
|
||||
def test_get_config(self):
|
||||
print('getting data for web-ui...', end = "")
|
||||
Module.get_config()
|
||||
print('OK')
|
||||
|
||||
print('getting data for web-ui')
|
||||
module.get_config()
|
||||
|
||||
def test_generate_image(self):
|
||||
for test in tests:
|
||||
print(f'test {tests.index(test)+1} generating image..')
|
||||
module = Module(test)
|
||||
module.generate_image()
|
||||
print('OK')
|
||||
print('testing image generation')
|
||||
module.generate_image()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Loading…
Reference in New Issue
Block a user