本文整理汇总了Python中exe.engine.path.Path.safeSave方法的典型用法代码示例。如果您正苦于以下问题:Python Path.safeSave方法的具体用法?Python Path.safeSave怎么用?Python Path.safeSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exe.engine.path.Path
的用法示例。
在下文中一共展示了Path.safeSave方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
def save(self, filename=None, tempFile=False):
"""
Save package to disk
pass an optional filename
"""
self.tempFile = tempFile
if filename:
filename = Path(filename)
name = filename.splitpath()[1]
if not tempFile:
self.name = name.basename().splitext()[0]
elif self.filename:
filename = Path(self.filename)
else:
raise AssertionError(u'No name passed when saving a new package')
log.debug(u"Will save %s to: %s" % (self.name, filename))
if tempFile:
self.nonpersistant.remove('filename')
oldFilename, self.filename = self.filename, unicode(self.filename)
try:
filename.safeSave(self.doSave, _('SAVE FAILED!\nLast succesful save is %s.'))
finally:
self.nonpersistant.append('filename')
self.filename = oldFilename
else:
self.filename = filename
filename.safeSave(self.doSave, _('SAVE FAILED!\nLast succesful save is %s.'))
self.isChanged = False
self.updateRecentDocuments(filename)
示例2: save
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
def save(self, filename=None, tempFile=False):
if filename:
filename = Path(filename)
# If we are being given a new filename...
# Change our name to match our new filename
name = filename.splitpath()[1]
if not tempFile:
self.name = name.basename().splitext()[0]
elif self.filename:
# Otherwise use our last saved/loaded from filename
filename = Path(self.filename)
else:
# If we don't have a last saved/loaded from filename,
# raise an exception because, we need to have a new
# file passed when a brand new package is saved
raise AssertionError(u'No name passed when saving a new package')
if not tempFile:
# Update our new filename for future saves
self.filename = filename
filename.safeSave(self.doSave, _('SAVE FAILED!\nLast succesful save is %s.'))
self.isChanged = False
示例3: ScormExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
styleFiles.remove(sf)
self.styleDir.copylist(styleFiles, outputDir)
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# Copy the scripts
if self.scormType == "commoncartridge":
self.scriptsDir.copylist(('libot_drag.js',
'common.js'), outputDir)
else:
self.scriptsDir.copylist(('APIWrapper.js',
'SCOFunctions.js',
'libot_drag.js',
'common.js'), outputDir)
schemasDir = ""
if self.scormType == "scorm1.2":
schemasDir = self.schemasDir/"scorm1.2"
schemasDir.copylist(('imscp_rootv1p1p2.xsd',
'imsmd_rootv1p2p1.xsd',
'adlcp_rootv1p2.xsd',
'ims_xml.xsd'), outputDir)
elif self.scormType == "scorm2004":
schemasDir = self.schemasDir/"scorm2004"
schemasDir.copylist(('imscp_rootv1p1p2.xsd',
'imsmd_rootv1p2p1.xsd',
'adlcp_rootv1p2.xsd',
'ims_xml.xsd'), outputDir)
# copy players for media idevices.
hasFlowplayer = False
hasMagnifier = False
hasXspfplayer = False
isBreak = False
for page in self.pages:
if isBreak:
break
for idevice in page.node.idevices:
if (hasFlowplayer and hasMagnifier and hasXspfplayer):
isBreak = True
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'magnifier.swf' in idevice.systemResources:
hasMagnifier = True
if not hasXspfplayer:
if 'xspf_player.swf' in idevice.systemResources:
hasXspfplayer = True
if hasFlowplayer:
videofile = (self.templatesDir/'flowPlayer.swf')
videofile.copyfile(outputDir/'flowPlayer.swf')
if hasMagnifier:
videofile = (self.templatesDir/'magnifier.swf')
videofile.copyfile(outputDir/'magnifier.swf')
if hasXspfplayer:
videofile = (self.templatesDir/'xspf_player.swf')
videofile.copyfile(outputDir/'xspf_player.swf')
if self.scormType == "scorm1.2" or self.scormType == "scorm2004":
if package.license == "GNU Free Documentation License":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
# Zip it up!
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
# Zip up the scorm package
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile,
scormFile.basename().encode('utf8'),
ZIP_DEFLATED)
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = ScormPage(pageName, depth, child, scormType=self.scormType)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例4: IMSExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
if not hasXspfplayer:
if 'xspf_player.swf' in idevice.systemResources:
hasXspfplayer = True
if not hasGallery:
hasGallery = common.ideviceHasGallery(idevice)
if not hasFX:
hasFX = common.ideviceHasFX(idevice)
if not hasSH:
hasSH = common.ideviceHasSH(idevice)
if not hasGames:
hasGames = common.ideviceHasGames(idevice)
if not hasWikipedia:
if 'WikipediaIdevice' == idevice.klass:
hasWikipedia = True
if not hasInstructions:
if 'TrueFalseIdevice' == idevice.klass or 'MultichoiceIdevice' == idevice.klass or 'VerdaderofalsofpdIdevice' == idevice.klass or 'EleccionmultiplefpdIdevice' == idevice.klass:
hasInstructions = True
if not hasMediaelement:
hasMediaelement = common.ideviceHasMediaelement(idevice)
if not hasTooltips:
hasTooltips = common.ideviceHasTooltips(idevice)
if hasFlowplayer:
videofile = (self.templatesDir/'flowPlayer.swf')
videofile.copyfile(outputDir/'flowPlayer.swf')
controlsfile = (self.templatesDir/'flowplayer.controls.swf')
controlsfile.copyfile(outputDir/'flowplayer.controls.swf')
if hasMagnifier:
videofile = (self.templatesDir/'mojomagnify.js')
videofile.copyfile(outputDir/'mojomagnify.js')
if hasXspfplayer:
videofile = (self.templatesDir/'xspf_player.swf')
videofile.copyfile(outputDir/'xspf_player.swf')
if hasGallery:
exeLightbox = (self.scriptsDir/'exe_lightbox')
exeLightbox.copyfiles(outputDir)
if hasFX:
exeEffects = (self.scriptsDir/'exe_effects')
exeEffects.copyfiles(outputDir)
if hasSH:
exeSH = (self.scriptsDir/'exe_highlighter')
exeSH.copyfiles(outputDir)
if hasGames:
exeGames = (self.scriptsDir/'exe_games')
exeGames.copyfiles(outputDir)
if hasWikipedia:
wikipediaCSS = (self.cssDir/'exe_wikipedia.css')
wikipediaCSS.copyfile(outputDir/'exe_wikipedia.css')
if hasInstructions:
common.copyFileIfNotInStyle('panel-amusements.png', self, outputDir)
common.copyFileIfNotInStyle('stock-stop.png', self, outputDir)
if hasMediaelement:
mediaelement = (self.scriptsDir/'mediaelement')
mediaelement.copyfiles(outputDir)
if dT != "HTML5":
jsFile = (self.scriptsDir/'exe_html5.js')
jsFile.copyfile(outputDir/'exe_html5.js')
if hasTooltips:
exe_tooltips = (self.scriptsDir/'exe_tooltips')
exe_tooltips.copyfiles(outputDir)
if hasattr(package, 'exportSource') and package.exportSource:
(G.application.config.webDir/'templates'/'content.xsd').copyfile(outputDir/'content.xsd')
(outputDir/'content.data').write_bytes(encodeObject(package))
(outputDir/'contentv3.xml').write_bytes(encodeObjectToXML(package))
if package.license == "license GFDL":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
# Zip it up!
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile,
scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'outputDir' is the temporary directory that we are exporting to
before creating zip file
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = IMSPage(pageName, depth, child, metadataType=self.metadataType)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例5: ScormExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
videofile.copyfile(outputDir / "mojomagnify.js")
if hasXspfplayer:
videofile = self.templatesDir / "xspf_player.swf"
videofile.copyfile(outputDir / "xspf_player.swf")
if hasGallery:
imageGalleryCSS = self.cssDir / "exe_lightbox.css"
imageGalleryCSS.copyfile(outputDir / "exe_lightbox.css")
imageGalleryJS = self.scriptsDir / "exe_lightbox.js"
imageGalleryJS.copyfile(outputDir / "exe_lightbox.js")
self.imagesDir.copylist(
(
"exe_lightbox_close.png",
"exe_lightbox_loading.gif",
"exe_lightbox_next.png",
"exe_lightbox_prev.png",
),
outputDir,
)
if hasWikipedia:
wikipediaCSS = self.cssDir / "exe_wikipedia.css"
wikipediaCSS.copyfile(outputDir / "exe_wikipedia.css")
if hasInstructions:
common.copyFileIfNotInStyle("panel-amusements.png", self, outputDir)
common.copyFileIfNotInStyle("stock-stop.png", self, outputDir)
if hasMediaelement:
mediaelement = self.scriptsDir / "mediaelement"
mediaelement.copyfiles(outputDir)
if dT != "HTML5":
jsFile = self.scriptsDir / "exe_html5.js"
if self.scormType == "scorm1.2" or self.scormType == "scorm2004":
if package.license == "license GFDL":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir / "fdl.html").copyfile(outputDir / "fdl.html")
if hasattr(package, "scowsinglepage") and package.scowsinglepage:
page = SinglePage("singlepage_index", 1, package.root)
page.save(outputDir / "singlepage_index.html")
# Incluide eXe's icon if the Style doesn't have one
themePath = Path(G.application.config.stylesDir / package.style)
themeFavicon = themePath.joinpath("favicon.ico")
if not themeFavicon.exists():
faviconFile = self.imagesDir / "favicon.ico"
faviconFile.copyfile(outputDir / "favicon.ico")
if hasattr(package, "scowwebsite") and package.scowwebsite:
website = WebsiteExport(self.config, self.styleDir, outputDir, "website_")
website.export(package)
(self.styleDir / "nav.css").copyfile(outputDir / "nav.css")
# Incluide eXe's icon if the Style doesn't have one
themePath = Path(G.application.config.stylesDir / package.style)
themeFavicon = themePath.joinpath("favicon.ico")
if not themeFavicon.exists():
faviconFile = self.imagesDir / "favicon.ico"
faviconFile.copyfile(outputDir / "favicon.ico")
if hasattr(package, "exportSource") and package.exportSource:
(G.application.config.webDir / "templates" / "content.xsd").copyfile(outputDir / "content.xsd")
(outputDir / "content.data").write_bytes(encodeObject(package))
(outputDir / "contentv3.xml").write_bytes(encodeObjectToXML(package))
# Zip it up!
self.filename.safeSave(self.doZip, _("EXPORT FAILED!\nLast succesful export is %s."), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
# Zip up the scorm package
zipped = ZipFile(fileObj, "w")
## old method: only files could be copied:
# for scormFile in outputDir.files():
# zipped.write(scormFile,
# scormFile.basename().encode('utf8'),
# ZIP_DEFLATED)
## but some folders must be included also, so:
outputlen = len(outputDir) + 1
for base, dirs, files in os.walk(outputDir):
for file in files:
fn = os.path.join(base, file)
zipped.write(fn, fn[outputlen:].encode("utf8"), ZIP_DEFLATED)
#
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = ScormPage(pageName, depth, child, scormType=self.scormType, metadataType=self.metadataType)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例6: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = TempDirPath()
# Import the Website Page class , if the secure mode is off. If the style has it's own page class
# use that, else use the default one.
if self.styleSecureMode=="0":
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 0, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
self.copyFiles(package, outputDir)
# Zip up the website package
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually saves the zip data. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile, scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def appendPageReport(self, page, package):
if not page.node.idevices:self.report += u'"%s","%s",%d,"%s",,,,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html')
for idevice in page.node.idevices:
if not idevice.userResources:self.report += u'"%s","%s",%d,"%s","%s","%s",,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title)
for resource in idevice.userResources:
if type(resource) == Resource:
self.report += u'"%s","%s",%d,"%s","%s","%s","%s","%s","%s","%s"\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource.storageName, resource.userName, resource.path, resource.checksum)
else:
self.report += u'"%s",%d,"%s","%s","%s","%s",,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource)
def export(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
if not self.report:
outputDir = self.filename
if not outputDir.exists():
outputDir.mkdir()
示例7: Epub3Export
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
if hasWikipedia:
wikipediaCSS = (self.cssDir / 'exe_wikipedia.css')
wikipediaCSS.copyfile(contentPages / 'exe_wikipedia.css')
if hasInstructions:
common.copyFileIfNotInStyle('panel-amusements.png', self, contentPages)
common.copyFileIfNotInStyle('stock-stop.png', self, contentPages)
if hasTooltips:
exe_tooltips = (self.scriptsDir / 'exe_tooltips')
exe_tooltips.copyfiles(contentPages)
if hasABCMusic:
pluginScripts = (self.scriptsDir/'tinymce_4/js/tinymce/plugins/abcmusic/export')
pluginScripts.copyfiles(contentPages)
my_style = G.application.config.styleStore.getStyle(package.style)
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
jsFile = (self.scriptsDir / 'exe_jquery.js')
jsFile.copyfile(contentPages / 'exe_jquery.js')
else:
jsFile = (self.scriptsDir / 'exe_jquery.js')
jsFile.copyfile(contentPages / 'exe_jquery.js')
# Copy and minify CSS files
css_files = getFilesCSSToMinify('epub3', self.styleDir)
exportMinFileCSS(css_files, contentPages)
# Copy and minify JS files
js_files = getFilesJSToMinify('epub3', self.scriptsDir)
exportMinFileJS(js_files, contentPages)
# if hasattr(package, 'exportSource') and package.exportSource:
# (G.application.config.webDir / 'templates' / 'content.xsd').copyfile(outputDir / 'content.xsd')
# (outputDir / 'content.data').write_bytes(encodeObject(package))
# (outputDir / 'contentv3.xml').write_bytes(encodeObjectToXML(package))
if package.license == "license GFDL":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir / 'fdl.html').copyfile(contentPages / 'fdl.html')
# Create the nav.xhtml file
container = NavEpub3(self.pages, contentPages)
container.save()
# Create the publication file
publication = PublicationEpub3(self.config, contentPages, package, self.pages, cover)
publication.save("package.opf")
# Create the container file
container = ContainerEpub3(metainfPages)
container.save("container.xml")
# Zip it up!
self.filename.safeSave(self.doZip, _(u'EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
mimetype = outputDir / "mimetype"
zipped.write(mimetype, "mimetype", ZIP_STORED)
for epubFile in outputDir.walkfiles():
if epubFile.basename() == 'mimetype':
continue
relativePath = epubFile.basename()
parentdir = epubFile.splitpath()[0]
while (outputDir.basename() != parentdir.basename()):
relativePath = parentdir.basename() / relativePath
parentdir = parentdir.splitpath()[0]
zipped.write(epubFile,
relativePath.encode('utf8'),
compress_type=ZIP_DEFLATED)
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
pageName = node.titleShort.lower().replace(" ", u"_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = u"__"
if pageName[0] in [unicode(i) for i in range(0, 10)]:
pageName = u'_' + pageName
page = Epub3Page(pageName, depth, node)
self.pages.append(page)
for child in node.children:
self.generatePages(child, depth + 1)
示例8: IMSExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
# Export the package content
self.pages = [ IMSPage("index", 1, package.root) ]
self.generatePages(package.root, 2)
uniquifyNames(self.pages)
for page in self.pages:
page.save(outputDir)
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages)
manifest.save()
# Copy the scripts
self.scriptsDir.copylist(('libot_drag.js',
'common.js'), outputDir)
self.schemasDir.copylist(('imscp_v1p1.xsd',
'imsmd_v1p2p2.xsd',
'ims_xml.xsd'), outputDir)
# copy players for media idevices.
hasFlowplayer = False
hasMagnifier = False
hasXspfplayer = False
hasGallery = False
isBreak = False
for page in self.pages:
if isBreak:
break
for idevice in page.node.idevices:
if (hasFlowplayer and hasMagnifier and hasXspfplayer and hasGallery):
isBreak = True
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'magnifier.swf' in idevice.systemResources:
hasMagnifier = True
if not hasXspfplayer:
if 'xspf_player.swf' in idevice.systemResources:
hasXspfplayer = True
if not hasGallery:
if 'GalleryIdevice' == idevice.klass:
hasGallery = True
if hasFlowplayer:
videofile = (self.templatesDir/'flowPlayer.swf')
videofile.copyfile(outputDir/'flowPlayer.swf')
controlsfile = (self.templatesDir/'flowplayer.controls.swf')
controlsfile.copyfile(outputDir/'flowplayer.controls.swf')
if hasMagnifier:
videofile = (self.templatesDir/'magnifier.swf')
videofile.copyfile(outputDir/'magnifier.swf')
if hasXspfplayer:
videofile = (self.templatesDir/'xspf_player.swf')
videofile.copyfile(outputDir/'xspf_player.swf')
if hasGallery:
imageGalleryCSS = (self.cssDir/'exe_lightbox.css')
imageGalleryCSS.copyfile(outputDir/'exe_lightbox.css')
imageGalleryJS = (self.scriptsDir/'exe_lightbox.js')
imageGalleryJS.copyfile(outputDir/'exe_lightbox.js')
self.imagesDir.copylist(('exeGallery_actions.png', 'exeGallery_loading.gif', 'stock-insert-image.png'), outputDir)
if package.license == "GNU Free Documentation License":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
# Zip it up!
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile,
scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'outputDir' is the temporary directory that we are exporting to
before creating zip file
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = IMSPage(pageName, depth, child)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例9: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
class WebsiteExport(object):
"""
WebsiteExport will export a package as a website of HTML pages
"""
def __init__(self, config, styleDir, filename):
"""
'stylesDir' is the directory where we can copy the stylesheets from
'outputDir' is the directory that will be [over]written
with the website
"""
self.config = config
self.imagesDir = config.webDir/"images"
self.scriptsDir = config.webDir/"scripts"
self.templatesDir = config.webDir/"templates"
self.stylesDir = Path(styleDir)
self.filename = Path(filename)
self.pages = []
def exportZip(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = TempDirPath()
self.copyFiles(package, outputDir)
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 1, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually saves the zip data. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile, scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def export(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = self.filename
if not outputDir.exists():
outputDir.mkdir()
self.copyFiles(package, outputDir)
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 1, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
def copyFiles(self, package, outputDir):
"""
Copy all the files used by the website.
"""
styleFiles = [self.stylesDir/'..'/'base.css']
styleFiles += [self.stylesDir/'..'/'popup_bg.gif']
styleFiles += self.stylesDir.files("*.css")
styleFiles += self.stylesDir.files("*.jpg")
styleFiles += self.stylesDir.files("*.gif")
styleFiles += self.stylesDir.files("*.png")
styleFiles += self.stylesDir.files("*.js")
styleFiles += self.stylesDir.files("*.html")
self.stylesDir.copylist(styleFiles, outputDir)
package.resourceDir.copyfiles(outputDir)
self.scriptsDir.copylist(('libot_drag.js', 'common.js'),
outputDir)
self.templatesDir.copylist(('videoContainer.swf', 'magnifier.swf',
'xspf_player.swf'), outputDir)
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
def generatePages(self, node, depth):
"""
Recursively generate pages and store in pages member variable
for retrieving later
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
#.........这里部分代码省略.........
示例10: ScormExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
common.copyFileIfNotInStyle('stock-stop.png', self, outputDir)
if hasMediaelement:
mediaelement = (self.scriptsDir/'mediaelement')
mediaelement.copyfiles(outputDir)
if dT != "HTML5":
jsFile = (self.scriptsDir/'exe_html5.js')
if hasTooltips:
exe_tooltips = (self.scriptsDir/'exe_tooltips')
exe_tooltips.copyfiles(outputDir)
if hasABCMusic:
pluginScripts = (self.scriptsDir/'tinymce_4/js/tinymce/plugins/abcmusic/export')
pluginScripts.copyfiles(outputDir)
ext = ".html"
if G.application.config.cutFileName == "1":
ext = ".htm"
if self.scormType == "scorm1.2" or self.scormType == "scorm2004":
if package.license == "license GFDL":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl' + ext).copyfile(outputDir/'fdl' + ext)
if hasattr(package, 'scowsinglepage') and package.scowsinglepage:
page = SinglePage("singlepage_index", 1, package.root)
page.save(outputDir/"singlepage_index" + ext)
# Incluide eXe's icon if the Style doesn't have one
themePath = Path(G.application.config.stylesDir/package.style)
themeFavicon = themePath.joinpath("favicon.ico")
if not themeFavicon.exists():
faviconFile = (self.imagesDir/'favicon.ico')
faviconFile.copyfile(outputDir/'favicon.ico')
if hasattr(package, 'scowwebsite') and package.scowwebsite:
website = WebsiteExport(self.config, self.styleDir, outputDir, "website_")
website.export(package)
(self.styleDir/'nav.css').copyfile(outputDir/'nav.css')
# Incluide eXe's icon if the Style doesn't have one
themePath = Path(G.application.config.stylesDir/package.style)
themeFavicon = themePath.joinpath("favicon.ico")
if not themeFavicon.exists():
faviconFile = (self.imagesDir/'favicon.ico')
faviconFile.copyfile(outputDir/'favicon.ico')
if hasattr(package, 'exportSource') and package.exportSource:
(G.application.config.webDir/'templates'/'content.xsd').copyfile(outputDir/'content.xsd')
(outputDir/'content.data').write_bytes(encodeObject(package))
(outputDir/'contentv3.xml').write_bytes(encodeObjectToXML(package))
# Zip it up!
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
return modifiedMetaData
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
# Zip up the scorm package
zipped = ZipFile(fileObj, "w")
## old method: only files could be copied:
# for scormFile in outputDir.files():
# zipped.write(scormFile,
# scormFile.basename().encode('utf8'),
# ZIP_DEFLATED)
## but some folders must be included also, so:
outputlen = len(outputDir) + 1
for base, dirs, files in os.walk(outputDir):
for file in files:
fn = os.path.join(base, file)
zipped.write(fn, fn[outputlen:].encode('utf8'), ZIP_DEFLATED)
#
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = ScormPage(pageName, depth, child, scormType=self.scormType, metadataType=self.metadataType)
self.pages.append(page)
self.generatePages(child, depth + 1)
def hasUncutResources(self):
"""
Check if any of the resources in the exported package has an uncut filename
"""
for page in self.pages:
for idevice in page.node.idevices:
for resource in idevice.userResources:
if type(resource) == Resource and len(resource.storageName) > 12:
return True
return False
示例11: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
def exportZip(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = TempDirPath()
# Import the Website Page class , if the secure mode is off. If the style has it's own page class
# use that, else use the default one.
if self.styleSecureMode=="0":
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 0, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
self.copyFiles(package, outputDir)
# Zip up the website package
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually saves the zip data. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile, scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def appendPageReport(self, page, package):
if not page.node.idevices:self.report += u'"%s","%s",%d,"%s",,,,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html')
for idevice in page.node.idevices:
if not idevice.userResources:self.report += u'"%s","%s",%d,"%s","%s","%s",,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title)
for resource in idevice.userResources:
if type(resource) == Resource:
self.report += u'"%s","%s",%d,"%s","%s","%s","%s","%s","%s","%s"\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource.storageName, resource.userName, resource.path, resource.checksum)
else:
self.report += u'"%s",%d,"%s","%s","%s","%s",,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource)
def export(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
if not self.report:
outputDir = self.filename
if not outputDir.exists():
outputDir.mkdir()
示例12: ScormExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
#.........这里部分代码省略.........
hasXspfplayer = False
hasGallery = False
isBreak = False
for page in self.pages:
if isBreak:
break
for idevice in page.node.idevices:
if (hasFlowplayer and hasMagnifier and hasXspfplayer and hasGallery):
isBreak = True
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'magnifier.swf' in idevice.systemResources:
hasMagnifier = True
if not hasXspfplayer:
if 'xspf_player.swf' in idevice.systemResources:
hasXspfplayer = True
if not hasGallery:
if 'GalleryIdevice' == idevice.klass:
hasGallery = True
if hasFlowplayer:
videofile = (self.templatesDir/'flowPlayer.swf')
videofile.copyfile(outputDir/'flowPlayer.swf')
controlsfile = (self.templatesDir/'flowplayer.controls.swf')
controlsfile.copyfile(outputDir/'flowplayer.controls.swf')
if hasMagnifier:
videofile = (self.templatesDir/'magnifier.swf')
videofile.copyfile(outputDir/'magnifier.swf')
if hasXspfplayer:
videofile = (self.templatesDir/'xspf_player.swf')
videofile.copyfile(outputDir/'xspf_player.swf')
if hasGallery:
imageGalleryCSS = (self.cssDir/'exe_lightbox.css')
imageGalleryCSS.copyfile(outputDir/'exe_lightbox.css')
imageGalleryJS = (self.scriptsDir/'exe_lightbox.js')
imageGalleryJS.copyfile(outputDir/'exe_lightbox.js')
self.imagesDir.copylist(('exeGallery_actions.png', 'exeGallery_loading.gif', 'stock-insert-image.png'), outputDir)
if self.scormType == "scorm1.2" or self.scormType == "scorm2004":
if package.license == "GNU Free Documentation License":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
if hasattr(package, 'scowsinglepage') and package.scowsinglepage:
page = SinglePage("singlepage_index", 1, package.root)
page.save(outputDir/"singlepage_index.html")
if hasattr(package, 'scowwebsite') and package.scowwebsite:
website = WebsiteExport(self.config, self.styleDir, outputDir, "website_")
website.export(package)
(self.styleDir/'nav.css').copyfile(outputDir/'nav.css')
if hasattr(package, 'scowsource') and package.scowsource:
(G.application.config.webDir/'templates'/'content.xsd').copyfile(outputDir/'content.xsd')
(outputDir/'content.data').write_bytes(encodeObject(package))
(outputDir/'contentv2.xml').write_bytes(encodeObjectToXML(package))
# Zip it up!
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
# Zip up the scorm package
zipped = ZipFile(fileObj, "w")
## old method: only files could be copied:
# for scormFile in outputDir.files():
# zipped.write(scormFile,
# scormFile.basename().encode('utf8'),
# ZIP_DEFLATED)
## but some folders must be included also, so:
outputlen = len(outputDir) + 1
for base, dirs, files in os.walk(outputDir):
for file in files:
fn = os.path.join(base, file)
zipped.write(fn, fn[outputlen:].encode('utf8'), ZIP_DEFLATED)
#
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = ScormPage(pageName, depth, child, scormType=self.scormType, metadataType=self.metadataType)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例13: ScormExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
class ScormExport(object):
"""
Exports an eXe package as a SCORM package
"""
def __init__(self, config, styleDir, filename, scormType):
"""
Initialize
'styleDir' is the directory from which we will copy our style sheets
(and some gifs)
"""
self.config = config
self.imagesDir = config.webDir/"images"
self.scriptsDir = config.webDir/"scripts"
self.templatesDir = config.webDir/"templates"
self.styleDir = Path(styleDir)
self.filename = Path(filename)
self.pages = []
self.hasForum = False
self.scormType = scormType
def export(self, package):
"""
Export SCORM package
"""
outputDir = TempDirPath()
styleFiles = [self.styleDir/'..'/'base.css']
styleFiles += [self.styleDir/'..'/'popup_bg.gif']
styleFiles += self.styleDir.files("*.css")
if "nav.css" in styleFiles:
styleFiles.remove("nav.css")
styleFiles += self.styleDir.files("*.jpg")
styleFiles += self.styleDir.files("*.gif")
styleFiles += self.styleDir.files("*.png")
styleFiles += self.styleDir.files("*.js")
styleFiles += self.styleDir.files("*.html")
self.styleDir.copylist(styleFiles, outputDir)
package.resourceDir.copyfiles(outputDir)
self.pages = [ ScormPage("index", 1, package.root) ]
self.generatePages(package.root, 2)
uniquifyNames(self.pages)
for page in self.pages:
page.save(outputDir)
if not self.hasForum:
for idevice in page.node.idevices:
if hasattr(idevice, "isForum"):
if idevice.forum.lms.lms == "moodle":
self.hasForum = True
break
manifest = Manifest(self.config, outputDir, package, self.pages, self.scormType)
manifest.save("imsmanifest.xml")
if self.hasForum:
manifest.save("discussionforum.xml")
self.scriptsDir.copylist(('APIWrapper.js',
'imscp_rootv1p1p2.xsd',
'imsmd_rootv1p2p1.xsd',
'ims_xml.xsd',
'adlcp_rootv1p2.xsd',
'SCOFunctions.js',
'libot_drag.js',
'common.js'), outputDir)
self.templatesDir.copylist(('videoContainer.swf', 'magnifier.swf',
'xspf_player.swf'),outputDir)
(self.templatesDir/'fdl.html').copyfile(outputDir/'fdl.html')
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually does the zipping of the file. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile,
scormFile.basename().encode('utf8'),
ZIP_DEFLATED)
zipped.close()
def generatePages(self, node, depth):
"""
Recursive function for exporting a node.
'node' is the node that we are making a page for
'depth' is the number of ancestors that the page has +1 (ie. root is 1)
"""
for child in node.children:
pageName = child.titleShort.lower().replace(" ", "_")
pageName = re.sub(r"\W", "", pageName)
if not pageName:
pageName = "__"
page = ScormPage(pageName, depth, child)
self.pages.append(page)
self.generatePages(child, depth + 1)
示例14: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
class WebsiteExport(object):
"""
WebsiteExport will export a package as a website of HTML pages
"""
def __init__(self, config, styleDir, filename, prefix="", report=False):
"""
'stylesDir' is the directory where we can copy the stylesheets from
'outputDir' is the directory that will be [over]written
with the website
"""
self.config = config
self.imagesDir = config.webDir/"images"
self.scriptsDir = config.webDir/"scripts"
self.cssDir = config.webDir/"css"
self.templatesDir = config.webDir/"templates"
self.stylesDir = Path(styleDir)
self.filename = Path(filename)
self.pages = []
self.prefix = prefix
self.report = report
self.styleSecureMode = config.styleSecureMode
def exportZip(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = TempDirPath()
# Import the Website Page class , if the secure mode is off. If the style has it's own page class
# use that, else use the default one.
if self.styleSecureMode=="0":
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 0, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
self.copyFiles(package, outputDir)
# Zip up the website package
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually saves the zip data. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile, scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def appendPageReport(self, page, package):
if not page.node.idevices:self.report += u'"%s","%s",%d,"%s",,,,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html')
for idevice in page.node.idevices:
if not idevice.userResources:self.report += u'"%s","%s",%d,"%s","%s","%s",,,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title)
for resource in idevice.userResources:
if type(resource) == Resource:
self.report += u'"%s","%s",%d,"%s","%s","%s","%s","%s","%s","%s"\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource.storageName, resource.userName, resource.path, resource.checksum)
else:
self.report += u'"%s",%d,"%s","%s","%s","%s",,,\n' % (package.filename,page.node.title, page.depth, page.name + '.html', idevice.klass, idevice.title, resource)
def export(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
if not self.report:
outputDir = self.filename
if not outputDir.exists():
outputDir.mkdir()
# Import the Website Page class. If the style has it's own page class
# use that, else use the default one.
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage(self.prefix + "index", 0, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
#.........这里部分代码省略.........
示例15: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import safeSave [as 别名]
class WebsiteExport(object):
"""
WebsiteExport will export a package as a website of HTML pages
"""
def __init__(self, config, styleDir, filename, prefix=""):
"""
'stylesDir' is the directory where we can copy the stylesheets from
'outputDir' is the directory that will be [over]written
with the website
"""
self.config = config
self.imagesDir = config.webDir/"images"
self.scriptsDir = config.webDir/"scripts"
self.cssDir = config.webDir/"css"
self.templatesDir = config.webDir/"templates"
self.stylesDir = Path(styleDir)
self.filename = Path(filename)
self.pages = []
self.prefix = prefix
def exportZip(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = TempDirPath()
# Import the Website Page class. If the style has it's own page class
# use that, else use the default one.
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage("index", 1, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
self.copyFiles(package, outputDir)
# Zip up the website package
self.filename.safeSave(self.doZip, _('EXPORT FAILED!\nLast succesful export is %s.'), outputDir)
# Clean up the temporary dir
outputDir.rmtree()
def doZip(self, fileObj, outputDir):
"""
Actually saves the zip data. Called by 'Path.safeSave'
"""
zipped = ZipFile(fileObj, "w")
for scormFile in outputDir.files():
zipped.write(scormFile, scormFile.basename().encode('utf8'), ZIP_DEFLATED)
zipped.close()
def export(self, package):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
outputDir = self.filename
if not outputDir.exists():
outputDir.mkdir()
# Import the Website Page class. If the style has it's own page class
# use that, else use the default one.
if (self.stylesDir/"websitepage.py").exists():
global WebsitePage
module = imp.load_source("websitepage",
self.stylesDir/"websitepage.py")
WebsitePage = module.WebsitePage
self.pages = [ WebsitePage(self.prefix + "index", 1, package.root) ]
self.generatePages(package.root, 1)
uniquifyNames(self.pages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
thisPage.save(outputDir, prevPage, None, self.pages)
if self.prefix == "":
self.copyFiles(package, outputDir)
#.........这里部分代码省略.........