本文整理汇总了Python中exe.engine.path.Path.write_text方法的典型用法代码示例。如果您正苦于以下问题:Python Path.write_text方法的具体用法?Python Path.write_text怎么用?Python Path.write_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类exe.engine.path.Path
的用法示例。
在下文中一共展示了Path.write_text方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import write_text [as 别名]
#.........这里部分代码省略.........
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)
return outputDir
else:
self.filename.write_text(self.report, 'utf-8')
def copyFiles(self, package, outputDir):
"""
Copy all the files used by the website.
"""
if os.path.isdir(self.stylesDir):
# Copy the style sheet files to the output dir
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")
styleFiles += self.stylesDir.files("*.ico")
styleFiles += self.stylesDir.files("*.ttf")
styleFiles += self.stylesDir.files("*.eot")
styleFiles += self.stylesDir.files("*.otf")
styleFiles += self.stylesDir.files("*.woff")
self.stylesDir.copylist(styleFiles, outputDir)
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# copy script files.
my_style = G.application.config.styleStore.getStyle(package.style)
# jQuery
if my_style.hasValidConfig:
if my_style.get_jquery() == True:
示例2: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import write_text [as 别名]
#.........这里部分代码省略.........
# 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')
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))
@classmethod
def run_copy_list(cls, copy_list):
"""
Copy a list of files - preserve modification times
Parameters
copy_list : list
List of arrays. Item 0 of each array should be a source,1
示例3: WebsiteExport
# 需要导入模块: from exe.engine.path import Path [as 别名]
# 或者: from exe.engine.path.Path import write_text [as 别名]
#.........这里部分代码省略.........
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)
return outputDir
else:
self.filename.write_text(self.report, 'utf-8')
def copyFiles(self, package, outputDir):
"""
Copy all the files used by the website.
"""
if os.path.isdir(self.stylesDir):
# Copy the style sheet files to the output dir
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")
styleFiles += self.stylesDir.files("*.ico")
styleFiles += self.stylesDir.files("*.ttf")
styleFiles += self.stylesDir.files("*.eot")
styleFiles += self.stylesDir.files("*.otf")
styleFiles += self.stylesDir.files("*.woff")
self.stylesDir.copylist(styleFiles, outputDir)
# copy the package's resource files
package.resourceDir.copyfiles(outputDir)
# copy script files.
my_style = G.application.config.styleStore.getStyle(package.style)
# jQuery
if my_style.hasValidConfig:
if my_style.get_jquery() == True: