french holidays update (2018-2019)

internal prelimimnary iso week support
This commit is contained in:
George Tzoumas 2019-01-01 19:50:36 +01:00
parent 636a85dea2
commit 1402161b3a
6 changed files with 34 additions and 6 deletions

View File

@ -30,3 +30,9 @@ d|20170415-20170501|vacances de printemps||multi
d|20180212-20180223|vacances d'hiver||multi
d|20180409-20180420|vacances de printemps||multi
d|20181022-20181102|vacances de Toussaint||multi
d|20181224-20190104|vacances de Noël||multi
d|20190218-20190301|vacances d'hiver||multi
d|20190415-20190426|vacances de printemps||multi

View File

@ -30,3 +30,9 @@ d|20170408-20170423|vacances de printemps||multi
d|20180226-20180309|vacances d'hiver||multi
d|20180423-20180504|vacances de printemps||multi
d|20181022-20181102|vacances de Toussaint||multi
d|20181224-20190104|vacances de Noël||multi
d|20190211-20190222|vacances d'hiver||multi
d|20190408-20190422|vacances de printemps||multi

View File

@ -30,3 +30,9 @@ d|20170401-20170417|vacances de printemps||multi
d|20180219-20180302|vacances d'hiver||multi
d|20180416-20180427|vacances de printemps||multi
d|20181022-20181102|vacances de Toussaint||multi
d|20181224-20190104|vacances de Noël||multi
d|20190225-20190308|vacances d'hiver||multi
d|20190423-20190503|vacances de printemps||multi

View File

@ -95,8 +95,10 @@ class DayCell(object):
"""render the day cell in short mode"""
S,G,L = self.theme
x, y, w, h = rect
day_of_month, day_of_week = self.day
draw_box(cr, rect, S.frame, S.bg, mm_to_dots(S.frame_thickness))
day_of_month, day_of_week, week_of_year = self.day
S_bg = S.bg
#if day_of_week >= 5 and (week_of_year & 1): S_bg = color_scale(S.bg,0.9)
draw_box(cr, rect, S.frame, S_bg, mm_to_dots(S.frame_thickness))
R = rect_rel_scale(rect, G.size[0], G.size[1])
if self.show_day_name:
Rdom, Rdow = rect_hsplit(R, *G.mw_split)
@ -125,8 +127,10 @@ class DayCell(object):
"""render the day cell in long mode"""
S,G,L = self.theme
x, y, w, h = rect
day_of_month, day_of_week = self.day
draw_box(cr, rect, S.frame, S.bg, mm_to_dots(S.frame_thickness))
day_of_month, day_of_week, week_of_year = self.day
S_bg = S.bg
#if day_of_week >= 5 and (week_of_year & 1): S_bg = tuple(reversed(S.bg))
draw_box(cr, rect, S.frame, S_bg, mm_to_dots(S.frame_thickness))
R1, Rhf = rect_hsplit(rect, *G.hf_hsplit)
if self.show_day_name:
R = rect_rel_scale(R1, G.size[2], G.size[3])

View File

@ -51,12 +51,13 @@ class CalendarRenderer(_base.CalendarRenderer):
draw_shadow(cr, rect_from_origin(rect), shad)
# draw day cells
iso_y, iso_w, iso_d = date(year,month,1).isocalendar()
for dom in range(1,rows+1):
R = dom_grid.item(dom-1)
if dom <= span:
holiday_tuple = self.holiday_provider(year, month, dom, day)
day_style = holiday_tuple[2]
dcell = _base.DayCell(day = (dom, day), header = holiday_tuple[0], footer = holiday_tuple[1],
dcell = _base.DayCell(day = (dom, day, iso_w), header = holiday_tuple[0], footer = holiday_tuple[1],
theme = (day_style, G.dom, L), show_day_name = True)
dcell.draw(cr, R, self.options.short_daycell_ratio)
else:
@ -64,6 +65,8 @@ class CalendarRenderer(_base.CalendarRenderer):
draw_box(cr, rect = R, stroke_rgba = day_style.frame, fill_rgba = day_style.bg,
stroke_width = mm_to_dots(day_style.frame_thickness))
day = (day + 1) % 7
iso_w += (iso_d == 7)
iso_d = (iso_d + 1) if iso_d < 7 else 1
# draw month title (name)
mcolor = S.month.color_map_bg[year%2][month]

View File

@ -77,12 +77,14 @@ class CalendarRenderer(_base.CalendarRenderer):
align = (2,0), font = S.dow.font, measure = wmeasure)
# draw day cells
iso_y, iso_w, iso_d = date(year,month,1).isocalendar()
for row in range(weekrows):
for col in range(7):
R = dom_grid.item(row, col)
is_normal = dom > 0 and dom <= span
if is_normal or self.options.phantom_days:
real_year, real_month, real_dom = year, month, dom
real_iso_w = iso_w
# handle phantom days
if dom < 1:
@ -103,7 +105,7 @@ class CalendarRenderer(_base.CalendarRenderer):
day_style = holiday_tuple[2]
else:
day_style = S.dom_weekend_phantom if col >= 5 else S.dom_phantom
dcell = _base.DayCell(day = (real_dom, col), header = holiday_tuple[0], footer = holiday_tuple[1],
dcell = _base.DayCell(day = (real_dom, col, iso_w), header = holiday_tuple[0], footer = holiday_tuple[1],
theme = (day_style, G.dom, L), show_day_name = False)
dcell.draw(cr, R, self.options.short_daycell_ratio)
else:
@ -111,6 +113,7 @@ class CalendarRenderer(_base.CalendarRenderer):
draw_box(cr, rect = R, stroke_rgba = day_style.frame, fill_rgba = day_style.bg,
stroke_width = mm_to_dots(day_style.frame_thickness))
dom += 1
iso_w += 1
# draw month title (name)
mcolor = S.month.color_map_bg[year%2][month]