当前位置: 首页>>代码示例>>Python>>正文


Python TempDirPath.abspath方法代码示例

本文整理汇总了Python中exe.engine.path.TempDirPath.abspath方法的典型用法代码示例。如果您正苦于以下问题:Python TempDirPath.abspath方法的具体用法?Python TempDirPath.abspath怎么用?Python TempDirPath.abspath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在exe.engine.path.TempDirPath的用法示例。


在下文中一共展示了TempDirPath.abspath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: export

# 需要导入模块: from exe.engine.path import TempDirPath [as 别名]
# 或者: from exe.engine.path.TempDirPath import abspath [as 别名]
    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')
        quizContentPages = Path(outputDir.abspath() + '/EPUB/tools/quiz')
        quizImagesPages = Path(quizContentPages.abspath() + '/images')
        quizScriptsPages = Path(quizContentPages.abspath() + '/scripts')
        quizVideoPages = Path(quizContentPages.abspath() + '/video')
        quizCssPages = Path(quizContentPages.abspath() + '/css')
        quizFilesPages = Path(quizContentPages.abspath() + '/css')
        # contentPages = outputDir/'Content'
        contentPages.mkdir()
        quizContentPages.makedirs()
        quizImagesPages.mkdir()
        quizScriptsPages.mkdir()
        quizVideoPages.mkdir()
        quizCssPages.mkdir()
        quizFilesPages.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
        cssStyleFiles = [self.styleDir / '..' / 'base.css']
        cssStyleFiles += [f for f in self.styleDir.files("*.css") if f.basename() != "nav.css"]

        imgStyleFiles = [self.styleDir / '..' / 'popup_bg.gif']
        imgStyleFiles += self.styleDir.files("*.jpg")
        imgStyleFiles += self.styleDir.files("*.gif")
        imgStyleFiles += self.styleDir.files("*.png")

        scriptStyleFiles = self.styleDir.files("*.js")

        filesStyleFiles = self.styleDir.files("*.html")
        filesStyleFiles += self.styleDir.files("*.ttf")
        filesStyleFiles += self.styleDir.files("*.eot")
        filesStyleFiles += self.styleDir.files("*.otf")
        filesStyleFiles += 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(cssStyleFiles, quizCssPages)
        self.styleDir.copylist(imgStyleFiles, quizImagesPages)
        self.styleDir.copylist(scriptStyleFiles, quizScriptsPages)
        self.styleDir.copylist(filesStyleFiles, quizFilesPages)


        self.scriptsDir.copylist(('common.js',), quizScriptsPages)

        # 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:
#.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:103,代码来源:

示例2: export

# 需要导入模块: from exe.engine.path import TempDirPath [as 别名]
# 或者: from exe.engine.path.TempDirPath import abspath [as 别名]
    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,代码行数:103,代码来源:epub3export.py


注:本文中的exe.engine.path.TempDirPath.abspath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。