calingen.contrib.layouts.year_by_week.year_by_week
¶
LayoutProvider
implementation for a year’s calendar.
Warning
This layout is included in django-calingen’s CI test setup, mainly to verify
that the TeX escaping
is working.
This may be object to future changes.
Module Contents¶
Classes¶
Layout-specific class to manage calendar days. |
|
Layout-specific class to manage calendar weeks. |
|
The actual implementation of the layout. |
- class calingen.contrib.layouts.year_by_week.year_by_week.CalendarDay(date, date_entries)¶
Layout-specific class to manage calendar days.
- Parameters:
date (datetime.date) – The Python representation of the date.
date_entries (list) – A list of
entries
for the givendate
(will be a subset of the providedcalingen.interfaces.data_exchange.CalendarEntryList
and each entry is expected to be an instance ofcalingen.interfaces.data_exchange.CalendarEntry
).
- class calingen.contrib.layouts.year_by_week.year_by_week.CalendarWeek¶
Layout-specific class to manage calendar weeks.
- property is_empty¶
Flag to indicate, if this object already contains days.
- __repr__()¶
Return repr(self).
- __str__()¶
Return str(self).
- _check_turnover(date_of_day)¶
Update the
month_string
.While adding days to this object, a turnover may happen, meaning that during that week a new month starts.
This method updates the
month_string
attribute accordingly.As there can only be one turnover during any given week,
check_turnover
is substituted with_noop()
during its execution.Warning
This is a private method, other methods should use
check_turnover
to ensure performance.- Parameters:
date_of_day (datetime.date) – A Python date representation.
- _noop(*args, **kwargs)¶
Just a generic no op method.
This method is used to substitute
populate_week
andcheck_turnover
during processing.
- _populate_week(date_of_day)¶
Set the object’s meta data, e.g. number of the calendar week.
This is a one-time operation that is performed on the first call to
add_day()
. During that call,populate_week
is substituted with_noop()
.Warning
This is a private method, other methods should use
populate_week
to ensure performance.- Parameters:
date_of_day (datetime.date) – A Python date representation.
- add_day(day)¶
Add a layout-specific day object to this week.
This method is the actual public entry point of this class, allowing
day
objects to be added to the instance.- Parameters:
day (calingen.contrib.layouts.year_by_week.year_by_week.CalendarDay) – A layout-specific representation of a single
day
, including its actualdate
(datetime.date
) and instances ofcalingen.interfaces.data_exchange.CalendarEntry
associated with thatdate
.
- class calingen.contrib.layouts.year_by_week.year_by_week.YearByWeek¶
Bases:
calingen.interfaces.plugin_api.LayoutProvider
The actual implementation of the layout.
prepare_context()
is used to create a year’s full representation, grouping the days by week and matching theentries
to the given day.Warning
The provided templates create a document targeted at German users. You may override the templates to (fully) support other languages.
Notes
To customize the generated TeX-sources, the following templates may be overridden:
year_by_week/tex/base.tex
: Speaking in TeX-terms: the preamble of the document, including package definitions.year_by_week/tex/year_by_week.tex
: Speaking in TeX-terms: the document’s body.
- _template = year_by_week/tex/year_by_week.tex¶
- layout_type = tex¶
- name = Year by Week¶
- orientation = portrait¶
- paper_size = a5¶
- classmethod prepare_context(context)¶
Create a full year’s representation and return it as
weeklist
.