From d8d03e335cfef75cb287bb025be79de4831a4bfa Mon Sep 17 00:00:00 2001
From: Martin Hawlisch
\n')
of.write('
\n')
of.write('
\n')
- of.write(' \n')
@@ -255,9 +255,9 @@ class PlaceListPage(BasePage):
for handle in handle_list:
place = db.get_place_from_handle(handle)
- n = place.title
+ n = ReportUtils.place_name(db,handle)
- if len(n) == 0:
+ if not n or len(n) == 0:
continue
if n[0] != last_letter:
@@ -274,7 +274,7 @@ class PlaceListPage(BasePage):
of.write(' ')
@@ -282,6 +282,58 @@ class PlaceListPage(BasePage):
self.display_footer(of)
of.close()
+#------------------------------------------------------------------------
+#
+#
+#
+#------------------------------------------------------------------------
+class PlacePage(BasePage):
+
+ def __init__(self, db, title, place_handle, html_dir, src_list):
+ place = db.get_place_from_handle( place_handle)
+ BasePage.__init__(self,title)
+ page_name = os.path.join(html_dir,place.get_gramps_id()+".html")
+ of = open(page_name, "w")
+ place_name = ReportUtils.place_name(db,place_handle)
+ self.display_header(of,place_name,
+ db.get_researcher().get_name())
+ of.write(' ')
of.write('')
of.write(n)
- of.write(' ' % place.gramps_id)
+ of.write(' ' % place.gramps_id)
of.write('[%s]' % place.gramps_id)
of.write(' %s
\n' % place_name)
+
+ photolist = place.get_media_list()
+ if photolist:
+ photo_handle = photolist[0].get_reference_handle()
+ photo = db.get_object_from_handle(photo_handle)
+
+ try:
+ newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1]
+ shutil.copyfile(photo.get_path(),os.path.join(html_dir,newpath))
+ of.write('%s
\n' % _('Narrative'))
+ of.write('
\n')
+
+ noteobj = place.get_note_object()
+ if noteobj:
+ format = noteobj.get_format()
+ text = noteobj.get()
+
+ if format:
+ text = "" + "
".join(text.split("\n"))
+ else:
+ text = "
".join(text.split("\n")) + of.write('
%s
\n' % text) + + self.display_footer(of) + of.close() + #------------------------------------------------------------------------ # # @@ -403,13 +455,16 @@ class HomePage(BasePage): else: mime_type = obj.get_mime_type() if mime_type and mime_type.startswith("image"): - newpath = obj.gramps_id + os.path.splitext(obj.get_path())[1] - shutil.copyfile(obj.get_path(), - os.path.join(html_dir,newpath)) - of.write('\n') @@ -615,13 +673,16 @@ class IndividualPage(BasePage): photo_handle = photolist[0].get_reference_handle() photo = self.db.get_object_from_handle(photo_handle) - newpath = self.person.gramps_id + os.path.splitext(photo.get_path())[1] - shutil.copyfile(photo.get_path(),os.path.join(self.dirpath,newpath)) - of.write('\n') - of.write('' % newpath) - of.write('') - of.write('\n') + try: + newpath = self.person.gramps_id + os.path.splitext(photo.get_path())[1] + shutil.copyfile(photo.get_path(),os.path.join(self.dirpath,newpath)) + of.write('\n') + of.write('' % newpath) + of.write('') + of.write('\n') + except (IOError,OSError),msg: + ErrorDialog(str(msg)) of.write('\n') of.write('%s
\n' % self.sort_name) @@ -819,6 +880,8 @@ class IndividualPage(BasePage): of.write('\n') def format_event(self,event): + for sref in event.get_source_references(): + self.src_list.add(sref.get_base_handle()) descr = event.get_description() place_handle = event.get_place_handle() if place_handle: @@ -994,6 +1057,11 @@ class WebReport(Report.Report): PlaceListPage(self.database, self.title, place_list, dir_name, source_list) + + for place in place_list: + print place + PlacePage(self.database, self.title, place, dir_name, source_list) + SourcesPage(self.database,self.title, source_list, dir_name) self.progress_bar_done() @@ -1031,7 +1099,7 @@ class WebReportOptions(ReportOptions.ReportOptions): 'HTMLsplita' : 0, 'HTMLshorttree' : 1, 'HTMLimagedir' : 'images', - 'HTMLtitle' : 'My Family Tree', + 'HTMLtitle' : _('My Family Tree'), 'HTMLincid' : 0, 'HTMLidurl' : '', 'HTMLlinktidx' : 1,