diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8010beb20..3b8187525 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2005-07-18 Don Allingham + * src/plugins/NavWebPage.py: add media gallery navigation + * src/data/main*.css: add support for media gallery navigation + 2005-07-18 Martin Hawlisch * src/plugins/NavWebPage.py: Optimize separation of multiple families; Print out attributes; Print out family note diff --git a/gramps2/src/data/main1.css b/gramps2/src/data/main1.css index 7aa3aa594..649cafd4d 100755 --- a/gramps2/src/data/main1.css +++ b/gramps2/src/data/main1.css @@ -174,6 +174,16 @@ TABLE.infolist { } + +.img_navbar { + margin: 0; + margin-bottom: 4px; + padding: 10px; + font-size: 14px; + font-weight: bold; + text-align: center; +} + TD.category { padding: 1px; /* Defines spacing between rows */ diff --git a/gramps2/src/data/main2.css b/gramps2/src/data/main2.css index 02a20ab8b..59e6d867f 100755 --- a/gramps2/src/data/main2.css +++ b/gramps2/src/data/main2.css @@ -167,6 +167,14 @@ TABLE.infolist { /*width: 100%;*/ font-size: 14px; } +.img_navbar { + margin: 0; + margin-bottom: 4px; + padding: 10px; + font-size: 14px; + font-weight: bold; + text-align: center; +} TD.category { padding: 3px; /* Defines spacing between rows */ padding-right: 3em; diff --git a/gramps2/src/data/main3.css b/gramps2/src/data/main3.css index 534eed576..501abb920 100755 --- a/gramps2/src/data/main3.css +++ b/gramps2/src/data/main3.css @@ -165,6 +165,14 @@ TABLE.infolist { /*width: 100%;*/ font-size: 14px; } +.img_navbar { + margin: 0; + margin-bottom: 4px; + padding: 10px; + font-size: 14px; + font-weight: bold; + text-align: center; +} TD.category { padding: 4px; /* Defines spacing between rows */ padding-right: 3em; diff --git a/gramps2/src/data/main4.css b/gramps2/src/data/main4.css index 4289a5ad5..5815d0722 100755 --- a/gramps2/src/data/main4.css +++ b/gramps2/src/data/main4.css @@ -181,6 +181,14 @@ TABLE.infolist { margin-left: 2em; margin-top: 8px; } +.img_navbar { + margin: 0; + margin-bottom: 4px; + padding: 10px; + font-size: 14px; + font-weight: bold; + text-align: center; +} TD.category { margin: 0; padding: 4px; /* Defines spacing between rows */ diff --git a/gramps2/src/data/main5.css b/gramps2/src/data/main5.css index 34a52dbf5..a22e3a298 100755 --- a/gramps2/src/data/main5.css +++ b/gramps2/src/data/main5.css @@ -186,6 +186,14 @@ TABLE.infolist { margin-left: 7em; margin-right: 7em; } +.img_navbar { + margin: 0; + margin-bottom: 4px; + padding: 10px; + font-size: 14px; + font-weight: bold; + text-align: center; +} TD.category { padding: 3px; /* Defines spacing between rows */ padding-right: 3em; diff --git a/gramps2/src/plugins/NavWebPage.py b/gramps2/src/plugins/NavWebPage.py index 975a78e4a..006a7aa4b 100644 --- a/gramps2/src/plugins/NavWebPage.py +++ b/gramps2/src/plugins/NavWebPage.py @@ -116,7 +116,7 @@ class BasePage: self.private = not options.handler.options_dict['NWEBincpriv'] def copy_media(self,photo): - if photo.get_handle() != self.photo_list: + if photo.get_handle() != self.photo_list and photo.get_handle() not in self.photo_list: self.photo_list.append(photo.get_handle()) newpath = photo.gramps_id + os.path.splitext(photo.get_path())[1] if self.image_dir: @@ -494,7 +494,10 @@ class PlacePage(BasePage): #------------------------------------------------------------------------ class MediaPage(BasePage): - def __init__(self, db, title, handle, src_list, options, archive, media_list): + def __init__(self, db, title, handle, src_list, options, archive, media_list, + info): + + (prev, next, page_number, total_pages) = info photo = db.get_object_from_handle(handle) BasePage.__init__(self, title, options, archive, media_list) of = self.create_file(handle) @@ -516,6 +519,17 @@ class MediaPage(BasePage): of.write('
\n') of.write('

%s

\n' % title) + # gallery navigation + of.write('
') + if prev: + of.write('%s' % (prev,self.ext,_('Previous'))) + data = _('%(page_number)d of %(total_pages)d' % { + 'page_number' : page_number, 'total_pages' : total_pages }) + of.write('  %s  ' % data) + if next: + of.write('%s' % (next,self.ext,_('Next'))) + of.write('

\n') + mime_type = photo.get_mime_type() if mime_type and mime_type.startswith("image"): try: @@ -1551,9 +1565,19 @@ class WebReport(Report.Report): GalleryPage(self.database, self.title, source_list, self.options_class, archive, photo_list) + prev = None + total = len(photo_list) + index = 1 for photo_handle in photo_list: + if index == total: + next = None + else: + next = photo_list[index] MediaPage(self.database, self.title, photo_handle, source_list, - self.options_class, archive, photo_list) + self.options_class, archive, photo_list, + (prev, next, index, total)) + prev = photo_handle + index += 1 if archive: archive.close()