* src/plugins/WebPage.py: Fix templates.

svn: r3906
This commit is contained in:
Alex Roitman 2005-01-12 04:16:22 +00:00
parent 4e1f122272
commit 156b885b05
2 changed files with 48 additions and 18 deletions

View File

@ -20,6 +20,8 @@
* src/PluginMgr.py: Switch to using short format names. * src/PluginMgr.py: Switch to using short format names.
* src/ReportOptions.py: Switch to using short format names. * src/ReportOptions.py: Switch to using short format names.
* src/plugins/WebPage.py: Fix templates.
2005-01-10 Martin Hawlisch <Martin.Hawlisch@gmx.de> 2005-01-10 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/EditPlace.py (EditPlace.display_references): * src/EditPlace.py (EditPlace.display_references):
Fix event and object references. Fix event and object references.

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2004 Donald N. Allingham # Copyright (C) 2000-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Pubilc License as published by # it under the terms of the GNU General Pubilc License as published by
@ -70,6 +70,8 @@ _month = [
_hline = " " # Everything is underlined, so use blank _hline = " " # Everything is underlined, so use blank
_BORN = _('b.') _BORN = _('b.')
_ext = ['.html','.htm','.php','.php3','.cgi']
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# HtmlLinkDoc # HtmlLinkDoc
@ -1346,10 +1348,17 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.linkpath.set_text(self.options_dict['HTMLidurl']) self.linkpath.set_text(self.options_dict['HTMLidurl'])
self.include_id.connect('toggled',self.show_link) self.include_id.connect('toggled',self.show_link)
self.ext = gtk.Combo()
self.ext.set_popdown_strings(['.html','.htm','.php','.php3', the_ext = self.options_dict['HTMLext']
'.cgi']) self.ext = gtk.combo_box_new_text()
#self.ext.set_active(self.options_dict['HTMLext']) index = 0
active_index = 0
for item in _ext:
self.ext.append_text(item)
if item == the_ext:
active_index = index
index = index + 1
self.ext.set_active(active_index)
self.use_alpha_links = gtk.CheckButton(alpha_links_msg) self.use_alpha_links = gtk.CheckButton(alpha_links_msg)
self.use_alpha_links.set_active(self.options_dict['HTMLlnktoalphabet']) self.use_alpha_links.set_active(self.options_dict['HTMLlnktoalphabet'])
@ -1365,19 +1374,36 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.use_n_cols.set_numeric(gtk.TRUE) self.use_n_cols.set_numeric(gtk.TRUE)
self.use_n_cols.set_value(self.options_dict['HTMLidxcol']) self.use_n_cols.set_value(self.options_dict['HTMLidxcol'])
self.ind_template = gtk.Combo()
template_list = [ Report._default_template ]
tlist = Report._template_map.keys() tlist = Report._template_map.keys()
tlist.sort() tlist.sort()
ind_template_name = self.options_dict['HTMLidxt']
self.ind_template = gtk.combo_box_new_text()
self.ind_template.append_text(Report._default_template)
template_index = 1
active_index = 0
for template in tlist: for template in tlist:
if template != Report._user_template: if template != Report._user_template:
template_list.append(template) self.ind_template.append_text(template)
template_list.append(Report._user_template) if Report._template_map[template] == ind_template_name:
self.ind_template.set_popdown_strings(template_list) active_index = template_index
self.ind_template.entry.set_editable(0) template_idex = templatex_index + 1
self.ind_template.append_text(Report._user_template)
self.ind_user_template = gnome.ui.FileEntry("HTML_Template",_("Choose File")) self.ind_user_template = gnome.ui.FileEntry("HTML_Template",_("Choose File"))
if ind_template_name and not active_index:
active_index = template_index
user_template = ind_template_name
self.ind_user_template.set_sensitive(1)
else:
user_template = ''
self.ind_user_template.set_sensitive(0) self.ind_user_template.set_sensitive(0)
if os.path.isfile(user_template):
self.ind_user_template.set_filename(user_template)
self.ind_user_template.set_modal(True)
self.ind_template.set_active(active_index)
self.add_birth_date = gtk.CheckButton(birth_date_msg) self.add_birth_date = gtk.CheckButton(birth_date_msg)
self.add_birth_date.set_active(self.options_dict['HTMLidxbirth']) self.add_birth_date.set_active(self.options_dict['HTMLidxbirth'])
@ -1395,7 +1421,7 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.mini_tree.connect('toggled',self.on_mini_tree_toggled) self.mini_tree.connect('toggled',self.on_mini_tree_toggled)
self.use_alpha_links.connect('toggled',self.on_use_alpha_links_toggled) self.use_alpha_links.connect('toggled',self.on_use_alpha_links_toggled)
self.ind_template.entry.connect('changed',self.ind_template_changed) self.ind_template.connect('changed',self.ind_template_changed)
title = _("Privacy") title = _("Privacy")
dialog.add_frame_option(title,None,self.no_private) dialog.add_frame_option(title,None,self.no_private)
@ -1433,7 +1459,7 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.options_dict['HTMLtreed'] = self.depth.get_value_as_int() self.options_dict['HTMLtreed'] = self.depth.get_value_as_int()
self.options_dict['HTMLlinktidx'] = int(self.use_link.get_active()) self.options_dict['HTMLlinktidx'] = int(self.use_link.get_active())
html_ext = unicode(self.ext.entry.get_text().strip()) html_ext = _ext[self.ext.get_active()]
if html_ext[0] == '.': if html_ext[0] == '.':
html_ext = html_ext[1:] html_ext = html_ext[1:]
self.options_dict['HTMLext'] = html_ext self.options_dict['HTMLext'] = html_ext
@ -1452,14 +1478,15 @@ class WebReportOptions(ReportOptions.ReportOptions):
photos = 2 photos = 2
self.options_dict['HTMLimg'] = photos self.options_dict['HTMLimg'] = photos
text = unicode(self.ind_template.entry.get_text()) active = self.ind_template.get_active()
text = unicode(self.ind_template.get_model()[active][0])
if Report._template_map.has_key(text): if Report._template_map.has_key(text):
if text == Report._user_template: if text == Report._user_template:
ind_template_name = dialog.ind_user_template.get_full_path(0) ind_template_name = self.ind_user_template.get_full_path(0)
else: else:
ind_template_name = "%s/%s" % (const.template_dir,Report._template_map[text]) ind_template_name = "%s/%s" % (const.template_dir,Report._template_map[text])
else: else:
ind_template_name = None ind_template_name = ""
self.options_dict['HTMLidxt'] = ind_template_name self.options_dict['HTMLidxt'] = ind_template_name
self.options_dict['HTMLlnktoalphabet'] = int(self.use_alpha_links.get_active()) self.options_dict['HTMLlnktoalphabet'] = int(self.use_alpha_links.get_active())
@ -1504,7 +1531,8 @@ class WebReportOptions(ReportOptions.ReportOptions):
self.depth.set_sensitive(obj.get_active()) self.depth.set_sensitive(obj.get_active())
def ind_template_changed(self,obj): def ind_template_changed(self,obj):
text = unicode(obj.get_text()) active = obj.get_active()
text = unicode(obj.get_model()[active][0])
if Report._template_map.has_key(text): if Report._template_map.has_key(text):
if Report._template_map[text]: if Report._template_map[text]:
self.ind_user_template.set_sensitive(0) self.ind_user_template.set_sensitive(0)