本文整理汇总了Python中exe.export.pages.uniquifyNames函数的典型用法代码示例。如果您正苦于以下问题:Python uniquifyNames函数的具体用法?Python uniquifyNames怎么用?Python uniquifyNames使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uniquifyNames函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: exportZip
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()
开发者ID:kohnle-lernmodule,项目名称:palama,代码行数:35,代码来源:websiteexport.py
示例2: export
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)
开发者ID:kohnle-lernmodule,项目名称:palama,代码行数:33,代码来源:websiteexport.py
示例3: export
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()
WebsiteExport.current_package_name = package.name
WebsiteExport.current_xapi_prefix = \
EXETinCan.get_tincan_prefix_for_pkg(package)
WebsiteExport.current_package_title = \
package.title
# 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)
prevPage = None
thisPage = self.pages[0]
if self.report:
self.report = u'"%s","%s","%s","%s","%s","%s","%s","%s","%s","%s"\n' % ('File','Page Name', 'Level', 'Page File Name', 'Idevice Type', 'Idevice Title', 'Resource File Name', 'Resource User Name', 'Resource Path', 'Resource Checksum')
self.appendPageReport(thisPage,package)
for nextPage in self.pages[1:]:
if self.report:
self.appendPageReport(nextPage,package)
else:
thisPage.save(outputDir, prevPage, nextPage, self.pages)
prevPage = thisPage
thisPage = nextPage
if not self.report:
thisPage.save(outputDir, prevPage, None, self.pages)
if self.prefix == "":
self.copyFiles(package, outputDir)
else:
self.filename.write_text(self.report, 'utf-8')
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:51,代码来源:websiteexport.py
示例4: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# copy the package's resource files, only non existant in outputDir
# outputDirFiles = outputDir.files()
# for rfile in package.resourceDir.files():
# if rfile not in outputDirFiles:
# rfile.copy(outputDir)
# copy the package's resource files, only indexed in package.resources
# for md5 in package.resources.values():
# for resource in md5:
# resource.path.copy(outputDir)
# Export the package content
self.pages = [ ScormPage("index", 1, package.root,
scormType=self.scormType, metadataType=self.metadataType) ]
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
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages, self.scormType, self.metadataType)
manifest.save("imsmanifest.xml")
if self.hasForum:
manifest.save("discussionforum.xml")
# Copy the style sheet files to the output dir
# But not nav.css
styleFiles = [self.styleDir/'..'/'base.css']
styleFiles += [self.styleDir/'..'/'popup_bg.gif']
styleFiles += [f for f in self.styleDir.files("*.css")
if f.basename() <> "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")
styleFiles += self.styleDir.files("*.ttf")
styleFiles += self.styleDir.files("*.eot")
styleFiles += self.styleDir.files("*.otf")
styleFiles += self.styleDir.files("*.woff")
# FIXME for now, only copy files referenced in Common Cartridge
# this really should apply to all exports, but without a manifest
# of the files needed by an included stylesheet it is too restrictive
if self.scormType == "commoncartridge":
for sf in styleFiles[:]:
if sf.basename() not in manifest.dependencies:
styleFiles.remove(sf)
self.styleDir.copylist(styleFiles, outputDir)
# Copy the scripts
if self.scormType == "commoncartridge":
self.scriptsDir.copylist(('libot_drag.js',
'common.js'), outputDir)
if self.scormType == "scorm2004":
self.scriptsDir.copylist(('AC_RunActiveContent.js',
'SCORM_API_wrapper.js',
'SCOFunctions.js',
'libot_drag.js',
'common.js'), outputDir)
if self.scormType != "commoncartridge" and self.scormType != "scorm2004":
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(('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',
#.........这里部分代码省略.........
开发者ID:manamani,项目名称:iteexe,代码行数:101,代码来源:scormexport.py
示例5: export
def export(self, package):
"""
Export epub 3 package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
"""
fileDir = outputDir/"META-INF"
fileDir.mkdir()
fileDir = outputDir/"Content"
fileDir.mkdir()
"""
metainfPages = Path(outputDir.abspath() + "/META-INF")
# metainfPages = outputDir/'META-INF'
metainfPages.mkdir()
contentPages = Path(outputDir.abspath() + "/EPUB")
# contentPages = outputDir/'Content'
contentPages.mkdir()
# print contentPages.abspath()
# print outputDir.abspath()
# Export the package content
self.pages = [Epub3Cover("cover", 1, package.root)]
self.generatePages(package.root, 2)
uniquifyNames(self.pages)
cover = None
for page in self.pages:
page.save(contentPages)
if hasattr(page, "cover"):
cover = page.cover
# Create mimetype file
mimetypeFile = open(outputDir.abspath() + "/mimetype", "w")
mimetypeFile.write("application/epub+zip")
mimetypeFile.close()
# Copy the style sheet files to the output dir
# But not nav.css
styleFiles = [self.styleDir / ".." / "popup_bg.gif"]
styleFiles += [f for f in self.styleDir.files("*.css") if f.basename() != "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")
styleFiles += self.styleDir.files("*.ttf")
styleFiles += self.styleDir.files("*.eot")
styleFiles += self.styleDir.files("*.otf")
styleFiles += self.styleDir.files("*.woff")
# FIXME for now, only copy files referenced in Common Cartridge
# this really should apply to all exports, but without a manifest
# of the files needed by an included stylesheet it is too restrictive
package.resourceDir.copyfiles(contentPages)
self.styleDir.copylist(styleFiles, contentPages)
listCSSFiles = getFilesCSSToMinify("epub3", self.styleDir)
exportMinFileCSS(listCSSFiles, outputDir)
listFiles = []
listOutFiles = []
listFiles += [self.scriptsDir / "common.js"]
listOutFiles += [outputDir / "common.js"]
# 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
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
):
isBreak = True
break
if not hasFlowplayer:
#.........这里部分代码省略.........
开发者ID:exelearning,项目名称:iteexe,代码行数:101,代码来源:epub3export.py
示例6: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
self.metadataType = package.exportMetadataType
# Copy the style files to the output dir
# But not nav.css
styleFiles = [self.styleDir/'..'/'popup_bg.gif']
styleFiles += self.styleDir.files("*.*")
if "nav.css" in styleFiles:
styleFiles.remove("nav.css")
self.styleDir.copylist(styleFiles, outputDir)
# copy the package's resource files
for resourceFile in package.resourceDir.walkfiles():
file = package.resourceDir.relpathto(resourceFile)
if ("/" in file):
Dir = Path(outputDir/file[:file.rindex("/")])
if not Dir.exists():
Dir.makedirs()
resourceFile.copy(outputDir/Dir)
else:
resourceFile.copy(outputDir)
listCSSFiles=getFilesCSSToMinify('ims', self.styleDir)
exportMinFileCSS(listCSSFiles, outputDir)
# Export the package content
self.pages = [ IMSPage("index", 1, package.root,
metadataType=self.metadataType) ]
self.generatePages(package.root, 2)
uniquifyNames(self.pages)
for page in self.pages:
page.save(outputDir, self.pages)
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages, self.metadataType)
manifest.save("imsmanifest.xml")
# Create lang file
langGameFile = open(outputDir + '/common_i18n.js', "w")
langGameFile.write(common.getJavaScriptStrings(False))
langGameFile.close()
# jQuery
my_style = G.application.config.styleStore.getStyle(page.node.package.style)
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
jsFile = (self.scriptsDir/'exe_jquery.js')
jsFile.copyfile(outputDir/'exe_jquery.js')
else:
jsFile = (self.scriptsDir/'exe_jquery.js')
jsFile.copyfile(outputDir/'exe_jquery.js')
dT = common.getExportDocType()
if dT == "HTML5":
jsFile = (self.scriptsDir/'exe_html5.js')
jsFile.copyfile(outputDir/'exe_html5.js')
listFiles=getFilesJSToMinify('ims', self.scriptsDir)
exportMinFileJS(listFiles, outputDir)
self.schemasDir.copylist(('imscp_v1p1.xsd',
'imsmd_v1p2p2.xsd',
'lom.xsd',
'lomCustom.xsd',
'ims_xml.xsd'), outputDir)
# copy players for media idevices.
hasFlowplayer = False
hasMagnifier = False
hasXspfplayer = False
hasGallery = False
hasFX = False
hasSH = False
hasGames = False
hasElpLink = False
hasWikipedia = False
isBreak = False
hasInstructions = False
hasMediaelement = False
hasTooltips = False
hasABCMusic = False
listIdevicesFiles = []
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 hasElpLink and hasWikipedia and hasInstructions and hasMediaelement and hasTooltips and hasABCMusic):
#.........这里部分代码省略.........
开发者ID:exelearning,项目名称:iteexe,代码行数:101,代码来源:imsexport.py
示例7: export_to_dir
def export_to_dir(self, package, outputDir):
metainfPages = Path(outputDir.abspath() + '/META-INF')
metainfPages.mkdir()
contentPages = Path(outputDir.abspath() + '/EPUB')
contentPages.mkdir()
mimetypeFile = open(outputDir.abspath() + '/mimetype', "w")
mimetypeFile.write('application/epub+zip')
mimetypeFile.close()
Epub3Export.current_package_name = package.name
Epub3Export.current_xapi_prefix = \
EXETinCan.get_tincan_prefix_for_pkg(package)
Epub3Export.current_package_title = \
package.title
#Command line option to override language for export
if self.langOverride != None:
package.dublinCore.language = self.langOverride
#track the number of working idevices on a page
#if 0 do not put page in TOC
numDevicesByPage = {}
#track idevices that dont really export
nonDevices = []
#
#This is passed from the command line export
#
if self.forceMediaOnly == True:
package.mxmlforcemediaonly = "true"
mediaConverter = ExportMediaConverter()
mediaConverter.setCurrentPackage(package)
ExportMediaConverter.autoMediaOnly = package.mxmlforcemediaonly
if 'FORCEMEDIAONLY' in os.environ:
ExportMediaConverter.autoMediaOnly = True
ExportMediaConverter.setWorkingDir(contentPages)
indexPageXML = XMLPage("index", 1, package.root)
self.pages = [ indexPageXML ]
self.pkgNodeToPageDict = self.generatePagesXML(package.root, 1)
self.pkgNodeToPageDict[package.root] = indexPageXML
uniquifyNames(self.pages, suffix = ".xhtml")
self.generateJQueryMobileTOC(package.root, contentPages)
self.copyFilesXML(package, contentPages)
prevPage = None
thisPage = self.pages[0]
for nextPage in self.pages[1:]:
pageDevCount = thisPage.save(contentPages, prevPage, \
nextPage, self.pages, nonDevices)
numDevicesByPage[thisPage.name] = pageDevCount
prevPage = thisPage
thisPage = nextPage
pageDevCount = thisPage.save(contentPages, prevPage, None, self.pages, nonDevices)
numDevicesByPage[thisPage.name] = pageDevCount
self._writeTOCXML(contentPages, numDevicesByPage, nonDevices, package)
#save the tincan.xml file
self.write_tincan_xml(outputDir, package)
#now go through and make the HTML output
common.setExportDocType("HTML5")
self.pages = [ Epub3Cover("cover", 1, package.root) ]
self.generatePages(package.root, 2)
uniquifyNames(self.pages, suffix=".xhtml")
cover = None
for page in self.pages:
page.save(contentPages, ustadmobile_mode = True)
if hasattr(page, 'cover'):
cover = page.cover
# Create the nav.xhtml file
container = NavEpub3(self.pages, contentPages)
container.save()
# Create the publication file
publication = self.make_publication_epub3(contentPages, package, cover)
publication.save("package.opf")
#.........这里部分代码省略.........
开发者ID:UstadMobile,项目名称:exelearning-ustadmobile-work,代码行数:101,代码来源:xmlexport.py
示例8: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
self.metadataType = package.exportMetadataType
# copy the package's resource files
for resourceFile in package.resourceDir.walkfiles():
file = package.resourceDir.relpathto(resourceFile)
if ("/" in file):
Dir = Path(outputDir/file[:file.rindex("/")])
if not Dir.exists():
Dir.makedirs()
resourceFile.copy(outputDir/Dir)
else:
resourceFile.copy(outputDir)
# copy the package's resource files, only non existant in outputDir
# outputDirFiles = outputDir.files()
# for rfile in package.resourceDir.files():
# if rfile not in outputDirFiles:
# rfile.copy(outputDir)
# copy the package's resource files, only indexed in package.resources
# for md5 in package.resources.values():
# for resource in md5:
# resource.path.copy(outputDir)
# Export the package content
# Import the Scorm 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.styleDir/"scormpage.py").exists():
global ScormPage
module = imp.load_source("ScormPage",self.styleDir/"scormpage.py")
ScormPage = module.ScormPage
self.pages = [ ScormPage("index", 1, package.root,
scormType=self.scormType, metadataType=self.metadataType) ]
self.generatePages(package.root, 2)
uniquifyNames(self.pages)
for page in self.pages:
page.save(outputDir, self.pages)
if not self.hasForum:
for idevice in page.node.idevices:
if hasattr(idevice, "isForum"):
if idevice.forum.lms.lms == "moodle":
self.hasForum = True
break
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages, self.scormType, self.metadataType)
modifiedMetaData = manifest.save("imsmanifest.xml")
# Create lang file
langFile = open(outputDir + '/common_i18n.js', "w")
langFile.write(common.getJavaScriptStrings(False))
langFile.close()
if self.hasForum:
manifest.save("discussionforum.xml")
# Copy the style files to the output dir
styleFiles = [self.styleDir/'..'/'popup_bg.gif']
# And with all the files of the style we avoid problems:
styleFiles += self.styleDir.files("*.*")
if self.scormType == "commoncartridge":
for sf in styleFiles[:]:
if sf.basename() not in manifest.dependencies:
styleFiles.remove(sf)
self.styleDir.copylist(styleFiles, outputDir)
listCSSFiles=getFilesCSSToMinify('scorm', self.styleDir)
exportMinFileCSS(listCSSFiles, outputDir)
# Copy the scripts
dT = common.getExportDocType()
if dT == "HTML5":
#listFiles+=[self.scriptsDir/'exe_html5.js']
#listOutFiles+=[outputDir/'exe_html5.js']
jsFile = (self.scriptsDir/'exe_html5.js')
jsFile.copyfile(outputDir/'exe_html5.js')
# jQuery
my_style = G.application.config.styleStore.getStyle(page.node.package.style)
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
#listFiles+=[self.scriptsDir/'exe_jquery.js']
#listOutFiles+=[outputDir/'exe_jquery.js']
#.........这里部分代码省略.........
开发者ID:exelearning,项目名称:iteexe,代码行数:101,代码来源:scormexport.py
示例9: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
self.metadataType = package.exportMetadataType
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# copy the package's resource files, only non existant in outputDir
# outputDirFiles = outputDir.files()
# for rfile in package.resourceDir.files():
# if rfile not in outputDirFiles:
# rfile.copy(outputDir)
# copy the package's resource files, only indexed in package.resources
# for md5 in package.resources.values():
# for resource in md5:
# resource.path.copy(outputDir)
# Export the package content
# Import the Scorm 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.styleDir / "scormpage.py").exists():
global ScormPage
module = imp.load_source("ScormPage", self.styleDir / "scormpage.py")
ScormPage = module.ScormPage
self.pages = [ScormPage("index", 1, package.root, scormType=self.scormType, metadataType=self.metadataType)]
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
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages, self.scormType, self.metadataType)
manifest.save("imsmanifest.xml")
if self.hasForum:
manifest.save("discussionforum.xml")
# Copy the style sheet files to the output dir
styleFiles = [self.styleDir / ".." / "base.css"]
styleFiles += [self.styleDir / ".." / "popup_bg.gif"]
# And with all the files of the style we avoid problems:
styleFiles += self.styleDir.files("*.*")
if self.scormType == "commoncartridge":
for sf in styleFiles[:]:
if sf.basename() not in manifest.dependencies:
styleFiles.remove(sf)
self.styleDir.copylist(styleFiles, outputDir)
# Copy the scripts
dT = common.getExportDocType()
if dT == "HTML5":
jsFile = self.scriptsDir / "exe_html5.js"
jsFile.copyfile(outputDir / "exe_html5.js")
# jQuery
my_style = G.application.config.styleStore.getStyle(page.node.package.style)
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
jsFile = self.scriptsDir / "exe_jquery.js"
jsFile.copyfile(outputDir / "exe_jquery.js")
else:
jsFile = self.scriptsDir / "exe_jquery.js"
jsFile.copyfile(outputDir / "exe_jquery.js")
if self.scormType == "commoncartridge":
jsFile = self.scriptsDir / "common.js"
jsFile.copyfile(outputDir / "common.js")
if self.scormType == "scorm2004" or self.scormType == "scorm1.2":
self.scriptsDir.copylist(("SCORM_API_wrapper.js", "SCOFunctions.js", "common.js"), outputDir)
# about SCHEMAS:
schemasDir = ""
if self.scormType == "scorm1.2":
schemasDir = self.schemasDir / "scorm1.2"
schemasDir.copylist(
(
"imscp_rootv1p1p2.xsd",
"imsmd_rootv1p2p1.xsd",
"adlcp_rootv1p2.xsd",
"lom.xsd",
"lomCustom.xsd",
"ims_xml.xsd",
),
outputDir,
)
#.........这里部分代码省略.........
开发者ID:RichDijk,项目名称:eXe,代码行数:101,代码来源:scormexport.py
示例10: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
self.metadataType = package.exportMetadataType
# Copy the style sheet files to the output dir
# But not nav.css
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")
styleFiles += self.styleDir.files("*.ttf")
styleFiles += self.styleDir.files("*.eot")
styleFiles += self.styleDir.files("*.otf")
styleFiles += self.styleDir.files("*.woff")
self.styleDir.copylist(styleFiles, outputDir)
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# Export the package content
self.pages = [IMSPage("index", 1, package.root, metadataType=self.metadataType)]
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, self.metadataType)
manifest.save("imsmanifest.xml")
# Copy the scripts
# jQuery
my_style = G.application.config.styleStore.getStyle(page.node.package.style)
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
jsFile = self.scriptsDir / "exe_jquery.js"
jsFile.copyfile(outputDir / "exe_jquery.js")
else:
jsFile = self.scriptsDir / "exe_jquery.js"
jsFile.copyfile(outputDir / "exe_jquery.js")
jsFile = self.scriptsDir / "common.js"
jsFile.copyfile(outputDir / "common.js")
dT = common.getExportDocType()
if dT == "HTML5":
jsFile = self.scriptsDir / "exe_html5.js"
jsFile.copyfile(outputDir / "exe_html5.js")
self.schemasDir.copylist(
("imscp_v1p1.xsd", "imsmd_v1p2p2.xsd", "lom.xsd", "lomCustom.xsd", "ims_xml.xsd"), outputDir
)
# 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
#.........这里部分代码省略.........
开发者ID:RichDijk,项目名称:eXe,代码行数:101,代码来源:imsexport.py
示例11: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
# Export the package content
self.pages = [ ScormPage("index", 1, package.root,
scormType=self.scormType) ]
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
# Create the manifest file
manifest = Manifest(self.config, outputDir, package, self.pages, self.scormType)
manifest.save("imsmanifest.xml")
if self.hasForum:
manifest.save("discussionforum.xml")
# Copy the style sheet files to the output dir
# But not nav.css
styleFiles = [self.styleDir/'..'/'base.css']
styleFiles += [self.styleDir/'..'/'popup_bg.gif']
styleFiles += [f for f in self.styleDir.files("*.css")
if f.basename() <> "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")
# FIXME for now, only copy files referenced in Common Cartridge
# this really should apply to all exports, but without a manifest
# of the files needed by an included stylesheet it is too restrictive
if self.scormType == "commoncartridge":
for sf in styleFiles[:]:
if sf.basename() not in manifest.dependencies:
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:
#.........这里部分代码省略.........
开发者ID:giorgil2,项目名称:eXe,代码行数:101,代码来源:scormexport.py
示例12: export
def export(self, package):
"""
Export SCORM package
"""
# First do the export to a temporary directory
outputDir = TempDirPath()
# Copy the style sheet files to the output dir
# But not nav.css
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")
styleFiles += self.styleDir.files("*.ttf")
styleFiles += self.styleDir.files("*.eot")
styleFiles += self.styleDir.files("*.otf")
styleFiles += self.styleDir.files("*.woff")
self.styleDir.copylist(styleFiles, outputDir)
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# 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
#.........这里部分代码省略.........
开发者ID:manamani,项目名称:iteexe,代码行数:101,代码来源:imsexport.py
注:本文中的exe.export.pages.uniquifyNames函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论