Improved web-ui labels, improved logging, improved support for testing

Switched from NotoSans-SemiCondensed to NotoSansUI-Regular
This commit is contained in:
Ace 2020-11-21 16:22:15 +01:00
parent 077392c2f9
commit afe84dc8e6
10 changed files with 18 additions and 29 deletions

View File

@ -34,7 +34,6 @@ except ModuleNotFoundError:
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class iCalendar:
"""iCalendar parsing moudule for inkycal.

View File

@ -14,14 +14,13 @@ import arrow
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Agenda(inkycal_module):
"""Agenda class
Create agenda and show events from given icalendars
"""
name = "Inkycal Agenda"
name = "Agenda - Display upcoming events from given iCalendars"
requires = {
"ical_urls" : {
@ -68,13 +67,13 @@ class Agenda(inkycal_module):
self.language = config['language']
# Check if ical_files is an empty string
if config['ical_urls']:
if config['ical_urls'] and isinstance(config['ical_urls'], str):
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'] and isinstance(config['ical_files'], str):
self.ical_files = config['ical_files'].split(',')
else:
self.ical_files = config['ical_files']

View File

@ -12,14 +12,13 @@ import arrow
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Calendar(inkycal_module):
"""Calendar class
Create monthly calendar and show events from given icalendars
"""
name = "Inkycal Calendar"
name = "Calendar - Show monthly calendar with events from iCalendars"
optional = {
@ -70,12 +69,12 @@ class Calendar(inkycal_module):
self.time_format = config['time_format']
self.language = config['language']
if config['ical_urls']:
if config['ical_urls'] and isinstance(config['ical_urls'], str):
self.ical_urls = config['ical_urls'].split(',')
else:
self.ical_urls = config['ical_urls']
if config['ical_files']:
if config['ical_files'] and isinstance(config['ical_files'], str):
self.ical_files = config['ical_files'].split(',')
else:
self.ical_files = config['ical_files']

View File

@ -18,14 +18,13 @@ except ImportError:
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Feeds(inkycal_module):
"""RSS class
parses rss/atom feeds from given urls
"""
name = "Inkycal RSS / Atom"
name = "RSS / Atom - Display feeds from given RSS/ATOM feeds"
requires = {
"feed_urls" : {
@ -57,7 +56,10 @@ class Feeds(inkycal_module):
raise Exception('config is missing {}'.format(param))
# required parameters
self.feed_urls = config["feed_urls"].split(",")
if config["feed_urls"] and isinstance(config['feed_urls'], str):
self.feed_urls = config["feed_urls"].split(",")
else:
self.feed_urls = config["feed_urls"]
# optional parameters
self.shuffle_feeds = config["shuffle_feeds"]

View File

@ -15,7 +15,6 @@ import numpy
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Inkyimage(inkycal_module):
"""Image class
@ -26,7 +25,7 @@ class Inkyimage(inkycal_module):
requires = {
'path': {
"label":"Please enter the path of the image file (local or URL)",
"label":"Please enter the full path of the image file (local or URL)",
}
}

View File

@ -11,10 +11,11 @@ from inkycal.modules.template import inkycal_module
from inkycal.custom import *
import requests
# Show less logging for request module
logging.getLogger("urllib3").setLevel(logging.WARNING)
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Jokes(inkycal_module):
"""Icanhazdad-api class

View File

@ -14,13 +14,12 @@ import requests
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Inkyserver(inkycal_module):
"""Inkyserver class"""
name = "Inkycal Server"
name = "Inkycal Server - get image from Inkycal server"
requires = {
"panel_id" : {

View File

@ -17,14 +17,13 @@ except ImportError:
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Todoist(inkycal_module):
"""Todoist api class
parses todo's from api-key
"""
name = "Inkycal Todoist"
name = "Todoist API - show your todos from todoist"
requires = {
'api_key': {

View File

@ -20,15 +20,12 @@ except ImportError:
filename = os.path.basename(__file__).split('.py')[0]
logger = logging.getLogger(filename)
logger.setLevel(level=logging.ERROR)
class Weather(inkycal_module):
"""Weather class
parses weather details from openweathermap
"""
#TODO: automatic setup of pyowm by location id if location is numeric
name = "Inkycal Weather (openweathermap)"
name = "Weather (openweathermap) - Get weather forecasts from openweathermap"
requires = {

View File

@ -1,11 +1,6 @@
import abc
from inkycal.custom import *
# Set the root logger to level DEBUG to allow any inkycal module to use the
# logger for any level
logging.basicConfig(level = logging.DEBUG)
class inkycal_module(metaclass=abc.ABCMeta):
"""Generic base class for inykcal modules"""
@ -28,7 +23,7 @@ class inkycal_module(metaclass=abc.ABCMeta):
self.fontsize = conf["fontsize"]
self.font = ImageFont.truetype(
fonts['NotoSans-SemiCondensed'], size = self.fontsize)
fonts['NotoSansUI-Regular'], size = self.fontsize)
def set(self, help=False, **kwargs):
"""Set attributes of class, e.g. class.set(key=value)