Improved formatting
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Display class (for dirving E-Paper displays)
|
# Display class (for driving E-Paper displays)
|
||||||
from inkycal.display import Display
|
from inkycal.display import Display
|
||||||
|
|
||||||
# Default modules
|
# Default modules
|
||||||
|
@@ -37,6 +37,7 @@ for path,dirs,files in os.walk(fonts_location):
|
|||||||
|
|
||||||
available_fonts = [key for key, values in fonts.items()]
|
available_fonts = [key for key, values in fonts.items()]
|
||||||
|
|
||||||
|
|
||||||
def get_fonts():
|
def get_fonts():
|
||||||
"""Print all available fonts by name.
|
"""Print all available fonts by name.
|
||||||
|
|
||||||
@@ -162,7 +163,6 @@ def write(image, xy, box_size, text, font=None, **kwargs):
|
|||||||
|
|
||||||
text_width, text_height = font.getsize(text)[0], font.getsize('hg')[1]
|
text_width, text_height = font.getsize(text)[0], font.getsize('hg')[1]
|
||||||
|
|
||||||
|
|
||||||
# Truncate text if text is too long so it can fit inside the box
|
# Truncate text if text is too long so it can fit inside the box
|
||||||
if (text_width, text_height) > (box_width, box_height):
|
if (text_width, text_height) > (box_width, box_height):
|
||||||
logs.debug(('truncating {}'.format(text)))
|
logs.debug(('truncating {}'.format(text)))
|
||||||
@@ -250,7 +250,7 @@ def internet_available():
|
|||||||
try:
|
try:
|
||||||
urlopen('https://google.com', timeout=5)
|
urlopen('https://google.com', timeout=5)
|
||||||
return True
|
return True
|
||||||
except URLError as err:
|
except:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
9.7" driver class
|
9.7" driver class
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -14,6 +14,7 @@ EPD_HEIGHT = 825
|
|||||||
|
|
||||||
driver_dir = top_level + '/inkycal/display/drivers/9_in_7_drivers/'
|
driver_dir = top_level + '/inkycal/display/drivers/9_in_7_drivers/'
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -47,4 +48,3 @@ class EPD:
|
|||||||
|
|
||||||
def sleep(self):
|
def sleep(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@ GRAY2 = 0xC0
|
|||||||
GRAY3 = 0x80 # gray
|
GRAY3 = 0x80 # gray
|
||||||
GRAY4 = 0x00 # Blackest
|
GRAY4 = 0x00 # Blackest
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -226,7 +227,6 @@ class EPD:
|
|||||||
for count in range(0, 42):
|
for count in range(0, 42):
|
||||||
self.send_data(self.EPD_4IN2_4Gray_lut_ww[count])
|
self.send_data(self.EPD_4IN2_4Gray_lut_ww[count])
|
||||||
|
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if (epdconfig.module_init() != 0):
|
if (epdconfig.module_init() != 0):
|
||||||
return -1
|
return -1
|
||||||
@@ -264,7 +264,8 @@ class EPD:
|
|||||||
self.send_data(0x28)
|
self.send_data(0x28)
|
||||||
|
|
||||||
self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING
|
self.send_command(0X50) # VCOM AND DATA INTERVAL SETTING
|
||||||
self.send_data(0x97) # 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
self.send_data(
|
||||||
|
0x97) # 97white border 77black border VBDF 17|D7 VBDW 97 VBDB 57 VBDF F7 VBDW 77 VBDB 37 VBDR B7
|
||||||
|
|
||||||
self.set_lut()
|
self.set_lut()
|
||||||
# EPD hardware init end
|
# EPD hardware init end
|
||||||
@@ -352,7 +353,9 @@ class EPD:
|
|||||||
pixels[x, y] = 0x40
|
pixels[x, y] = 0x40
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if (i % 4 == 0):
|
if (i % 4 == 0):
|
||||||
buf[int((x + (y * self.width))/4)] = ((pixels[x-3, y]&0xc0) | (pixels[x-2, y]&0xc0)>>2 | (pixels[x-1, y]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
|
buf[int((x + (y * self.width)) / 4)] = (
|
||||||
|
(pixels[x - 3, y] & 0xc0) | (pixels[x - 2, y] & 0xc0) >> 2 | (
|
||||||
|
pixels[x - 1, y] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
|
||||||
|
|
||||||
elif (imwidth == self.height and imheight == self.width):
|
elif (imwidth == self.height and imheight == self.width):
|
||||||
logging.debug("Horizontal")
|
logging.debug("Horizontal")
|
||||||
@@ -366,7 +369,9 @@ class EPD:
|
|||||||
pixels[x, y] = 0x40
|
pixels[x, y] = 0x40
|
||||||
i = i + 1
|
i = i + 1
|
||||||
if (i % 4 == 0):
|
if (i % 4 == 0):
|
||||||
buf[int((newx + (newy * self.width))/4)] = ((pixels[x, y-3]&0xc0) | (pixels[x, y-2]&0xc0)>>2 | (pixels[x, y-1]&0xc0)>>4 | (pixels[x, y]&0xc0)>>6)
|
buf[int((newx + (newy * self.width)) / 4)] = (
|
||||||
|
(pixels[x, y - 3] & 0xc0) | (pixels[x, y - 2] & 0xc0) >> 2 | (
|
||||||
|
pixels[x, y - 1] & 0xc0) >> 4 | (pixels[x, y] & 0xc0) >> 6)
|
||||||
|
|
||||||
return buf
|
return buf
|
||||||
|
|
||||||
@@ -475,4 +480,3 @@ class EPD:
|
|||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
|
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -34,6 +34,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 400
|
EPD_WIDTH = 400
|
||||||
EPD_HEIGHT = 300
|
EPD_HEIGHT = 300
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -48,7 +49,8 @@ class EPD:
|
|||||||
epdconfig.digital_write(self.reset_pin, 1)
|
epdconfig.digital_write(self.reset_pin, 1)
|
||||||
epdconfig.delay_ms(200)
|
epdconfig.delay_ms(200)
|
||||||
epdconfig.digital_write(self.reset_pin, 0)
|
epdconfig.digital_write(self.reset_pin, 0)
|
||||||
epdconfig.delay_ms(5) # support v2 displays in favor of v1 displays.Change this to 10 for legacy v1 display support
|
epdconfig.delay_ms(
|
||||||
|
5) # support v2 displays in favor of v1 displays.Change this to 10 for legacy v1 display support
|
||||||
epdconfig.digital_write(self.reset_pin, 1)
|
epdconfig.digital_write(self.reset_pin, 1)
|
||||||
epdconfig.delay_ms(200)
|
epdconfig.delay_ms(200)
|
||||||
|
|
||||||
@@ -145,4 +147,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 600
|
EPD_WIDTH = 600
|
||||||
EPD_HEIGHT = 448
|
EPD_HEIGHT = 448
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -197,4 +198,3 @@ class EPD:
|
|||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
|
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 600
|
EPD_WIDTH = 600
|
||||||
EPD_HEIGHT = 448
|
EPD_HEIGHT = 448
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -197,4 +198,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 640
|
EPD_WIDTH = 640
|
||||||
EPD_HEIGHT = 384
|
EPD_HEIGHT = 384
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -199,4 +200,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 640
|
EPD_WIDTH = 640
|
||||||
EPD_HEIGHT = 384
|
EPD_HEIGHT = 384
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -198,4 +199,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 800
|
EPD_WIDTH = 800
|
||||||
EPD_HEIGHT = 480
|
EPD_HEIGHT = 480
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -167,4 +168,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 800
|
EPD_WIDTH = 800
|
||||||
EPD_HEIGHT = 480
|
EPD_HEIGHT = 480
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -170,4 +171,3 @@ class EPD:
|
|||||||
|
|
||||||
epdconfig.module_exit()
|
epdconfig.module_exit()
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ from . import epdconfig
|
|||||||
EPD_WIDTH = 880
|
EPD_WIDTH = 880
|
||||||
EPD_HEIGHT = 528
|
EPD_HEIGHT = 528
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -96,7 +97,6 @@ class EPD:
|
|||||||
self.send_data(0xC0);
|
self.send_data(0xC0);
|
||||||
self.send_data(0x40);
|
self.send_data(0x40);
|
||||||
|
|
||||||
|
|
||||||
self.send_command(0x01); # Set MUX as 527
|
self.send_command(0x01); # Set MUX as 527
|
||||||
self.send_data(0xAF);
|
self.send_data(0xAF);
|
||||||
self.send_data(0x02);
|
self.send_data(0x02);
|
||||||
@@ -122,7 +122,6 @@ class EPD:
|
|||||||
self.send_command(0x18);
|
self.send_command(0x18);
|
||||||
self.send_data(0X80);
|
self.send_data(0X80);
|
||||||
|
|
||||||
|
|
||||||
self.send_command(0x22);
|
self.send_command(0x22);
|
||||||
self.send_data(0XB1); # Load Temperature and waveform setting.
|
self.send_data(0XB1); # Load Temperature and waveform setting.
|
||||||
self.send_command(0x20);
|
self.send_command(0x20);
|
||||||
|
@@ -35,6 +35,7 @@ from inkycal.display.drivers import epdconfig
|
|||||||
EPD_WIDTH = 880
|
EPD_WIDTH = 880
|
||||||
EPD_HEIGHT = 528
|
EPD_HEIGHT = 528
|
||||||
|
|
||||||
|
|
||||||
class EPD:
|
class EPD:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reset_pin = epdconfig.RST_PIN
|
self.reset_pin = epdconfig.RST_PIN
|
||||||
@@ -166,7 +167,6 @@ class EPD:
|
|||||||
for i in range(0, int(self.width * self.height / 8)):
|
for i in range(0, int(self.width * self.height / 8)):
|
||||||
self.send_data(imageblack[i]);
|
self.send_data(imageblack[i]);
|
||||||
|
|
||||||
|
|
||||||
self.send_command(0x26)
|
self.send_command(0x26)
|
||||||
for i in range(0, int(self.width * self.height / 8)):
|
for i in range(0, int(self.width * self.height / 8)):
|
||||||
self.send_data(~imagered[i]);
|
self.send_data(~imagered[i]);
|
||||||
@@ -185,7 +185,6 @@ class EPD:
|
|||||||
for i in range(0, int(self.width * self.height / 8)):
|
for i in range(0, int(self.width * self.height / 8)):
|
||||||
self.send_data(0xff);
|
self.send_data(0xff);
|
||||||
|
|
||||||
|
|
||||||
self.send_command(0x26)
|
self.send_command(0x26)
|
||||||
for i in range(0, int(self.width * self.height / 8)):
|
for i in range(0, int(self.width * self.height / 8)):
|
||||||
self.send_data(0x00);
|
self.send_data(0x00);
|
||||||
|
@@ -35,6 +35,7 @@ import time
|
|||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class RaspberryPi:
|
class RaspberryPi:
|
||||||
# Pin definition
|
# Pin definition
|
||||||
RST_PIN = 17
|
RST_PIN = 17
|
||||||
@@ -152,5 +153,4 @@ else:
|
|||||||
for func in [x for x in dir(implementation) if not x.startswith('_')]:
|
for func in [x for x in dir(implementation) if not x.startswith('_')]:
|
||||||
setattr(sys.modules[__name__], func, getattr(implementation, func))
|
setattr(sys.modules[__name__], func, getattr(implementation, func))
|
||||||
|
|
||||||
|
|
||||||
### END OF FILE ###
|
### END OF FILE ###
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Third party module template (inkycal-compatible module)
|
Third party module template (inkycal-compatible module)
|
||||||
|
|
||||||
@@ -13,7 +13,6 @@ Copyright by aceisace
|
|||||||
from inkycal.modules.template import inkycal_module
|
from inkycal.modules.template import inkycal_module
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Built-in library imports (change as desired)
|
# Built-in library imports (change as desired)
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@@ -21,7 +20,6 @@ from inkycal.custom import *
|
|||||||
# Built-in libraries go here
|
# Built-in libraries go here
|
||||||
from random import shuffle
|
from random import shuffle
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# External library imports (always use try-except)
|
# External library imports (always use try-except)
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@@ -35,7 +33,6 @@ except ImportError:
|
|||||||
print('feedparser is not installed! Please install with:')
|
print('feedparser is not installed! Please install with:')
|
||||||
print('pip3 install feedparser')
|
print('pip3 install feedparser')
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Filename + logging (do not remove)
|
# Filename + logging (do not remove)
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@@ -44,6 +41,7 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Class setup
|
# Class setup
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@@ -102,6 +100,7 @@ class Simple(inkycal_module):
|
|||||||
"default": True,
|
"default": True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
||||||
# Initialise the class (do not remove)
|
# Initialise the class (do not remove)
|
||||||
@@ -175,7 +174,6 @@ class Simple(inkycal_module):
|
|||||||
if not isinstance(self.age, int):
|
if not isinstance(self.age, int):
|
||||||
print(f"age has to be a number, but given value is {self.age}")
|
print(f"age has to be a number, but given value is {self.age}")
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# Generating the image #
|
# Generating the image #
|
||||||
#############################################################################
|
#############################################################################
|
||||||
@@ -215,7 +213,6 @@ class Simple(inkycal_module):
|
|||||||
# If these aren't enough, take a look at python Pillow (imaging library)'s
|
# If these aren't enough, take a look at python Pillow (imaging library)'s
|
||||||
# documentation.
|
# documentation.
|
||||||
|
|
||||||
|
|
||||||
#################################################################
|
#################################################################
|
||||||
|
|
||||||
# return the images ready for the display
|
# return the images ready for the display
|
||||||
@@ -225,9 +222,6 @@ class Simple(inkycal_module):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print('running {0} in standalone mode'.format(filename))
|
print('running {0} in standalone mode'.format(filename))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# Last steps
|
# Last steps
|
||||||
# Wow, you made your own module for the inkycal project! Amazing :D
|
# Wow, you made your own module for the inkycal project! Amazing :D
|
||||||
@@ -248,4 +242,3 @@ if __name__ == '__main__':
|
|||||||
# How do I now import my module?
|
# How do I now import my module?
|
||||||
# from inkycal.modules import Class
|
# from inkycal.modules import Class
|
||||||
# Where Class is the name of the class inside your module (e.g. Simple)
|
# Where Class is the name of the class inside your module (e.g. Simple)
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
iCalendar (parsing) module for Inky-Calendar Project
|
iCalendar (parsing) module for Inky-Calendar Project
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -31,10 +31,10 @@ except ModuleNotFoundError:
|
|||||||
print('icalendar library could not be found. Please install this with:')
|
print('icalendar library could not be found. Please install this with:')
|
||||||
print('pip3 install icalendar')
|
print('pip3 install icalendar')
|
||||||
|
|
||||||
|
|
||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class iCalendar:
|
class iCalendar:
|
||||||
"""iCalendar parsing moudule for inkycal.
|
"""iCalendar parsing moudule for inkycal.
|
||||||
Parses events from given iCalendar URLs / paths"""
|
Parses events from given iCalendar URLs / paths"""
|
||||||
@@ -63,7 +63,6 @@ class iCalendar:
|
|||||||
else:
|
else:
|
||||||
raise Exception(f"Input: '{url}' is not a string or list!")
|
raise Exception(f"Input: '{url}' is not a string or list!")
|
||||||
|
|
||||||
|
|
||||||
def auth_ical(url, uname, passwd):
|
def auth_ical(url, uname, passwd):
|
||||||
"""Authorisation helper for protected ical files"""
|
"""Authorisation helper for protected ical files"""
|
||||||
|
|
||||||
@@ -143,7 +142,6 @@ class iCalendar:
|
|||||||
|
|
||||||
} for ical in recurring_events for events in ical)
|
} for ical in recurring_events for events in ical)
|
||||||
|
|
||||||
|
|
||||||
# if any recurring events were found, add them to parsed_events
|
# if any recurring events were found, add them to parsed_events
|
||||||
if events: self.parsed_events += list(events)
|
if events: self.parsed_events += list(events)
|
||||||
|
|
||||||
@@ -161,7 +159,6 @@ class iCalendar:
|
|||||||
by_date = lambda event: event['begin']
|
by_date = lambda event: event['begin']
|
||||||
self.parsed_events.sort(key=by_date)
|
self.parsed_events.sort(key=by_date)
|
||||||
|
|
||||||
|
|
||||||
def clear_events(self):
|
def clear_events(self):
|
||||||
"""clear previously parsed events"""
|
"""clear previously parsed events"""
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Custom image class for Inkycal Project
|
Custom image class for Inkycal Project
|
||||||
@@ -18,6 +18,7 @@ import logging
|
|||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class Inkyimage:
|
class Inkyimage:
|
||||||
"""Custom Imge class written for commonly used image operations.
|
"""Custom Imge class written for commonly used image operations.
|
||||||
"""
|
"""
|
||||||
@@ -216,7 +217,6 @@ class Inkyimage:
|
|||||||
|
|
||||||
return image1
|
return image1
|
||||||
|
|
||||||
|
|
||||||
def to_palette(self, palette, dither=True):
|
def to_palette(self, palette, dither=True):
|
||||||
"""Maps an image to a given colour palette.
|
"""Maps an image to a given colour palette.
|
||||||
|
|
||||||
@@ -331,4 +331,3 @@ class Inkyimage:
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Agenda module for Inky-Calendar Project
|
Agenda module for Inky-Calendar Project
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -15,6 +15,7 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@@ -46,7 +47,6 @@ class Agenda(inkycal_module):
|
|||||||
"default": "HH:mm",
|
"default": "HH:mm",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
@@ -225,9 +225,9 @@ class Agenda(inkycal_module):
|
|||||||
|
|
||||||
cursor += 1
|
cursor += 1
|
||||||
|
|
||||||
|
|
||||||
# return the images ready for the display
|
# return the images ready for the display
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone mode')
|
print(f'running {filename} in standalone mode')
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Calendar module for Inky-Calendar Project
|
Calendar module for Inky-Calendar Project
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -206,7 +206,6 @@ class Calendar(inkycal_module):
|
|||||||
font=self.num_font, fill_height=0.5, colour='white')
|
font=self.num_font, fill_height=0.5, colour='white')
|
||||||
im_colour.paste(icon, current_day_pos, icon)
|
im_colour.paste(icon, current_day_pos, icon)
|
||||||
|
|
||||||
|
|
||||||
# If events should be loaded and shown...
|
# If events should be loaded and shown...
|
||||||
if self.show_events == True:
|
if self.show_events == True:
|
||||||
|
|
||||||
@@ -233,7 +232,6 @@ class Calendar(inkycal_module):
|
|||||||
|
|
||||||
# logger.debug(f"event_lines {event_lines}")
|
# logger.debug(f"event_lines {event_lines}")
|
||||||
|
|
||||||
|
|
||||||
# timeline for filtering events within this month
|
# timeline for filtering events within this month
|
||||||
month_start = arrow.get(now.floor('month'))
|
month_start = arrow.get(now.floor('month'))
|
||||||
month_end = arrow.get(now.ceil('month'))
|
month_end = arrow.get(now.ceil('month'))
|
||||||
@@ -281,7 +279,6 @@ class Calendar(inkycal_module):
|
|||||||
# delete events which won't be able to fit (more events than lines)
|
# delete events which won't be able to fit (more events than lines)
|
||||||
upcoming_events[:max_event_lines]
|
upcoming_events[:max_event_lines]
|
||||||
|
|
||||||
|
|
||||||
# Check if any events were found in the given timerange
|
# Check if any events were found in the given timerange
|
||||||
if upcoming_events:
|
if upcoming_events:
|
||||||
|
|
||||||
@@ -342,5 +339,6 @@ class Calendar(inkycal_module):
|
|||||||
# return the images ready for the display
|
# return the images ready for the display
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone mode')
|
print(f'running {filename} in standalone mode')
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Feeds module for InkyCal Project
|
Feeds module for InkyCal Project
|
||||||
@@ -11,6 +10,7 @@ from inkycal.modules.template import inkycal_module
|
|||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
from random import shuffle
|
from random import shuffle
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import feedparser
|
import feedparser
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -20,6 +20,7 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@@ -74,7 +75,6 @@ class Feeds(inkycal_module):
|
|||||||
if not isinstance(self.shuffle_feeds, bool):
|
if not isinstance(self.shuffle_feeds, bool):
|
||||||
print('shuffle_feeds has to be a boolean: True/False')
|
print('shuffle_feeds has to be a boolean: True/False')
|
||||||
|
|
||||||
|
|
||||||
def generate_image(self):
|
def generate_image(self):
|
||||||
"""Generate image for this module"""
|
"""Generate image for this module"""
|
||||||
|
|
||||||
@@ -153,5 +153,6 @@ class Feeds(inkycal_module):
|
|||||||
# return images
|
# return images
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Image module for Inkycal Project
|
Image module for Inkycal Project
|
||||||
@@ -14,6 +13,7 @@ from inkycal.modules.inky_image import Inkyimage as Images
|
|||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class Inkyimage(inkycal_module):
|
class Inkyimage(inkycal_module):
|
||||||
"""Displays an image from URL or local path
|
"""Displays an image from URL or local path
|
||||||
"""
|
"""
|
||||||
@@ -68,7 +68,6 @@ class Inkyimage(inkycal_module):
|
|||||||
# give an OK message
|
# give an OK message
|
||||||
print(f'{filename} loaded')
|
print(f'{filename} loaded')
|
||||||
|
|
||||||
|
|
||||||
def generate_image(self):
|
def generate_image(self):
|
||||||
"""Generate image for this module"""
|
"""Generate image for this module"""
|
||||||
|
|
||||||
@@ -104,5 +103,6 @@ class Inkyimage(inkycal_module):
|
|||||||
# return images
|
# return images
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
iCanHazDadJoke module for InkyCal Project
|
iCanHazDadJoke module for InkyCal Project
|
||||||
@@ -11,12 +10,14 @@ 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
|
# Show less logging for request module
|
||||||
logging.getLogger("urllib3").setLevel(logging.WARNING)
|
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)
|
||||||
|
|
||||||
|
|
||||||
class Jokes(inkycal_module):
|
class Jokes(inkycal_module):
|
||||||
"""Icanhazdad-api class
|
"""Icanhazdad-api class
|
||||||
parses rss/atom feeds from given urls
|
parses rss/atom feeds from given urls
|
||||||
@@ -24,7 +25,6 @@ class Jokes(inkycal_module):
|
|||||||
|
|
||||||
name = "iCanHazDad API - grab a random joke from icanhazdad api"
|
name = "iCanHazDad API - grab a random joke from icanhazdad api"
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
"""Initialize inkycal_feeds module"""
|
"""Initialize inkycal_feeds module"""
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Inkycal-server module for Inkycal Project
|
Inkycal-server module for Inkycal Project
|
||||||
@@ -17,6 +16,7 @@ from inkycal.modules.inky_image import Inkyimage as Images
|
|||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class Inkyserver(inkycal_module):
|
class Inkyserver(inkycal_module):
|
||||||
"""Displays an image from URL or local path
|
"""Displays an image from URL or local path
|
||||||
"""
|
"""
|
||||||
@@ -75,7 +75,6 @@ class Inkyserver(inkycal_module):
|
|||||||
# give an OK message
|
# give an OK message
|
||||||
print(f'{filename} loaded')
|
print(f'{filename} loaded')
|
||||||
|
|
||||||
|
|
||||||
def generate_image(self):
|
def generate_image(self):
|
||||||
"""Generate image for this module"""
|
"""Generate image for this module"""
|
||||||
|
|
||||||
@@ -121,6 +120,7 @@ class Inkyserver(inkycal_module):
|
|||||||
# return images
|
# return images
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
|
||||||
@@ -131,4 +131,3 @@ if __name__ == '__main__':
|
|||||||
##inkycal_image_path_body = [
|
##inkycal_image_path_body = [
|
||||||
## 'https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics',
|
## 'https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics',
|
||||||
## 'https
|
## 'https
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Image module for Inkycal Project
|
Image module for Inkycal Project
|
||||||
@@ -16,6 +15,7 @@ from inkycal.modules.inky_image import Inkyimage as Images
|
|||||||
filename = os.path.basename(__file__).split('.py')[0]
|
filename = os.path.basename(__file__).split('.py')[0]
|
||||||
logger = logging.getLogger(filename)
|
logger = logging.getLogger(filename)
|
||||||
|
|
||||||
|
|
||||||
class Slideshow(inkycal_module):
|
class Slideshow(inkycal_module):
|
||||||
"""Cycles through images in a local image folder
|
"""Cycles through images in a local image folder
|
||||||
"""
|
"""
|
||||||
@@ -130,5 +130,6 @@ class Slideshow(inkycal_module):
|
|||||||
# return images
|
# return images
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Stocks Module for Inkycal Project
|
Stocks Module for Inkycal Project
|
||||||
|
|
||||||
@@ -34,8 +34,8 @@ except ImportError:
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class Stocks(inkycal_module):
|
|
||||||
|
|
||||||
|
class Stocks(inkycal_module):
|
||||||
name = "Stocks - Displays stock market infos from Yahoo finance"
|
name = "Stocks - Displays stock market infos from Yahoo finance"
|
||||||
|
|
||||||
# required parameters
|
# required parameters
|
||||||
@@ -178,14 +178,16 @@ class Stocks(inkycal_module):
|
|||||||
|
|
||||||
stockNameLine = '{} ({})'.format(stockName, stockCurrency)
|
stockNameLine = '{} ({})'.format(stockName, stockCurrency)
|
||||||
stockCurrentValueLine = '{} {} {}'.format(
|
stockCurrentValueLine = '{} {} {}'.format(
|
||||||
floatStr(precision, currentQuote), gainStr(precision, currentGain), percentageStr(currentGainPercentage))
|
floatStr(precision, currentQuote), gainStr(precision, currentGain),
|
||||||
|
percentageStr(currentGainPercentage))
|
||||||
stockDayValueLine = '1d OHL: {}/{}/{}'.format(
|
stockDayValueLine = '1d OHL: {}/{}/{}'.format(
|
||||||
floatStr(precision, currentOpen), floatStr(precision, currentHigh), floatStr(precision, currentLow))
|
floatStr(precision, currentOpen), floatStr(precision, currentHigh), floatStr(precision, currentLow))
|
||||||
maxQuote = max(stockHistory.High)
|
maxQuote = max(stockHistory.High)
|
||||||
minQuote = min(stockHistory.Low)
|
minQuote = min(stockHistory.Low)
|
||||||
logger.info(f'high {maxQuote} low {minQuote} ...')
|
logger.info(f'high {maxQuote} low {minQuote} ...')
|
||||||
stockMonthValueLine = '{}d OHL: {}/{}/{}'.format(
|
stockMonthValueLine = '{}d OHL: {}/{}/{}'.format(
|
||||||
stockHistoryLen,floatStr(precision, firstQuote),floatStr(precision, maxQuote),floatStr(precision, minQuote))
|
stockHistoryLen, floatStr(precision, firstQuote), floatStr(precision, maxQuote),
|
||||||
|
floatStr(precision, minQuote))
|
||||||
|
|
||||||
logger.info(stockNameLine)
|
logger.info(stockNameLine)
|
||||||
logger.info(stockCurrentValueLine)
|
logger.info(stockCurrentValueLine)
|
||||||
@@ -264,5 +266,6 @@ class Stocks(inkycal_module):
|
|||||||
# Save image of black and colour channel in image-folder
|
# Save image of black and colour channel in image-folder
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print('running module in standalone/debug mode')
|
print('running module in standalone/debug mode')
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
todoist module for Inky-Calendar Project
|
todoist module for Inky-Calendar Project
|
||||||
@@ -18,6 +17,7 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@@ -162,7 +162,6 @@ class Todoist(inkycal_module):
|
|||||||
|
|
||||||
logger.debug(f"grouped: {grouped}")
|
logger.debug(f"grouped: {grouped}")
|
||||||
|
|
||||||
|
|
||||||
# Add the parsed todos on the image
|
# Add the parsed todos on the image
|
||||||
cursor = 0
|
cursor = 0
|
||||||
for name, todos in grouped.items():
|
for name, todos in grouped.items():
|
||||||
@@ -200,5 +199,6 @@ class Todoist(inkycal_module):
|
|||||||
# return the images ready for the display
|
# return the images ready for the display
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone/debug mode')
|
print(f'running {filename} in standalone/debug mode')
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Weather module for Inky-Calendar software.
|
Weather module for Inky-Calendar software.
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -21,6 +21,7 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
class Weather(inkycal_module):
|
class Weather(inkycal_module):
|
||||||
"""Weather class
|
"""Weather class
|
||||||
parses weather details from openweathermap
|
parses weather details from openweathermap
|
||||||
@@ -108,7 +109,6 @@ class Weather(inkycal_module):
|
|||||||
# give an OK message
|
# give an OK message
|
||||||
print(f"{filename} loaded")
|
print(f"{filename} loaded")
|
||||||
|
|
||||||
|
|
||||||
def generate_image(self):
|
def generate_image(self):
|
||||||
"""Generate image for this module"""
|
"""Generate image for this module"""
|
||||||
|
|
||||||
@@ -141,7 +141,6 @@ class Weather(inkycal_module):
|
|||||||
return {0: '\uf095', 1: '\uf099', 2: '\uf09c', 3: '\uf0a0',
|
return {0: '\uf095', 1: '\uf099', 2: '\uf09c', 3: '\uf0a0',
|
||||||
4: '\uf0a3', 5: '\uf0a7', 6: '\uf0aa', 7: '\uf0ae'}[int(index) & 7]
|
4: '\uf0a3', 5: '\uf0a7', 6: '\uf0aa', 7: '\uf0ae'}[int(index) & 7]
|
||||||
|
|
||||||
|
|
||||||
def is_negative(temp):
|
def is_negative(temp):
|
||||||
"""Check if temp is below freezing point of water (0°C/30°F)
|
"""Check if temp is below freezing point of water (0°C/30°F)
|
||||||
returns True if temp below freezing point, else False"""
|
returns True if temp below freezing point, else False"""
|
||||||
@@ -163,7 +162,6 @@ class Weather(inkycal_module):
|
|||||||
'11n': '\uf03b', '13n': '\uf038', '50n': '\uf023'
|
'11n': '\uf03b', '13n': '\uf038', '50n': '\uf023'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def draw_icon(image, xy, box_size, icon, rotation=None):
|
def draw_icon(image, xy, box_size, icon, rotation=None):
|
||||||
"""Custom function to add icons of weather font on image
|
"""Custom function to add icons of weather font on image
|
||||||
image = on which image should the text be added?
|
image = on which image should the text be added?
|
||||||
@@ -204,8 +202,6 @@ class Weather(inkycal_module):
|
|||||||
# Update only region with text (add text with transparent background)
|
# Update only region with text (add text with transparent background)
|
||||||
image.paste(space, xy, space)
|
image.paste(space, xy, space)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# column1 column2 column3 column4 column5 column6 column7
|
# column1 column2 column3 column4 column5 column6 column7
|
||||||
# |----------|----------|----------|----------|----------|----------|----------|
|
# |----------|----------|----------|----------|----------|----------|----------|
|
||||||
# | time | temperat.| moonphase| forecast1| forecast2| forecast3| forecast4|
|
# | time | temperat.| moonphase| forecast1| forecast2| forecast3| forecast4|
|
||||||
@@ -215,7 +211,6 @@ class Weather(inkycal_module):
|
|||||||
# | | windspeed| sunset | temperat.| temperat.| temperat.| temperat.|
|
# | | windspeed| sunset | temperat.| temperat.| temperat.| temperat.|
|
||||||
# |----------|----------|----------|----------|----------|----------|----------|
|
# |----------|----------|----------|----------|----------|----------|----------|
|
||||||
|
|
||||||
|
|
||||||
# Calculate size rows and columns
|
# Calculate size rows and columns
|
||||||
col_width = im_width // 7
|
col_width = im_width // 7
|
||||||
|
|
||||||
@@ -268,7 +263,6 @@ class Weather(inkycal_module):
|
|||||||
## draw.line((0, row3+row_height, im_width, row3+row_height), fill='black')
|
## draw.line((0, row3+row_height, im_width, row3+row_height), fill='black')
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
|
|
||||||
# Positions for current weather details
|
# Positions for current weather details
|
||||||
weather_icon_pos = (col1, 0)
|
weather_icon_pos = (col1, 0)
|
||||||
temperature_icon_pos = (col2, row1)
|
temperature_icon_pos = (col2, row1)
|
||||||
@@ -368,7 +362,6 @@ class Weather(inkycal_module):
|
|||||||
|
|
||||||
logger.debug("getting daily forecasts")
|
logger.debug("getting daily forecasts")
|
||||||
|
|
||||||
|
|
||||||
def calculate_forecast(days_from_today):
|
def calculate_forecast(days_from_today):
|
||||||
"""Get temperature range and most frequent icon code for forecast
|
"""Get temperature range and most frequent icon code for forecast
|
||||||
days_from_today should be int from 1-4: e.g. 2 -> 2 days from today
|
days_from_today should be int from 1-4: e.g. 2 -> 2 days from today
|
||||||
@@ -389,7 +382,6 @@ class Weather(inkycal_module):
|
|||||||
# Calculate min. and max. temp for this day
|
# Calculate min. and max. temp for this day
|
||||||
temp_range = f'{max(daily_temp)}°/{min(daily_temp)}°'
|
temp_range = f'{max(daily_temp)}°/{min(daily_temp)}°'
|
||||||
|
|
||||||
|
|
||||||
# Get all weather icon codes for this day
|
# Get all weather icon codes for this day
|
||||||
daily_icons = [_.weather_icon_name for _ in forecasts]
|
daily_icons = [_.weather_icon_name for _ in forecasts]
|
||||||
# Find most common element from all weather icon codes
|
# Find most common element from all weather icon codes
|
||||||
@@ -503,7 +495,6 @@ class Weather(inkycal_module):
|
|||||||
write(im_black, eval(f'temp_fc{pos}'), (col_width, row_height),
|
write(im_black, eval(f'temp_fc{pos}'), (col_width, row_height),
|
||||||
temp, font=self.font)
|
temp, font=self.font)
|
||||||
|
|
||||||
|
|
||||||
border_h = row3 + row_height
|
border_h = row3 + row_height
|
||||||
border_w = col_width - 3 # leave 3 pixels gap
|
border_w = col_width - 3 # leave 3 pixels gap
|
||||||
|
|
||||||
@@ -518,5 +509,6 @@ class Weather(inkycal_module):
|
|||||||
# return the images ready for the display
|
# return the images ready for the display
|
||||||
return im_black, im_colour
|
return im_black, im_colour
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
print(f'running {filename} in standalone mode')
|
print(f'running {filename} in standalone mode')
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
|
#!python3
|
||||||
|
|
||||||
import abc
|
import abc
|
||||||
from inkycal.custom import *
|
from inkycal.custom import *
|
||||||
|
|
||||||
|
|
||||||
class inkycal_module(metaclass=abc.ABCMeta):
|
class inkycal_module(metaclass=abc.ABCMeta):
|
||||||
"""Generic base class for inkycal modules"""
|
"""Generic base class for inkycal modules"""
|
||||||
|
|
||||||
@@ -87,6 +90,3 @@ class inkycal_module(metaclass=abc.ABCMeta):
|
|||||||
except:
|
except:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
'Ohoh, something went wrong while trying to get the config of this module')
|
'Ohoh, something went wrong while trying to get the config of this module')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
iCalendar parser test (ical_parser)
|
iCalendar parser test (ical_parser)
|
||||||
@@ -14,10 +13,10 @@ from urllib.request import urlopen
|
|||||||
from inkycal.modules.ical_parser import iCalendar
|
from inkycal.modules.ical_parser import iCalendar
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
|
|
||||||
ical = iCalendar()
|
ical = iCalendar()
|
||||||
test_ical = 'https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics'
|
test_ical = 'https://calendar.google.com/calendar/ical/en.usa%23holiday%40group.v.calendar.google.com/public/basic.ics'
|
||||||
|
|
||||||
|
|
||||||
class ical_parser_test(unittest.TestCase):
|
class ical_parser_test(unittest.TestCase):
|
||||||
|
|
||||||
def test_load_url(self):
|
def test_load_url(self):
|
||||||
@@ -49,8 +48,8 @@ class ical_parser_test(unittest.TestCase):
|
|||||||
print('OK')
|
print('OK')
|
||||||
os.remove('dummy.ical')
|
os.remove('dummy.ical')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
"""
|
"""
|
||||||
Agenda test (inkycal_agenda)
|
Agenda test (inkycal_agenda)
|
||||||
Copyright by aceisace
|
Copyright by aceisace
|
||||||
@@ -7,12 +7,12 @@ Copyright by aceisace
|
|||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Agenda as Module
|
from inkycal.modules import Agenda as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
environment = get_environment()
|
environment = get_environment()
|
||||||
|
|
||||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||||
use_preview = False
|
use_preview = False
|
||||||
|
|
||||||
|
|
||||||
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
@@ -77,8 +77,8 @@ class module_test(unittest.TestCase):
|
|||||||
if use_preview == True and environment == 'Raspberry':
|
if use_preview == True and environment == 'Raspberry':
|
||||||
preview(merge(im_black, im_colour))
|
preview(merge(im_black, im_colour))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Calendar test (inkycal_calendar)
|
Calendar test (inkycal_calendar)
|
||||||
@@ -9,12 +8,12 @@ Copyright by aceisace
|
|||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Calendar as Module
|
from inkycal.modules import Calendar as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
environment = get_environment()
|
environment = get_environment()
|
||||||
|
|
||||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||||
use_preview = False
|
use_preview = False
|
||||||
|
|
||||||
|
|
||||||
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
sample_url = "https://www.officeholidays.com/ics-fed/usa"
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
@@ -68,6 +67,7 @@ tests = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class module_test(unittest.TestCase):
|
class module_test(unittest.TestCase):
|
||||||
def test_get_config(self):
|
def test_get_config(self):
|
||||||
print('getting data for web-ui...', end="")
|
print('getting data for web-ui...', end="")
|
||||||
@@ -83,8 +83,8 @@ class module_test(unittest.TestCase):
|
|||||||
if use_preview == True and environment == 'Raspberry':
|
if use_preview == True and environment == 'Raspberry':
|
||||||
preview(merge(im_black, im_colour))
|
preview(merge(im_black, im_colour))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Feeds test (inykcal_feeds)
|
Feeds test (inykcal_feeds)
|
||||||
@@ -9,6 +8,7 @@ Copyright by aceisace
|
|||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Feeds as Module
|
from inkycal.modules import Feeds as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
environment = get_environment()
|
environment = get_environment()
|
||||||
|
|
||||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||||
@@ -44,6 +44,7 @@ tests = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class module_test(unittest.TestCase):
|
class module_test(unittest.TestCase):
|
||||||
def test_get_config(self):
|
def test_get_config(self):
|
||||||
print('getting data for web-ui...', end="")
|
print('getting data for web-ui...', end="")
|
||||||
@@ -59,11 +60,10 @@ class module_test(unittest.TestCase):
|
|||||||
if use_preview == True and environment == 'Raspberry':
|
if use_preview == True and environment == 'Raspberry':
|
||||||
preview(merge(im_black, im_colour))
|
preview(merge(im_black, im_colour))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Image test (inkycal_image)
|
Image test (inkycal_image)
|
||||||
@@ -10,12 +9,12 @@ import unittest
|
|||||||
from inkycal.modules import Inkyimage as Module
|
from inkycal.modules import Inkyimage as Module
|
||||||
from inkycal.custom import top_level
|
from inkycal.custom import top_level
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
environment = get_environment()
|
environment = get_environment()
|
||||||
|
|
||||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||||
use_preview = False
|
use_preview = False
|
||||||
|
|
||||||
|
|
||||||
test_path = f'{top_level}/Gallery/coffee.png'
|
test_path = f'{top_level}/Gallery/coffee.png'
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
@@ -98,6 +97,7 @@ tests = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class module_test(unittest.TestCase):
|
class module_test(unittest.TestCase):
|
||||||
def test_get_config(self):
|
def test_get_config(self):
|
||||||
print('getting data for web-ui...', end="")
|
print('getting data for web-ui...', end="")
|
||||||
@@ -113,8 +113,8 @@ class module_test(unittest.TestCase):
|
|||||||
if use_preview == True and environment == 'Raspberry':
|
if use_preview == True and environment == 'Raspberry':
|
||||||
preview(merge(im_black, im_colour))
|
preview(merge(im_black, im_colour))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Jokes test (inkycal_jokes)
|
Jokes test (inkycal_jokes)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Slideshow test (inkycal_slideshow)
|
Slideshow test (inkycal_slideshow)
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Stocks test (inkycal_stocks)
|
Stocks test (inkycal_stocks)
|
||||||
@@ -9,12 +8,12 @@ Copyright by aceisace
|
|||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Stocks as Module
|
from inkycal.modules import Stocks as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
|
||||||
environment = get_environment()
|
environment = get_environment()
|
||||||
|
|
||||||
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
# Set to True to preview images. Only works on Raspberry Pi OS with Desktop
|
||||||
use_preview = False
|
use_preview = False
|
||||||
|
|
||||||
|
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
"name": "Stocks",
|
"name": "Stocks",
|
||||||
@@ -66,6 +65,7 @@ tests = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class module_test(unittest.TestCase):
|
class module_test(unittest.TestCase):
|
||||||
def test_get_config(self):
|
def test_get_config(self):
|
||||||
print('getting data for web-ui...', end="")
|
print('getting data for web-ui...', end="")
|
||||||
@@ -81,8 +81,8 @@ class module_test(unittest.TestCase):
|
|||||||
if use_preview == True and environment == 'Raspberry':
|
if use_preview == True and environment == 'Raspberry':
|
||||||
preview(merge(im_black, im_colour))
|
preview(merge(im_black, im_colour))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
logger.level = logging.DEBUG
|
logger.level = logging.DEBUG
|
||||||
logger.addHandler(logging.StreamHandler(sys.stdout))
|
logger.addHandler(logging.StreamHandler(sys.stdout))
|
||||||
|
@@ -1,2 +0,0 @@
|
|||||||
import unittest
|
|
||||||
from inkycal.modules import Todoist as Module
|
|
@@ -1,3 +1,5 @@
|
|||||||
|
#!python3
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Todoist as Module
|
from inkycal.modules import Todoist as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
#!python3
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from inkycal.modules import Weather as Module
|
from inkycal.modules import Weather as Module
|
||||||
from helper_functions import *
|
from helper_functions import *
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/python3
|
#!python3
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Main test (main)
|
Main test (main)
|
||||||
|
Reference in New Issue
Block a user