* src/docgen/HtmlDoc.py: fix html template loading.
* src/ReportBase/_ReportDialog.py: fix html template loading. svn: r8120
This commit is contained in:
parent
e73aff64ed
commit
5095eb19f5
@ -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>
|
2007-02-13 Brian Matherly <brian@gramps-project.org>
|
||||||
* src/ViewManager.py: fix crash during backup on windows
|
* src/ViewManager.py: fix crash during backup on windows
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ class ReportDialog(BareReportDialog):
|
|||||||
for template in tlist:
|
for template in tlist:
|
||||||
if template != _user_template:
|
if template != _user_template:
|
||||||
self.template_combo.append_text(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
|
active_index = template_index
|
||||||
template_index = template_index + 1
|
template_index = template_index + 1
|
||||||
self.template_combo.append_text(_user_template)
|
self.template_combo.append_text(_user_template)
|
||||||
@ -608,7 +608,7 @@ class ReportDialog(BareReportDialog):
|
|||||||
if text == _user_template:
|
if text == _user_template:
|
||||||
self.template_name = self.html_fileentry.get_full_path(0)
|
self.template_name = self.html_fileentry.get_full_path(0)
|
||||||
else:
|
else:
|
||||||
self.template_name = "%s/%s" % (const.template_dir,
|
self.template_name = "%s%s%s" % (const.template_dir,os.path.sep,
|
||||||
_template_map[text])
|
_template_map[text])
|
||||||
else:
|
else:
|
||||||
self.template_name = ""
|
self.template_name = ""
|
||||||
|
@ -130,9 +130,9 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
top_add = 1
|
top_add = 1
|
||||||
bottom_add = 0
|
bottom_add = 0
|
||||||
archive = tarfile.open(self.template)
|
archive = tarfile.open(self.template)
|
||||||
|
self.map = {}
|
||||||
for tarinfo in archive:
|
for tarinfo in archive:
|
||||||
self.map[tarinfo.name] = archive.extractfile(tarinfo)
|
self.map[tarinfo.name] = archive.extractfile(tarinfo)
|
||||||
archive.close()
|
|
||||||
templateFile = self.map['template.html']
|
templateFile = self.map['template.html']
|
||||||
while 1:
|
while 1:
|
||||||
line = templateFile.readline()
|
line = templateFile.readline()
|
||||||
@ -151,6 +151,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
else:
|
else:
|
||||||
self.bottom.append(line)
|
self.bottom.append(line)
|
||||||
templateFile.close()
|
templateFile.close()
|
||||||
|
archive.close
|
||||||
|
|
||||||
if top_add == 1:
|
if top_add == 1:
|
||||||
mymsg = _("The marker '<!-- START -->' was not in the template")
|
mymsg = _("The marker '<!-- START -->' was not in the template")
|
||||||
@ -345,7 +346,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
for name in self.map.keys():
|
for name in self.map.keys():
|
||||||
if name == 'template.html':
|
if name == 'template.html':
|
||||||
continue
|
continue
|
||||||
fname = '%s/%s' % (self.base,name)
|
fname = '%s%s%s' % (self.base,os.path.sep,name)
|
||||||
try:
|
try:
|
||||||
f = open(fname, 'wb')
|
f = open(fname, 'wb')
|
||||||
f.write(self.map[name].read())
|
f.write(self.map[name].read())
|
||||||
@ -362,7 +363,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
refname = "is%s" % os.path.basename(name)
|
refname = "is%s" % os.path.basename(name)
|
||||||
|
|
||||||
if self.image_dir:
|
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:
|
else:
|
||||||
imdir = self.base
|
imdir = self.base
|
||||||
|
|
||||||
@ -374,7 +375,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
img = ImgManip.ImgManip(name)
|
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:
|
except:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user