* src/docgen/HtmlDoc.py: fix html template loading.

* src/ReportBase/_ReportDialog.py: fix html template loading.

svn: r8120
This commit is contained in:
Brian Matherly 2007-02-15 03:18:03 +00:00
parent e73aff64ed
commit 5095eb19f5
3 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,7 @@
2007-02-14 Brian Matherly <brian@gramps-project.org>
* src/docgen/HtmlDoc.py: fix html template loading.
* src/ReportBase/_ReportDialog.py: fix html template loading.
2007-02-13 Brian Matherly <brian@gramps-project.org>
* src/ViewManager.py: fix crash during backup on windows

View File

@ -457,7 +457,7 @@ class ReportDialog(BareReportDialog):
for template in tlist:
if template != _user_template:
self.template_combo.append_text(template)
if _template_map[template] == template_name:
if _template_map[template] == os.path.basename(template_name):
active_index = template_index
template_index = template_index + 1
self.template_combo.append_text(_user_template)
@ -608,7 +608,7 @@ class ReportDialog(BareReportDialog):
if text == _user_template:
self.template_name = self.html_fileentry.get_full_path(0)
else:
self.template_name = "%s/%s" % (const.template_dir,
self.template_name = "%s%s%s" % (const.template_dir,os.path.sep,
_template_map[text])
else:
self.template_name = ""

View File

@ -130,9 +130,9 @@ class HtmlDoc(BaseDoc.BaseDoc):
top_add = 1
bottom_add = 0
archive = tarfile.open(self.template)
self.map = {}
for tarinfo in archive:
self.map[tarinfo.name] = archive.extractfile(tarinfo)
archive.close()
templateFile = self.map['template.html']
while 1:
line = templateFile.readline()
@ -151,6 +151,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
else:
self.bottom.append(line)
templateFile.close()
archive.close
if top_add == 1:
mymsg = _("The marker '<!-- START -->' was not in the template")
@ -345,7 +346,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
for name in self.map.keys():
if name == 'template.html':
continue
fname = '%s/%s' % (self.base,name)
fname = '%s%s%s' % (self.base,os.path.sep,name)
try:
f = open(fname, 'wb')
f.write(self.map[name].read())
@ -362,7 +363,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
refname = "is%s" % os.path.basename(name)
if self.image_dir:
imdir = "%s/%s" % (self.base,self.image_dir)
imdir = '%s%s%s' % (self.base,os.path.sep,self.image_dir)
else:
imdir = self.base
@ -374,7 +375,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
try:
img = ImgManip.ImgManip(name)
img.jpg_thumbnail("%s/%s" % (imdir,refname),size,size)
img.jpg_thumbnail("%s%s%s" % (imdir,os.path.sep,refname),size,size)
except:
return