本文整理汇总了Python中exe.engine.persist.encodeObject函数的典型用法代码示例。如果您正苦于以下问题:Python encodeObject函数的具体用法?Python encodeObject怎么用?Python encodeObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了encodeObject函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
def save(self):
"""
Save the Generic iDevices to the appdata directory
"""
idevicesDir = self.config.configDir/'idevices'
if not idevicesDir.exists():
idevicesDir.mkdir()
fileOut = open(idevicesDir/'generic.data', 'wb')
fileOut.write(persist.encodeObject(self.generic))
#JR: Guardamos tambien los iDevices extendidos
fileOut = open(idevicesDir/'extended.data', 'wb')
fileOut.write(persist.encodeObject(self.extended))
示例2: doSave
def doSave(self, fileObj):
"""
Actually performs the save to 'fileObj'.
"""
zippedFile = zipfile.ZipFile(fileObj, "w", zipfile.ZIP_DEFLATED)
try:
for resourceFile in self.resourceDir.files():
zippedFile.write(unicode(resourceFile.normpath()),
resourceFile.name.encode('utf8'), zipfile.ZIP_DEFLATED)
zinfo = zipfile.ZipInfo(filename='content.data',
date_time=time.localtime()[0:6])
zinfo.external_attr = 0100644<<16L
zinfo.compress_type = zipfile.ZIP_DEFLATED
zippedFile.writestr(zinfo, encodeObject(self))
zinfo2 = zipfile.ZipInfo(filename='contentv2.xml',
date_time=time.localtime()[0:6])
zinfo2.external_attr = 0100644<<16L
zinfo2.compress_type = zipfile.ZIP_DEFLATED
zippedFile.writestr(zinfo2, encodeObjectToXML(self))
zippedFile.write(G.application.config.xulDir/'templates'/'content.xsd', 'content.xsd', zipfile.ZIP_DEFLATED)
finally:
zippedFile.close()
示例3: save
def save(self):
"""
Save the Generic iDevices to the appdata directory
"""
idevicesDir = self.config.configDir/'idevices'
if not idevicesDir.exists():
idevicesDir.mkdir()
fileOut = open(idevicesDir/'generic.data', 'wb')
fileOut.write(persist.encodeObject(self.generic))
示例4: save
def save(self):
"""
Save the Generic iDevices to the appdata directory
"""
idevicesDir = self.config.configDir/'idevices'
if not idevicesDir.exists():
idevicesDir.mkdir()
#JR: Buscamos los genericos dentro de los de fabrica, ya que generic solo contiene aquellos genericos que se muestran
allgeneric = []
for idevice in self.getFactoryIdevices():
if self.isGeneric(idevice):
allgeneric.append(idevice)
fileOut = open(idevicesDir/'allgeneric.data', 'wb')
fileOut.write(persist.encodeObject(allgeneric))
fileOut = open(idevicesDir/'showgeneric.data', 'wb')
fileOut.write(persist.encodeObject(self.generic))
#JR: Guardamos tambien los iDevices extendidos
fileOut = open(idevicesDir/'extended.data', 'wb')
fileOut.write(persist.encodeObject(self.extended))
示例5: export
def export(self, package, for_print=0):
"""
Export web site
Cleans up the previous packages pages and performs the export
"""
self.style = package.style
self.page = SinglePage("index", 1, package.root)
self.page.save(self.outputDir/"index.html", for_print)
if hasattr(package, 'exportSource') and package.exportSource and not for_print:
(G.application.config.webDir/'templates'/'content.xsd').copyfile(self.outputDir/'content.xsd')
(self.outputDir/'content.data').write_bytes(encodeObject(package))
(self.outputDir/'contentv3.xml').write_bytes(encodeObjectToXML(package))
self.copyFiles(package)
示例6: copyFiles
def copyFiles(self, package, outputDir, um_mode = False):
"""
Copy all the files used by the website.
Parameters
----------
package : Package
package that is being exported
outputDir : Path
The end directory being exported to
"""
package.resourceDir.copyfiles2(outputDir)
copy_list = package.make_system_copy_list(self.stylesDir,
self.scriptsDir, self.templatesDir,
self.imagesDir, self.cssDir, outputDir,
ustad_mobile_mode = um_mode)
WebsiteExport.run_copy_list(copy_list)
if hasattr(package, 'exportSource') and package.exportSource:
(outputDir/'content.data').write_bytes(encodeObject(package))
(outputDir/'contentv3.xml').write_bytes(encodeObjectToXML(package))
示例7: export
#.........这里部分代码省略.........
and hasInstructions
and hasMediaelement
):
isBreak = True
break
if not hasFlowplayer:
if "flowPlayer.swf" in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if "mojomagnify.js" in idevice.systemResources:
hasMagnifier = True
if not hasXspfplayer:
if "xspf_player.swf" in idevice.systemResources:
hasXspfplayer = True
if not hasGallery:
hasGallery = common.ideviceHasGallery(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 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:
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()
示例8: copyFiles
#.........这里部分代码省略.........
faviconFile = (self.imagesDir/'favicon.ico')
faviconFile.copyfile(outputDir/'favicon.ico')
# copy players for media idevices.
hasFlowplayer = False
hasMagnifier = False
hasXspfplayer = False
hasGallery = False
hasFX = False
hasSH = False
hasGames = False
hasWikipedia = False
isBreak = False
hasInstructions = False
hasMediaelement = False
hasTooltips = False
for page in self.pages:
if isBreak:
break
for idevice in page.node.idevices:
if (hasFlowplayer and hasMagnifier and hasXspfplayer and hasGallery and hasFX and hasSH and hasGames and hasWikipedia and hasInstructions and hasMediaelement and hasTooltips):
isBreak = True
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'mojomagnify.js' in idevice.systemResources:
hasMagnifier = True
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)
dT = common.getExportDocType()
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')
示例9: export
#.........这里部分代码省略.........
'imsmd_rootv1p2p1.xsd',
'adlcp_rootv1p2.xsd',
'ims_xml.xsd'), outputDir)
elif self.scormType == "scorm2004":
schemasDir = self.schemasDir/"scorm2004"
schemasDir.copylist(('adlcp_v1p3.xsd',
'adlnav_v1p3.xsd',
'adlseq_v1p3.xsd',
'datatypes.dtd',
'imscp_v1p1.xsd',
'imsssp_v1p0.xsd',
'imsss_v1p0.xsd',
'imsss_v1p0auxresource.xsd',
'imsss_v1p0control.xsd',
'imsss_v1p0delivery.xsd',
'imsss_v1p0limit.xsd',
'imsss_v1p0objective.xsd',
'imsss_v1p0random.xsd',
'imsss_v1p0rollup.xsd',
'imsss_v1p0seqrule.xsd',
'imsss_v1p0util.xsd',
'ims_xml.xsd',
'lom.xsd',
'lomCustom.xsd',
'xml.xsd',
'XMLSchema.dtd'), outputDir)
try:
import shutil, errno
shutil.copytree(schemasDir/"lom", outputDir/"lom")
except OSError as exc:
if exc.errno == errno.ENOTDIR:
shutil.copy(schemasDir/"lom", outputDir/"lom")
else: raise
# 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 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()
示例10: export
#.........这里部分代码省略.........
# copy players for media idevices.
hasFlowplayer = False
hasMagnifier = False
hasXspfplayer = False
hasGallery = False
hasWikipedia = False
isBreak = False
hasInstructions = False
hasMediaelement = False
for page in self.pages:
if isBreak:
break
for idevice in page.node.idevices:
if (
hasFlowplayer
and hasMagnifier
and hasXspfplayer
and hasGallery
and hasWikipedia
and hasInstructions
and hasMediaelement
):
isBreak = True
break
if not hasFlowplayer:
if "flowPlayer.swf" in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if "mojomagnify.js" in idevice.systemResources:
hasMagnifier = True
if not hasXspfplayer:
if "xspf_player.swf" in idevice.systemResources:
hasXspfplayer = True
if not hasGallery:
hasGallery = common.ideviceHasGallery(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 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:
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"
jsFile.copyfile(outputDir / "exe_html5.js")
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()
示例11: export
#.........这里部分代码省略.........
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'mojomagnify.js' in idevice.systemResources:
hasMagnifier = True
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 hasElpLink:
hasElpLink = common.ideviceHasElpLink(idevice,package)
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 not hasABCMusic:
hasABCMusic = common.ideviceHasABCMusic(idevice)
if hasattr(idevice, "_iDeviceDir"):
listIdevicesFiles.append((Path(idevice._iDeviceDir)/'export'))
common.exportJavaScriptIdevicesFiles(page.node.idevices, outputDir);
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)
# Add game js string to common_i18n
langGameFile = open(outputDir + '/common_i18n.js', "a")
langGameFile.write(common.getGamesJavaScriptStrings(False))
langGameFile.close()
if hasElpLink or package.get_exportElp():
# Export the elp file
currentPackagePath = Path(package.filename)
currentPackagePath.copyfile(outputDir/package.name+'.elp')
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 hasABCMusic:
pluginScripts = (self.scriptsDir/'tinymce_4/js/tinymce/plugins/abcmusic/export')
pluginScripts.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()
示例12: copyFiles
#.........这里部分代码省略.........
if (hasFlowplayer and hasMagnifier and hasXspfplayer and hasGallery and hasFX and hasSH and hasGames and hasElpLink and hasWikipedia and hasInstructions and hasMediaelement and hasTooltips and hasABCMusic):
isBreak = True
break
if not hasFlowplayer:
if 'flowPlayer.swf' in idevice.systemResources:
hasFlowplayer = True
if not hasMagnifier:
if 'mojomagnify.js' in idevice.systemResources:
hasMagnifier = True
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 hasElpLink:
hasElpLink = common.ideviceHasElpLink(idevice,package)
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 not hasABCMusic:
hasABCMusic = common.ideviceHasABCMusic(idevice)
if hasattr(idevice, "_iDeviceDir"):
listIdevicesFiles.append((Path(idevice._iDeviceDir)/'export'))
common.exportJavaScriptIdevicesFiles(page.node.idevices, outputDir);
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)
# Add game js string to common_i18n
langGameFile = open(outputDir + '/common_i18n.js', "a")
langGameFile.write(common.getGamesJavaScriptStrings(False))
langGameFile.close()
if hasElpLink or package.get_exportElp():
# Export the elp file
currentPackagePath = Path(package.filename)
currentPackagePath.copyfile(outputDir/package.name+'.elp')
if hasABCMusic:
pluginScripts = (self.scriptsDir/'tinymce_4/js/tinymce/plugins/abcmusic/export')
pluginScripts.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)
dT = common.getExportDocType()
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))
ext = 'html'
if G.application.config.cutFileName == "1":
ext = 'htm'
if package.license == "license GFDL":
# include a copy of the GNU Free Documentation Licence
(self.templatesDir/'fdl' + '.' + ext).copyfile(outputDir/'fdl' + '.' + ext)
示例13: export
#.........这里部分代码省略.........
hasInstructions = True
if not hasMediaelement:
hasMediaelement = common.ideviceHasMediaelement(idevice)
if not hasTooltips:
hasTooltips = common.ideviceHasTooltips(idevice)
if not hasABCMusic:
hasABCMusic = common.ideviceHasABCMusic(idevice)
if hasattr(idevice, "_iDeviceDir"):
listIdevicesFiles.append((Path(idevice._iDeviceDir)/'export'))
common.exportJavaScriptIdevicesFiles(page.node.idevices, outputDir);
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)
# Add game js string to common_i18n
langGameFile = open(outputDir + '/common_i18n.js', "a")
langGameFile.write(common.getGamesJavaScriptStrings(False))
langGameFile.close()
if hasElpLink or package.get_exportElp():
# Export the elp file
currentPackagePath = Path(package.filename)
currentPackagePath.copyfile(outputDir/package.name+'.elp')
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 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