From 17ed93108d80523e27db352663fd7f0f8a46867a Mon Sep 17 00:00:00 2001 From: Martin Hawlisch Date: Thu, 14 Jul 2005 20:50:16 +0000 Subject: [PATCH] * src/plugins/NavWebPage.py: Added display_note_object and display_first_image_as_thumbnail to BasePage; PlacePage and IndividualPage use this now. svn: r4931 --- gramps2/ChangeLog | 5 ++ gramps2/src/plugins/NavWebPage.py | 93 ++++++++++++------------------- 2 files changed, 41 insertions(+), 57 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index dce272090..4d062a5bc 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-07-14 Martin Hawlisch + * src/plugins/NavWebPage.py: Added display_note_object and + display_first_image_as_thumbnail to BasePage; PlacePage and + IndividualPage use this now. + 2005-07-14 Don Allingham * src/plugins/NavWebPage.py: wrap content with div, fix encoding problems diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index bdb9130b1..c22021f13 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -200,6 +200,37 @@ class BasePage: of.write(' \n') of.write('
\n') + def display_first_image_as_thumbnail( self, of, db, photolist=None): + if not photolist: + return + + photo_handle = photolist[0].get_reference_handle() + photo = db.get_object_from_handle(photo_handle) + + try: + newpath = self.copy_media(photo) + of.write('
\n') + of.write('' % newpath) + of.write('') + of.write('
\n') + except (IOError,OSError),msg: + ErrorDialog(str(msg)) + + def display_note_object(self,of,noteobj=None): + if not noteobj: + return + of.write('

%s

\n' % _('Narrative')) + of.write('
\n') + format = noteobj.get_format() + text = noteobj.get() + + if format: + text = u"
" + u"
".join(text.split("\n")) + else: + text = u"

".join(text.split("\n")) + of.write('

%s

\n' % text) + #------------------------------------------------------------------------ # # @@ -335,6 +366,8 @@ class PlacePage(BasePage): self.display_header(of,place_name, db.get_researcher().get_name()) + self.display_first_image_as_thumbnail(of, db, place.get_media_list()) + of.write('
\n') of.write('

%s

\n' % place_name) of.write('\n') of.write('\n') - photolist = place.get_media_list() - if photolist: - photo_handle = photolist[0].get_reference_handle() - photo = db.get_object_from_handle(photo_handle) - - try: - newpath = self.copy_media(photo) - of.write('
\n') - of.write('' % newpath) - of.write('') - of.write('
\n') - except (IOError,OSError),msg: - ErrorDialog(str(msg)) - # TODO: Add more information - noteobj = place.get_note_object() - if noteobj: - of.write('

%s

\n' % _('Narrative')) - of.write('
\n') - format = noteobj.get_format() - text = noteobj.get() - - if format: - text = u"
" + u"
".join(text.split("\n")) - else: - text = u"

".join(text.split("\n")) - of.write('

%s

\n' % text) + self.display_note_object(of, place.get_note_object()) self.display_footer(of) self.close_file(of) @@ -693,7 +700,7 @@ class IndividualPage(BasePage): self.display_ind_general(of) self.display_ind_events(of) self.display_ind_relationships(of) - self.display_ind_narrative(of) + self.display_note_object(of, self.person.get_note_object()) self.display_ind_sources(of) self.display_ind_pedigree(of) self.display_footer(of) @@ -775,20 +782,7 @@ class IndividualPage(BasePage): of.write('\n\n
\n') def display_ind_general(self,of): - photolist = self.person.get_media_list() - if photolist: - photo_handle = photolist[0].get_reference_handle() - photo = self.db.get_object_from_handle(photo_handle) - - try: - newpath = self.copy_media(photo) - of.write('
\n') - of.write('' % newpath) - of.write('') - of.write('
\n') - except (IOError,OSError),msg: - ErrorDialog(str(msg)) + self.display_first_image_as_thumbnail(of, self.db, self.person.get_media_list()) of.write('
\n') of.write('

%s

\n' % self.sort_name) @@ -843,21 +837,6 @@ class IndividualPage(BasePage): of.write('\n') of.write('\n') - def display_ind_narrative(self,of): - noteobj = self.person.get_note_object() - if noteobj: - of.write('

%s

\n' % _('Narrative')) - of.write('
\n') - format = noteobj.get_format() - text = noteobj.get() - - if format: - text = u"
" + u"
".join(text.split("\n")) - else: - text = u"

".join(text.split("\n")) - of.write('

%s

\n' % text) - - def display_parent(self,of,handle,title): use_link = handle in self.ind_list person = self.db.get_person_from_handle(handle)