2007-07-23 Johan Gonqvist <johan.gronqvist@gmail.com>

* src/plugins/Calendar.py: first day of calendar is an option.


svn: r9083
This commit is contained in:
Benny Malengier 2007-10-05 12:55:08 +00:00
parent 6d6357a2fc
commit 8c89fa68c7
2 changed files with 15 additions and 3 deletions

View File

@ -1,3 +1,6 @@
2007-07-23 Johan Gonqvist <johan.gronqvist@gmail.com>
* src/plugins/Calendar.py: first day of calendar is an option.
2007-10-05 Benny Malengier <benny.malengier@gramps-project.org> 2007-10-05 Benny Malengier <benny.malengier@gramps-project.org>
* src/DisplayTabs/_GalleryTab.py: remove bug that leads to database corruption, * src/DisplayTabs/_GalleryTab.py: remove bug that leads to database corruption,
if media is deleted in mediaview, remove media in all open gallery tabs if media is deleted in mediaview, remove media in all open gallery tabs

View File

@ -65,6 +65,7 @@ class Calendar(Report):
self.year = options_class.handler.options_dict['year'] self.year = options_class.handler.options_dict['year']
self.country = options_class.handler.options_dict['country'] self.country = options_class.handler.options_dict['country']
self.anniversaries = options_class.handler.options_dict['anniversaries'] self.anniversaries = options_class.handler.options_dict['anniversaries']
self.start_dow = options_class.handler.options_dict['start_dow'][0]
self.maiden_name = options_class.handler.options_dict['maiden_name'] self.maiden_name = options_class.handler.options_dict['maiden_name']
self.alive = options_class.handler.options_dict['alive'] self.alive = options_class.handler.options_dict['alive']
self.birthdays = options_class.handler.options_dict['birthdays'] self.birthdays = options_class.handler.options_dict['birthdays']
@ -188,14 +189,15 @@ class Calendar(Report):
cell_height = (height - header)/ 6 cell_height = (height - header)/ 6
current_date = datetime.date(year, month, 1) current_date = datetime.date(year, month, 1)
spacing = pt2cm(1.25 * ptext.get_font().get_size()) # 158 spacing = pt2cm(1.25 * ptext.get_font().get_size()) # 158
if current_date.isoweekday() != 7: # start dow here is 7, sunday if current_date.isoweekday() != self.start_dow:
current_ord = current_date.toordinal() - current_date.isoweekday() # Go back to previous first day of week, and start from there
current_ord = current_date.toordinal() - ( (current_date.isoweekday() + 7) - self.start_dow ) % 7
else: else:
current_ord = current_date.toordinal() current_ord = current_date.toordinal()
for day_col in range(7): for day_col in range(7):
font_height = pt2cm(pdaynames.get_font().get_size()) font_height = pt2cm(pdaynames.get_font().get_size())
self.doc.center_text("CAL-Daynames", self.doc.center_text("CAL-Daynames",
GrampsLocale.long_days[day_col+1], GrampsLocale.long_days[(day_col+self.start_dow) % 7 + 1],
day_col * cell_width + cell_width/2, day_col * cell_width + cell_width/2,
header - font_height * 1.5) header - font_height * 1.5)
for week_row in range(6): for week_row in range(6):
@ -410,6 +412,13 @@ class CalendarOptions(MenuOptions):
country.set_help(_("Select the country to see associated holidays")) country.set_help(_("Select the country to see associated holidays"))
menu.add_option(category_name,"country", country) menu.add_option(category_name,"country", country)
start_dow = EnumeratedListOption(_("First day of week"), GrampsLocale.long_days[1])
for count in range(1,8):
# conversion between gramps numbering (sun=1) and iso numbering (mon=1) of weekdays below
start_dow.add_item((count+5) % 7 + 1, GrampsLocale.long_days[count])
start_dow.set_help(_("Select the first day of the week for the calendar"))
menu.add_option(category_name, "start_dow", start_dow)
maiden_name = EnumeratedListOption(_("Birthday surname"), maiden_name = EnumeratedListOption(_("Birthday surname"),
("maiden", _("Wives use their own surname"))) ("maiden", _("Wives use their own surname")))
maiden_name.add_item("regular", _("Wives use husband's surname")) maiden_name.add_item("regular", _("Wives use husband's surname"))