创建自定义周/月/…照片日历
photo-calendar的Python项目详细描述
PhotoCalendar
创建自定义周/月/的Python实用程序…照片日历。 例如:
目录
概述
程序以HTML格式创建日历。
Note: you can then print it to PDF using browser or, e.g., weasyptint utility.
用户可以提供(参见examples below):
- 工作日和月份的名称及其缩写
- 图像(每周,用于标题页,用于背景)
- 命名日期
- 公共假日
- 宗教节日
- 便条(朋友的生日、周年纪念等)
- 为最终日历制作模板
- 标题,第一个星期日…
HTML模板
生成的html结构和css样式由template定义,template是一个python模块,定义toHTMLString(calendar)
函数和CSSString
字符串变量。
作为一个例子和灵感,提供了一些预定义的模板。
有关如何创建自定义模板的详细信息,请参阅examples,文档或源代码。
兼容性
这个包可以与Python2和3一起工作(在Ubuntu 16.04 LTS和Python2.7.12以及Python3.5.2上测试)。
示例
使用量
Python:
fromphotocalendarimportPhotoCalendarcalendar=PhotoCalendar(# not all arguments are mandatoryoutputBase="/some/output/base",year=2019,firstWeekDay="Tu",# Tuesday as the first week day? Well, why not...imagesDirectory="/some/directory/with/images/for/each/week",imageDescriptionsFile="/some/file/with/image/descriptions/for/each/week",backgroundImagesDirectory="/some/directory/with/backround/images/for/each/week",title="Some calendar title",titlePageImage="/some/image/for/title/page",titlePageBackground="/some/background/image/for/titlepage",lastPageBackground="/some/background/image/for/last/page",nameDaysFile="/some/file/with/name-days",religiousHolidaysFile="/some/file/with/religious/holidays",publicHolidaysFile="/some/file/with/public/holidays",notesFile="/some/file/with/notes/like/birthdays/etc",weekDayNamesFile="/some/file/with/custom/weekday/names",abbrWeekDayNamesFile="/some/file/with/custom/abbreviated/weekday/names",monthNamesFile="/some/file/with/custom/month/names",abbrMonthNamesFile="/some/file/with/custom/abbreviated/month/names",template="delphinus",)calendar.toHTML()
外壳:
# not all arguments are mandatory photocalendar \ --output-base /some/output/base \ --year 2019\ --first-week-day Tu \ --images-directory /some/directory/with/images/for/each/week \ --image-descriptions-file /some/file/with/image/descriptions/for/each/week \ --background-images-directory /some/directory/with/backround/images/for/each/week \ --title "Some calendar title"\ --title-page-image /some/image/for/title/page \ --title-page-background /some/background/image/for/titlepage \ --last-page-background /some/background/image/for/last/page \ --name-days-file /some/file/with/name-days \ --religious-holidays-file /some/file/with/religious/holidays \ --public-holidays-file /some/file/with/public/holidays \ --notes-file /some/file/with/notes/like/birthdays/etc \ --week-day-names-file /some/file/with/custom/week/day/names \ --abbr-week-day-names-file /some/file/with/custom/abbreviated/week/day/names \ --month-names-file /some/file/with/custom/month/names \ --abbr-month-names-file /some/file/with/custom/abbreviated/month/names \ --template delphinus
模板示例
Note: the photos and backgrounds are only illustrative. They are provided by the user in the real use case.
将显示标题页和一个内页。
在插图中, picture 属于 Golden Gate Bridge 和 picture 属于 Matterhorn 使用。
模板Delphinus:
每周A5景观日历
模板Columba:
A4月历
模板狼疮:
两周日历
安装
使用
setup.py
文件:python setup.py install [options]
,例如python setup.py --user
使用
make
(内部调用setup.py
):make install [options]
,例如make install USER=TRUE PYTHON=python3
使用^{
} [sudo] pip install [options] photo-calendar
,例如pip install --user photo-calendar
这里是什么
file/directory | description |
---|---|
bin | directory containing executable python script |
doc | source files for HTML documentation |
examples | directory with examples |
images | images for github page (e.g., templates illustrations) |
locale | files for localization (public holidays, name days, etc.) |
Makefile | makefile for the project (with targets ^{ |
photocalendar | actual python package |
setup.py | python setup file for installation |
tests | python unit tests |
贡献
拉取请求
很受欢迎。特别是:
- 地区(名称日期、公共假日)
- 模板
但是,请事先和作者讨论一下目的。
错误报告
如有任何问题,请在githup page of the project留言。
贡献者
许可证
此项目是根据lgpl许可证授权的-有关详细信息,请参见license file。
致谢
- 向Petr Hlav_ek介绍最初的想法和LaTex实现,并提供他的源代码
- 为了html创作灵感dominate python package