Connected maximuum image sizes to include media option above it. Fixed some code on year_navigation() in WebCal.

svn: r12557
This commit is contained in:
Rob G. Healey 2009-05-21 07:14:59 +00:00
parent b282953be5
commit 316b997e6d
2 changed files with 43 additions and 21 deletions

View File

@ -3486,9 +3486,22 @@ class NavWebOptions(MenuReportOptions):
footernote.set_help( _("A note to be used as the page footer")) footernote.set_help( _("A note to be used as the page footer"))
menu.add_option(category_name, "footernote", footernote) menu.add_option(category_name, "footernote", footernote)
gallery = BooleanOption(_("Include images and media objects"), True) self.__gallery = BooleanOption(_("Include images and media objects"), True)
gallery.set_help(_('Whether to include a gallery of media objects')) self.__gallery.set_help(_('Whether to include a gallery of media objects'))
menu.add_option(category_name, 'gallery', gallery) menu.add_option(category_name, 'gallery', self.__gallery)
self.__gallery.connect('value-changed', self.__gallery_changed)
self.__maxinitialimagewidth = NumberOption(_("Max width of initial image"), _DEFAULT_MAX_IMG_WIDTH, 0, 2000)
self.__maxinitialimagewidth.set_help(_("This allows you to set the maximum width "
"of the image shown on the media page. Set to 0 for no limit."))
menu.add_option(category_name, 'maxinitialimagewidth', self.__maxinitialimagewidth)
self.__maxinitialimageheight = NumberOption(_("Max height of initial image"), _DEFAULT_MAX_IMG_HEIGHT, 0, 2000)
self.__maxinitialimageheight.set_help(_("This allows you to set the maximum height "
"of the image shown on the media page. Set to 0 for no limit."))
menu.add_option(category_name, 'maxinitialimageheight', self.__maxinitialimageheight)
self.__gallery_changed()
incdownload = BooleanOption(_("Include download page"), False) incdownload = BooleanOption(_("Include download page"), False)
incdownload.set_help(_('Whether to include a database download option')) incdownload.set_help(_('Whether to include a database download option'))
@ -3498,17 +3511,6 @@ class NavWebOptions(MenuReportOptions):
nogid.set_help(_('Whether to include the Gramps ID of objects')) nogid.set_help(_('Whether to include the Gramps ID of objects'))
menu.add_option(category_name, 'nogid', nogid) menu.add_option(category_name, 'nogid', nogid)
self.__maxinitialimagewidth = NumberOption(_("Max width of initial image"), _DEFAULT_MAX_IMG_WIDTH, 0, 2000)
self.__maxinitialimagewidth.set_help(_("This allows you to set the maximum width "
"of the image shown on the media page. Set to 0 for no limit."))
menu.add_option(category_name, 'maxinitialimagewidth',
self.__maxinitialimagewidth)
self.__maxinitialimageheight = NumberOption(_("Max height of initial image"), _DEFAULT_MAX_IMG_HEIGHT, 0, 2000)
self.__maxinitialimageheight.set_help(_("This allows you to set the maximum height "
"of the image shown on the media page. Set to 0 for no limit."))
menu.add_option(category_name, 'maxinitialimageheight',
self.__maxinitialimageheight)
def __add_privacy_options(self, menu): def __add_privacy_options(self, menu):
""" """
Options on the "Privacy" tab. Options on the "Privacy" tab.
@ -3626,6 +3628,18 @@ class NavWebOptions(MenuReportOptions):
""" """
self.__graphgens.set_available(self.__graph.get_value()) self.__graphgens.set_available(self.__graph.get_value())
def __gallery_changed(self):
"""
Handles the changing nature of gallery
"""
if self.__gallery.get_value() == False:
self.__maxinitialimagewidth.set_available(False)
self.__maxinitialimageheight.set_available(False)
else:
self.__maxinitialimagewidth.set_available(True)
self.__maxinitialimageheight.set_available(True)
def __living_changed(self): def __living_changed(self):
""" """
Handle a change in the living option Handle a change in the living option

View File

@ -522,10 +522,13 @@ class WebCalReport(Report):
# figure out number of rows # figure out number of rows
nrows = get_num_of_rows(num_years, years_in_row) nrows = get_num_of_rows(num_years, years_in_row)
for rows in range(0, nrows): # begin year division and table
yearnav = Html('div', id="navigation") yearnav = Html('div', id="navigation")
year_table = Html('table')
ul = Html('ul') for rows in range(0, nrows):
tabrow = Html('tr')
unordered = Html('ul')
cols = 1 cols = 1
while (cols <= years_in_row and cal_year <= self.end_year): while (cols <= years_in_row and cal_year <= self.end_year):
url = '' url = ''
@ -544,7 +547,7 @@ class WebCalReport(Report):
# Figure out if we need <li class="CurrentSection"> or just plain <li> # Figure out if we need <li class="CurrentSection"> or just plain <li>
cs = str(cal_year) == currentsection and 'class="CurrentSection"' or '' cs = str(cal_year) == currentsection and 'class="CurrentSection"' or ''
ul += Html('li', attr=cs ,inline=True) + ( unordered += Html('li', attr=cs ,inline=True) + (
# create hyperlink # create hyperlink
Html('a', str(cal_year), href = url,inline=True) Html('a', str(cal_year), href = url,inline=True)
@ -556,8 +559,14 @@ class WebCalReport(Report):
# increase calendar year # increase calendar year
cal_year += 1 cal_year += 1
# add ul to yearnav # add unordered list to table row
yearnav += ul tabrow += unordered
# close row and add to table
year_table += tabrow
# close table and add to year division
yearnav += year_table
# return yearnav to its caller # return yearnav to its caller
return yearnav return yearnav
@ -1312,7 +1321,6 @@ class WebCalReport(Report):
self.holidays = {} self.holidays = {}
# get the information, zero is equal to None # get the information, zero is equal to None
print self.country
if self.country != 0: if self.country != 0:
self.__get_holidays(cal_year) self.__get_holidays(cal_year)