-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample1.py
56 lines (52 loc) · 3.28 KB
/
example1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os, sys
from tempfile import gettempdir
from photocalendar import PhotoCalendar
sys.path.append(os.pardir)
from preprocessExample import main as preprocessExample
# locale and directory of corresponding data
locale = "cs_CZ"
dirLocale = os.path.join(os.pardir,os.pardir,"locale",locale)
# directories to be used. If you want to build your own calendar, you can use the same directory structure
buildDirectory = os.path.join(gettempdir(),"photocalendar-example1") # main build directory
dataDirectory = os.path.join(buildDirectory,"data") # where auxiliary data will be put ...
imagesDirectory = os.path.join(dataDirectory,"images") # ... e.g. images ...
imageDescriptionsFile = os.path.join(dataDirectory,"imageDescriptions.dat") # ... their decriptions ...
backgroundImagesDirectory = os.path.join(dataDirectory,"backgrounds") # ... backgrounds
title = "PhotoCalendar 2019" # ... title
titlePageImage = os.path.join(dataDirectory,"titlePageImage.svg") # ... title image
titlePageBackground = os.path.join(dataDirectory,"titlePageBackground.svg") # ... title background
lastPageBackground = os.path.join(dataDirectory,"lastPageBackground.svg") # ... title background
notesFile = os.path.join(dataDirectory,"notes.dat") # ... or notes for days
nameDaysFile = os.path.join(dataDirectory,"nameDays.dat") # ... or name-days
religiousHolidaysFile = os.path.join(dataDirectory,"religiousHolidays.dat") # ... or religious holidays
publicHolidaysFile = os.path.join(dataDirectory,"publicHolidays.dat") # ... or public holidays
weekDayNamesFile = os.path.join(dataDirectory,"weekDayNames.dat") # ... or custom names of week days
abbrWeekDayNamesFile = os.path.join(dataDirectory,"abbrWeekDayNames.dat") # ... or custom abbreviations of weekday names
monthNamesFile = os.path.join(dataDirectory,"monthNames.dat") # ... or custom names of months
abbrMonthNamesFile = os.path.join(dataDirectory,"abbrMonthNames.dat") # ... or custom abbreviations of month names
template = "delphinus"
# create sample images and other data
preprocessExample(buildDirectory,locale=locale)
# create the calendar and save it
calendar = PhotoCalendar(
outputBase = os.path.join(buildDirectory,"example1-py"),
year = 2019,
firstWeekDay = "Tu",
imagesDirectory = imagesDirectory,
imageDescriptionsFile = imageDescriptionsFile,
backgroundImagesDirectory = backgroundImagesDirectory,
title = title,
titlePageImage = titlePageImage,
titlePageBackground = titlePageBackground,
lastPageBackground = lastPageBackground,
nameDaysFile = nameDaysFile,
religiousHolidaysFile = religiousHolidaysFile,
publicHolidaysFile = publicHolidaysFile,
notesFile = notesFile,
weekDayNamesFile = weekDayNamesFile,
abbrWeekDayNamesFile = abbrWeekDayNamesFile,
monthNamesFile = monthNamesFile,
abbrMonthNamesFile = abbrMonthNamesFile,
template = template,
)
calendar.toHTML()