Merge pull request #134 from vitasam/dev_ver2_0

Fix for 7 rows in Calendar, when the month starts from Sat
This commit is contained in:
Ace
2020-08-23 16:32:48 +02:00
committed by GitHub

View File

@@ -80,7 +80,15 @@ class Calendar(inkycal_module):
im_width, calendar_height))
# Create grid and calculate icon sizes
calendar_rows, calendar_cols = 6, 7
now = arrow.now(tz = self.timezone)
monthstart = now.span('month')[0].weekday()
monthdays = now.ceil('month').day
if monthstart > 4 and monthdays == 31:
calendar_rows, calendar_cols = 7, 7
else:
calendar_rows, calendar_cols = 6, 7
icon_width = im_width // calendar_cols
icon_height = calendar_height // calendar_rows
@@ -98,8 +106,6 @@ class Calendar(inkycal_module):
weekday_pos = [(grid_start_x + icon_width*_, month_name_height) for _ in
range(calendar_cols)]
now = arrow.now(tz = self.timezone)
# Set weekstart of calendar to specified weekstart
if self.weekstart == "Monday":
cal.setfirstweekday(cal.MONDAY)