Arrange so we can now open the parent of a document (e.g. chm file instead of temp copy of html page inside chm), even when the parent is itself embedded in an archive

This commit is contained in:
Jean-Francois Dockes
2012-10-12 16:54:52 +02:00
parent 382ae1f718
commit 5add2e2384
13 changed files with 222 additions and 59 deletions
+11 -4
View File
@@ -190,7 +190,6 @@ class rclCHM:
def __init__(self, em):
self.contents = []
self.chm = chm.CHMFile()
self.currentindex = 0
self.em = em
if rclchm_catenate:
self.em.setmimetype("text/plain")
@@ -240,7 +239,7 @@ class rclCHM:
"""Open the chm file and build the contents list by extracting and
parsing the Topics object"""
self.currentindex = 0
self.currentindex = -1
self.contents = []
filename = params["filename:"]
@@ -248,8 +247,6 @@ class rclCHM:
self.em.rclog("LoadCHM failed")
return False
self.sfn = os.path.basename(filename)
#self.em.rclog("home [%s] topics [%s] title [%s]" %
# (self.chm.home, self.chm.topics, self.chm.title))
@@ -293,6 +290,16 @@ class rclCHM:
else:
return (False, "", "", rclexecm.RclExecM.eofnow)
if self.currentindex == -1:
# Return "self" doc
self.currentindex = 0
self.em.setmimetype('text/plain')
if len(self.contents) == 0:
eof = rclexecm.RclExecM.eofnext
else:
eof = rclexecm.RclExecM.noteof
return (True, "", "", eof)
if self.currentindex >= len(self.contents):
return (False, "", "", rclexecm.RclExecM.eofnow)
else: