本文整理汇总了Python中exe.engine.path.Path.lower方法的典型用法代码示例。如果您正苦于以下问题:Python Path.lower方法的具体用法?Python Path.lower怎么用?Python Path.lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exe.engine.path.Path
的用法示例。
在下文中一共展示了Path.lower方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handleExtractPackage
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import lower [as 别名]
def handleExtractPackage(self, client, filename):
"""
Create a new package consisting of the current node and export
"""
filename = Path(filename)
saveDir = filename.dirname()
if saveDir and not saveDir.exists():
client.alert(_(u'Cannot access directory named ') +
unicode(saveDir) +
_(u'. Please use ASCII names.'))
return
if not filename.lower().endswith('.elp'):
filename += '.elp'
if Path(filename).exists():
client.alert(_(u'EXPORT FAILED.\n"%s" already exists.\n'
'Please try again with '
'a different filename') % filename)
return
package = Package(filename.namebase)
package.style = self.package.style
package.author = self.package.author
extractNode = self.package.currentNode.clone()
extractNode.mergeIntoPackage(package)
package.root = package.currentNode = extractNode
package.save(filename)
client.alert(_(u'Package saved to: %s' % filename))
示例2: handleSavePackage
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import lower [as 别名]
def handleSavePackage(self, client, filename=None, onDone=None):
"""
Save the current package
'filename' is the filename to save the package to
'onDone' will be evaled after saving instead or redirecting
to the new location (in cases of package name changes).
(This is used where the user goes file|open when their
package is changed and needs saving)
"""
filename = Path(filename)
saveDir = filename.dirname()
if saveDir and not saveDir.exists():
client.alert(_(u'Cannot access directory named ') +
unicode(saveDir) +
_(u'. Please use ASCII names.'))
return
oldName = self.package.name
if not filename:
filename = self.package.filename
assert (filename,
('Somehow save was called without a filename '
'on a package that has no default filename.'))
if not filename.lower().endswith('.elp'):
filename += '.elp'
self.package.save(filename) # This can change the package name
client.alert(_(u'Package saved to: %s' % filename))
if onDone:
client.sendScript(onDone)
elif self.package.name != oldName:
self.webServer.root.putChild(self.package.name, self)
log.info('Package saved, redirecting client to /%s'
% self.package.name)
client.sendScript('top.location = "/%s"' % \
self.package.name.encode('utf8'))
示例3: exportText
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import lower [as 别名]
def exportText(self, client, filename):
try:
filename = Path(filename)
log.debug(u"exportWebsite, filename=%s" % filename)
if not filename.lower().endswith('.txt'):
filename += '.txt'
if Path(filename).exists():
msg = _(u'"%s" already exists.\nPlease try again with a different filename') % filename
client.alert(_(u'EXPORT FAILED!\n%s' % msg))
return
textExport = TextExport(filename)
textExport.export(self.package)
except Exception, e:
client.alert(_('EXPORT FAILED!\n%s' % str(e)))
raise
示例4: exportScorm
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import lower [as 别名]
def exportScorm(self, client, filename, stylesDir, scormType):
"""
Exports this package to a scorm package file
"""
try:
filename = Path(filename)
log.debug(u"exportScorm, filename=%s" % filename)
if not filename.lower().endswith('.zip'):
filename += '.zip'
if Path(filename).exists():
msg = _(u'"%s" already exists.\nPlease try again with a different filename') % filename
client.alert(_(u'EXPORT FAILED!\n%s' % msg))
return
scormExport = ScormExport(self.config, stylesDir, filename, scormType)
scormExport.export(self.package)
except Exception, e:
client.alert(_('EXPORT FAILED!\n%s' % str(e)))
raise
示例5: handleExtractPackage
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import lower [as 别名]
def handleExtractPackage(self, client, filename, existOk):
"""
Create a new package consisting of the current node and export
'existOk' means the user has been informed of existance and ok'd it
"""
filename = Path(filename)
saveDir = filename.dirname()
if saveDir and not saveDir.exists():
client.alert(_(u'Cannot access directory named ') + unicode(saveDir) + _(u'. Please use ASCII names.'))
return
# Add the extension if its not already there
if not filename.lower().endswith('.elp'):
filename += '.elp'
if Path(filename).exists() and existOk != 'true':
msg = _(u'"%s" already exists.\nPlease try again with a different filename') % filename
client.alert(_(u'EXTRACT FAILED!\n%s' % msg))
return
try:
# Create a new package for the extracted nodes
newPackage = self.package.extractNode()
# trigger a rename of all of the internal nodes and links,
# and to remove any old anchors from the dest package,
# and remove any zombie links via isExtract:
newNode = newPackage.root
if newNode:
newNode.RenamedNodePath(isExtract=True)
# Save the new package
newPackage.save(filename)
except Exception, e:
client.alert(_('EXTRACT FAILED!\n%s' % str(e)))
raise