* src/ReportBase/_ReportUtils.py: Add function "get_address_str"

* src/plugins/DetDescendantReport.py: Add addresses (0000791)
* src/plugins/DetAncestralReport.py: Add addresses (0000791)
* src/plugins/IndivComplete.py: Add addresses (0000791)
* src/plugins/NarrativeWeb.py: use "get_address_str"
* src/plugins/FamilyGroup.py: use "get_address_str"

svn: r7956
This commit is contained in:
Brian Matherly 2007-01-23 01:51:33 +00:00
parent c43c32a644
commit 1a57769135
7 changed files with 134 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2007-01-22 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_ReportUtils.py: Add function "get_address_str"
* src/plugins/DetDescendantReport.py: Add addresses (0000791)
* src/plugins/DetAncestralReport.py: Add addresses (0000791)
* src/plugins/IndivComplete.py: Add addresses (0000791)
* src/plugins/NarrativeWeb.py: use "get_address_str"
* src/plugins/FamilyGroup.py: use "get_address_str"
2007-01-22 Don Allingham <don@gramps-project.org>
* src/ViewManager.py: import of gramps package
* src/ArgHandler.py: import of gramps package

View File

@ -2285,3 +2285,32 @@ def get_person_mark(db,person):
key = "%s (%s - %s)" % (name,birth,death)
return BaseDoc.IndexMark( key, BaseDoc.INDEX_TYPE_ALP )
#-------------------------------------------------------------------------
#
# Address String
#
#-------------------------------------------------------------------------
def get_address_str(addr):
"""
Returns a string that combines the elements of an addres
@param addr: the GRAMPS address instance
"""
str = ""
elems = [ addr.get_street(),
addr.get_city(),
addr.get_county(),
addr.get_state(),
addr.get_country(),
addr.get_postal_code(),
addr.get_phone() ]
for info in elems:
if info:
if str == "":
str = info
else:
str = "%s, %s" % (str,info)
return str

View File

@ -113,6 +113,7 @@ class DetAncestorReport(Report):
self.addImages = options_class.handler.options_dict['incphotos']
self.includeNames = options_class.handler.options_dict['incnames']
self.includeEvents = options_class.handler.options_dict['incevents']
self.includeAddr = options_class.handler.options_dict['incaddresses']
self.includeSources= options_class.handler.options_dict['incsources']
self.gen_handles = {}
@ -309,6 +310,25 @@ class DetAncestorReport(Report):
first = 0
self.write_event(event_ref)
if self.includeAddr:
for addr in person.get_address_list():
if first:
self.doc.start_paragraph('DAR-MoreHeader')
self.doc.write_text(_('More about %(person_name)s:') % {
'person_name' : name })
self.doc.end_paragraph()
first = False
self.doc.start_paragraph('DAR-MoreDetails')
text = ReportUtils.get_address_str(addr)
date = DateHandler.get_date(addr)
self.doc.write_text(_('Address: '))
if date:
self.doc.write_text( '%s, ' % date )
self.doc.write_text( text )
self.doc.write_text( self.endnotes(addr) )
self.doc.end_paragraph()
return 0 # Not duplicate person
@ -678,6 +698,7 @@ class DetAncestorOptions(ReportOptions):
'incphotos' : 0,
'incnames' : 0,
'incevents' : 0,
'incaddresses' : 0,
'incsources' : 0,
}
self.options_help = {
@ -717,6 +738,9 @@ class DetAncestorOptions(ReportOptions):
'incevents' : ("=0/1","Whether to include events.",
["Do not include events","Include events"],
True),
'incaddresses': ("=0/1","Whether to include addresses.",
["Do not include addresses","Include addresses"],
True),
'incsources' : ("=0/1","Whether to include source references.",
["Do not include sources","Include sources"],
True),
@ -885,6 +909,10 @@ class DetAncestorOptions(ReportOptions):
# Print events
self.include_events_option = gtk.CheckButton(_("Include events"))
self.include_events_option.set_active(self.options_dict['incevents'])
# Print addresses
self.include_addresses_option = gtk.CheckButton(_("Include addresses"))
self.include_addresses_option.set_active(self.options_dict['incaddresses'])
# Print sources
self.include_sources_option = gtk.CheckButton(_("Include sources"))
@ -904,6 +932,7 @@ class DetAncestorOptions(ReportOptions):
dialog.add_frame_option(_('Include'),'',self.include_notes_option)
dialog.add_frame_option(_('Include'),'',self.include_names_option)
dialog.add_frame_option(_('Include'),'',self.include_events_option)
dialog.add_frame_option(_('Include'),'',self.include_addresses_option)
dialog.add_frame_option(_('Include'),'',self.include_sources_option)
dialog.add_frame_option(_('Missing information'),'',self.place_option)
dialog.add_frame_option(_('Missing information'),'',self.date_option)
@ -925,6 +954,7 @@ class DetAncestorOptions(ReportOptions):
self.options_dict['incphotos'] = int(self.image_option.get_active())
self.options_dict['incnames'] = int(self.include_names_option.get_active())
self.options_dict['incevents'] = int(self.include_events_option.get_active())
self.options_dict['incaddresses'] = int(self.include_addresses_option.get_active())
self.options_dict['incsources'] = int(self.include_sources_option.get_active())
#------------------------------------------------------------------------

View File

@ -116,6 +116,7 @@ class DetDescendantReport(Report):
self.addImages = options_class.handler.options_dict['incphotos']
self.includeNames = options_class.handler.options_dict['incnames']
self.includeEvents = options_class.handler.options_dict['incevents']
self.includeAddr = options_class.handler.options_dict['incaddresses']
self.includeSources= options_class.handler.options_dict['incsources']
self.includeMates = options_class.handler.options_dict['incmates']
@ -337,6 +338,25 @@ class DetDescendantReport(Report):
first = 0
self.write_event(event_ref)
if self.includeAddr:
for addr in person.get_address_list():
if first:
self.doc.start_paragraph('DDR-MoreHeader')
self.doc.write_text(_('More about %(person_name)s:') % {
'person_name' : name })
self.doc.end_paragraph()
first = False
self.doc.start_paragraph('DDR-MoreDetails')
text = ReportUtils.get_address_str(addr)
date = DateHandler.get_date(addr)
self.doc.write_text(_('Address: '))
if date:
self.doc.write_text( '%s, ' % date )
self.doc.write_text( text )
self.doc.write_text( self.endnotes(addr) )
self.doc.end_paragraph()
return 0 # Not duplicate person
@ -705,6 +725,7 @@ class DetDescendantOptions(ReportOptions):
'incphotos' : 0,
'incnames' : 0,
'incevents' : 0,
'incaddresses' : 0,
'incsources' : 0,
'incmates' : 1,
}
@ -745,6 +766,9 @@ class DetDescendantOptions(ReportOptions):
'incevents' : ("=0/1","Whether to include events.",
["Do not include events","Include events"],
True),
'incaddresses': ("=0/1","Whether to include addresses.",
["Do not include addresses","Include addresses"],
True),
'incsources' : ("=0/1","Whether to include source references.",
["Do not include sources","Include sources"],
True),
@ -916,6 +940,10 @@ class DetDescendantOptions(ReportOptions):
# Print events
self.include_events_option = gtk.CheckButton(_("Include events"))
self.include_events_option.set_active(self.options_dict['incevents'])
# Print addresses
self.include_addresses_option = gtk.CheckButton(_("Include addresses"))
self.include_addresses_option.set_active(self.options_dict['incaddresses'])
# Print sources
self.include_sources_option = gtk.CheckButton(_("Include sources"))
@ -939,6 +967,7 @@ class DetDescendantOptions(ReportOptions):
dialog.add_frame_option(_('Include'),'',self.include_notes_option)
dialog.add_frame_option(_('Include'),'',self.include_names_option)
dialog.add_frame_option(_('Include'),'',self.include_events_option)
dialog.add_frame_option(_('Include'),'',self.include_addresses_option)
dialog.add_frame_option(_('Include'),'',self.include_sources_option)
dialog.add_frame_option(_('Include'),'',self.include_spouses_option)
dialog.add_frame_option(_('Missing information'),'',self.place_option)
@ -961,6 +990,7 @@ class DetDescendantOptions(ReportOptions):
self.options_dict['incphotos'] = int(self.image_option.get_active())
self.options_dict['incnames'] = int(self.include_names_option.get_active())
self.options_dict['incevents'] = int(self.include_events_option.get_active())
self.options_dict['incaddresses'] = int(self.include_addresses_option.get_active())
self.options_dict['incsources'] = int(self.include_sources_option.get_active())
self.options_dict['incmates'] = int(self.include_spouses_option.get_active())

View File

@ -338,8 +338,7 @@ class FamilyGroup(Report):
if self.incParAddr:
addrlist = person.get_address_list()[:]
for addr in addrlist:
location = "%s %s %s %s" % (addr.get_street(),addr.get_city(),
addr.get_state(),addr.get_country())
location = ReportUtils.get_address_str(addr)
date = DateHandler.get_date( addr )
self.doc.start_row()

View File

@ -280,6 +280,40 @@ class IndivCompleteReport(Report):
self.doc.start_paragraph('IDS-Normal')
self.doc.end_paragraph()
def write_addresses(self):
alist = self.start_person.get_address_list()
if len(alist) == 0:
return
self.doc.start_table("addresses","IDS-IndTable")
self.doc.start_row()
self.doc.start_cell("IDS-TableHead",2)
self.doc.start_paragraph("IDS-TableTitle")
self.doc.write_text(_("Addresses"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
for addr in alist:
text = ReportUtils.get_address_str(addr)
date = DateHandler.get_date(addr)
self.doc.start_row()
self.normal_cell(date)
if self.use_srcs:
for s in addr.get_source_references():
src_handle = s.get_reference_handle()
src = self.database.get_source_from_handle(src_handle)
text = "%s [%s]" % (text,src.get_gramps_id())
self.slist.append(s)
self.normal_cell(text)
self.doc.end_row()
self.doc.end_table()
self.doc.start_paragraph('IDS-Normal')
self.doc.end_paragraph()
def write_families(self):
if not len(self.start_person.get_family_handle_list()):
@ -507,6 +541,7 @@ class IndivCompleteReport(Report):
self.write_facts()
self.write_alt_parents()
self.write_families()
self.write_addresses()
self.write_note()
self.write_sources()

View File

@ -1727,8 +1727,7 @@ class IndividualPage(BasePage):
of.write('<table class="infolist">\n')
for addr in alist:
location = ", ".join([addr.get_street(),addr.get_city(),
addr.get_state(),addr.get_country()])
location = ReportUtils.get_address_str(addr)
location += self.get_citation_links( addr.get_source_references() )
date = _dd.display(addr.get_date_object())