Read calendards URL from .cals file
This commit is contained in:
parent
8c7d5f583e
commit
5acdf32ae7
3 changed files with 11 additions and 4 deletions
|
|
@ -5,7 +5,7 @@ from PIL import Image, ImageDraw, ImageFont
|
|||
|
||||
class Config:
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, cals_file_list=".cals"):
|
||||
if os.path.exists('/usr/share/fonts/source-pro/'):
|
||||
self.fnt_R_path = "/usr/share/fonts/source-pro/SourceSansPro-Regular.otf"
|
||||
self.fnt_RI_path = "/usr/share/fonts/source-pro/SourceSansPro-It.otf"
|
||||
|
|
@ -19,6 +19,13 @@ class Config:
|
|||
self.fnt_RI_path = "/usr/share/fonts/TTF/LinBiolinum_RIah.ttf"
|
||||
self.fnt_RB_path = "/usr/share/fonts/TTF/LinBiolinum_RBah.ttf"
|
||||
|
||||
try:
|
||||
with open(cals_file_list) as f:
|
||||
self.cals = [c for c in f.read().split("\n") if len(c) > 0]
|
||||
except:
|
||||
print("No calendar found. Please create a file " + cals_file_list)
|
||||
self.cals = []
|
||||
|
||||
self.css_overlay = NamedTemporaryFile()
|
||||
with open(self.css_overlay.name, 'w') as f:
|
||||
f.write('''
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue