svn: r7848
This commit is contained in:
Alex Roitman 2006-12-25 05:23:06 +00:00
parent f29b0eb697
commit 5fd72cf53a
3 changed files with 39 additions and 23 deletions

View File

@ -1,3 +1,7 @@
2006-12-24 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/Calendar.py: Fixes.
* src/plugins/holidays.xml: Fixes.
2006-12-23 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_EventRefModel.py: properly sort events by date (bug #508)
* src/DisplayTabs/_EventEmbedList.py: properly sort events by date (bug #508)

View File

@ -113,20 +113,32 @@ class Calendar(Report):
widget.define_graphics_style(self.doc)
def get_short_name(self, person, maiden_name = None):
""" Is there a better, built-in way of getting a short, personal name? """
nickname = person.get_nick_name()
if nickname:
first_name = nickname
""" Returns person's name, unless maiden_name given, unless married_name listed. """
# Get all of a person's names:
primary_name = person.get_primary_name()
married_name = None
names = [primary_name] + person.get_alternate_names()
for n in names:
if int(n.get_type()) == RelLib.NameType.MARRIED:
married_name = n
# Now, decide which to use:
if maiden_name != None:
if married_name != None:
first_name, family_name = married_name.get_first_name(), married_name.get_surname()
call_name = married_name.get_call_name()
else:
first_name = person.get_primary_name().get_first_name()
if first_name:
first_name = first_name.split()[0] # not middle name
if nickname.strip().count(" ") > 0: # HACK: first and last name assumed
family_name = ""
elif maiden_name != None:
family_name = maiden_name
first_name, family_name = primary_name.get_first_name(), maiden_name
call_name = primary_name.get_call_name()
else:
family_name = person.get_primary_name().get_surname()
first_name, family_name = primary_name.get_first_name(), primary_name.get_surname()
call_name = primary_name.get_call_name()
# If they have a nickname use it
if call_name != None and call_name.strip() != "":
first_name = call_name.strip()
else: # else just get the first name:
first_name = first_name.strip()
if " " in first_name:
first_name, rest = first_name.split(" ", 1) # just one split max
return ("%s %s" % (first_name, family_name)).strip()
def draw_rectangle(self, style, sx, sy, ex, ey):
@ -230,8 +242,8 @@ class Calendar(Report):
current = 0
for line in p.split("\n"):
self.doc.write_at("text", line,
day_col * cell_width + .1,
header + (week_row + 1) * cell_height - position + (current * spacing) + self["offset"])
day_col * cell_width + 0.1,
header + (week_row + 1) * cell_height - position + (current * spacing) - 0.1)
current += 1
current_ord += 1
if not something_this_week:

View File

@ -14,7 +14,7 @@
<date name="Presidents' Day" value="*/3/mon/feb" type="secular" />
<date name="Washington's Birthday" value="*/2/22" type="secular" />
<date name="St. Patrick's Day" value="*/3/17" type="secular" />
<date name="April Fools's Day" value="*/4/1" type="secular" />
<date name="April Fool's Day" value="*/4/1" type="secular" />
<date name="Earth Day" value="*/4/22" type="secular" />
<date name="Assistants' Day" value="*/-1/sat/apr" offset="-3" type="secular" />
<date name="Arbor Day" value="*/-1/fri/apr" type="secular" />
@ -96,13 +96,13 @@
<date name="Yom Kippur" value="2008/10/09" type="religious" />
<date name="Yom Kippur" value="2009/9/28" type="religious" />
<date name="Yom Kippur" value="2010/9/18" type="religious" />
<date name="Hanukkah begins" value="2004/10/07" type="religious" />
<date name="Hanukkah begins" value="2005/10/26" type="religious" />
<date name="Hanukkah begins" value="2006/10/15" type="religious" />
<date name="Hanukkah begins" value="2007/10/05" type="religious" />
<date name="Hanukkah begins" value="2008/10/22" type="religious" />
<date name="Hanukkah begins" value="2009/10/12" type="religious" />
<date name="Hanukkah begins" value="2010/10/22" type="religious" />
<date name="Hanukkah begins" value="2004/12/07" type="religious" />
<date name="Hanukkah begins" value="2005/12/25" type="religious" />
<date name="Hanukkah begins" value="2006/12/15" type="religious" />
<date name="Hanukkah begins" value="2007/12/04" type="religious" />
<date name="Hanukkah begins" value="2008/12/21" type="religious" />
<date name="Hanukkah begins" value="2009/12/11" type="religious" />
<date name="Hanukkah begins" value="2010/12/01" type="religious" />
<date name="Ramadan begins" value="2006/9/24" type="religious" />
<date name="Ramadan begins" value="2007/9/13" type="religious" />
<date name="Ramadan begins" value="2008/9/2" type="religious" />