Improved web-ui labels, improved logging, improved support for testing
Switched from NotoSans-SemiCondensed to NotoSansUI-Regular
This commit is contained in:
		| @@ -34,7 +34,6 @@ except ModuleNotFoundError: | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class iCalendar: | class iCalendar: | ||||||
|   """iCalendar parsing moudule for inkycal. |   """iCalendar parsing moudule for inkycal. | ||||||
|   | |||||||
| @@ -14,14 +14,13 @@ import arrow | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Agenda(inkycal_module): | class Agenda(inkycal_module): | ||||||
|   """Agenda class |   """Agenda class | ||||||
|   Create agenda and show events from given icalendars |   Create agenda and show events from given icalendars | ||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   name = "Inkycal Agenda" |   name = "Agenda - Display upcoming events from given iCalendars" | ||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|     "ical_urls" : { |     "ical_urls" : { | ||||||
| @@ -68,13 +67,13 @@ class Agenda(inkycal_module): | |||||||
|     self.language = config['language'] |     self.language = config['language'] | ||||||
|  |  | ||||||
|     # Check if ical_files is an empty string |     # 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(',') |       self.ical_urls = config['ical_urls'].split(',') | ||||||
|     else: |     else: | ||||||
|       self.ical_urls = config['ical_urls'] |       self.ical_urls = config['ical_urls'] | ||||||
|  |  | ||||||
|     # Check if ical_files is an empty string |     # 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(',') |       self.ical_files = config['ical_files'].split(',') | ||||||
|     else: |     else: | ||||||
|       self.ical_files = config['ical_files'] |       self.ical_files = config['ical_files'] | ||||||
|   | |||||||
| @@ -12,14 +12,13 @@ import arrow | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Calendar(inkycal_module): | class Calendar(inkycal_module): | ||||||
|   """Calendar class |   """Calendar class | ||||||
|   Create monthly calendar and show events from given icalendars |   Create monthly calendar and show events from given icalendars | ||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   name = "Inkycal Calendar" |   name = "Calendar - Show monthly calendar with events from iCalendars" | ||||||
|  |  | ||||||
|   optional = { |   optional = { | ||||||
|  |  | ||||||
| @@ -70,12 +69,12 @@ class Calendar(inkycal_module): | |||||||
|     self.time_format = config['time_format'] |     self.time_format = config['time_format'] | ||||||
|     self.language = config['language'] |     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(',') |       self.ical_urls = config['ical_urls'].split(',') | ||||||
|     else: |     else: | ||||||
|       self.ical_urls = config['ical_urls'] |       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(',') |       self.ical_files = config['ical_files'].split(',') | ||||||
|     else: |     else: | ||||||
|       self.ical_files = config['ical_files'] |       self.ical_files = config['ical_files'] | ||||||
|   | |||||||
| @@ -18,14 +18,13 @@ except ImportError: | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Feeds(inkycal_module): | class Feeds(inkycal_module): | ||||||
|   """RSS class |   """RSS class | ||||||
|   parses rss/atom feeds from given urls |   parses rss/atom feeds from given urls | ||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   name = "Inkycal RSS / Atom" |   name = "RSS / Atom - Display feeds from given RSS/ATOM feeds" | ||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|     "feed_urls" : { |     "feed_urls" : { | ||||||
| @@ -57,7 +56,10 @@ class Feeds(inkycal_module): | |||||||
|         raise Exception('config is missing {}'.format(param)) |         raise Exception('config is missing {}'.format(param)) | ||||||
|  |  | ||||||
|     # required parameters |     # 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 |     # optional parameters | ||||||
|     self.shuffle_feeds = config["shuffle_feeds"] |     self.shuffle_feeds = config["shuffle_feeds"] | ||||||
|   | |||||||
| @@ -15,7 +15,6 @@ import numpy | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Inkyimage(inkycal_module): | class Inkyimage(inkycal_module): | ||||||
|   """Image class |   """Image class | ||||||
| @@ -26,7 +25,7 @@ class Inkyimage(inkycal_module): | |||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|   'path': { |   '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)", | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -11,10 +11,11 @@ from inkycal.modules.template import inkycal_module | |||||||
| from inkycal.custom import * | from inkycal.custom import * | ||||||
|  |  | ||||||
| import requests | import requests | ||||||
|  | # Show less logging for request module | ||||||
|  | logging.getLogger("urllib3").setLevel(logging.WARNING) | ||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Jokes(inkycal_module): | class Jokes(inkycal_module): | ||||||
|   """Icanhazdad-api class |   """Icanhazdad-api class | ||||||
|   | |||||||
| @@ -14,13 +14,12 @@ import requests | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
|  |  | ||||||
| class Inkyserver(inkycal_module): | class Inkyserver(inkycal_module): | ||||||
|   """Inkyserver class""" |   """Inkyserver class""" | ||||||
|  |  | ||||||
|   name = "Inkycal Server" |   name = "Inkycal Server - get image from Inkycal server" | ||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|     "panel_id" : { |     "panel_id" : { | ||||||
|   | |||||||
| @@ -17,14 +17,13 @@ except ImportError: | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Todoist(inkycal_module): | class Todoist(inkycal_module): | ||||||
|   """Todoist api class |   """Todoist api class | ||||||
|   parses todo's from api-key |   parses todo's from api-key | ||||||
|   """ |   """ | ||||||
|  |  | ||||||
|   name = "Inkycal Todoist" |   name = "Todoist API - show your todos from todoist" | ||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|     'api_key': { |     'api_key': { | ||||||
|   | |||||||
| @@ -20,15 +20,12 @@ except ImportError: | |||||||
|  |  | ||||||
| filename = os.path.basename(__file__).split('.py')[0] | filename = os.path.basename(__file__).split('.py')[0] | ||||||
| logger = logging.getLogger(filename) | logger = logging.getLogger(filename) | ||||||
| logger.setLevel(level=logging.ERROR) |  | ||||||
|  |  | ||||||
| class Weather(inkycal_module): | class Weather(inkycal_module): | ||||||
|   """Weather class |   """Weather class | ||||||
|   parses weather details from openweathermap |   parses weather details from openweathermap | ||||||
|   """ |   """ | ||||||
|   #TODO: automatic setup of pyowm by location id if location is numeric |   name = "Weather (openweathermap) - Get weather forecasts from openweathermap" | ||||||
|  |  | ||||||
|   name = "Inkycal Weather (openweathermap)" |  | ||||||
|  |  | ||||||
|   requires = { |   requires = { | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,11 +1,6 @@ | |||||||
| import abc | import abc | ||||||
| from inkycal.custom import * | 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): | class inkycal_module(metaclass=abc.ABCMeta): | ||||||
|   """Generic base class for inykcal modules""" |   """Generic base class for inykcal modules""" | ||||||
|  |  | ||||||
| @@ -28,7 +23,7 @@ class inkycal_module(metaclass=abc.ABCMeta): | |||||||
|  |  | ||||||
|     self.fontsize = conf["fontsize"] |     self.fontsize = conf["fontsize"] | ||||||
|     self.font = ImageFont.truetype( |     self.font = ImageFont.truetype( | ||||||
|       fonts['NotoSans-SemiCondensed'], size = self.fontsize) |       fonts['NotoSansUI-Regular'], size = self.fontsize) | ||||||
|  |  | ||||||
|   def set(self, help=False, **kwargs): |   def set(self, help=False, **kwargs): | ||||||
|     """Set attributes of class, e.g. class.set(key=value) |     """Set attributes of class, e.g. class.set(key=value) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user