當前位置: 首頁>>代碼示例>>Python>>正文


Python PyGlassEnvironment.getPyGlassResourcePath方法代碼示例

本文整理匯總了Python中pyglass.app.PyGlassEnvironment.PyGlassEnvironment.getPyGlassResourcePath方法的典型用法代碼示例。如果您正苦於以下問題:Python PyGlassEnvironment.getPyGlassResourcePath方法的具體用法?Python PyGlassEnvironment.getPyGlassResourcePath怎麽用?Python PyGlassEnvironment.getPyGlassResourcePath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pyglass.app.PyGlassEnvironment.PyGlassEnvironment的用法示例。


在下文中一共展示了PyGlassEnvironment.getPyGlassResourcePath方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: run

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def run(self):
        """Doc..."""
        resources = self._compiler.resources

        #-------------------------------------------------------------------------------------------
        # RESOURCES
        #       If no resource folders were specified copy the entire contents of the resources
        #       folder. Make sure to skip the local resources path in the process.
        if not resources:
            for item in os.listdir(PyGlassEnvironment.getRootResourcePath(isDir=True)):
                itemPath = PyGlassEnvironment.getRootResourcePath(item)
                if os.path.isdir(itemPath) and not item in ['local', 'apps']:
                    resources.append(item)

        for container in resources:
            parts = container.replace('\\', '/').split('/')
            self._copyResourceFolder(
                PyGlassEnvironment.getRootResourcePath(*parts, isDir=True), parts)

        #-------------------------------------------------------------------------------------------
        # APP RESOURCES
        appResources = self._compiler.resourceAppIds
        if not appResources:
            appResources = []
        for appResource in appResources:
            itemPath = PyGlassEnvironment.getRootResourcePath('apps', appResource, isDir=True)
            if not os.path.exists(itemPath):
                self._log.write('[WARNING]: No such app resource path found: %s' % appResource)
                continue
            self._copyResourceFolder(itemPath, ['apps', appResource])

        #-------------------------------------------------------------------------------------------
        # PYGLASS RESOURCES
        #       Copy the resources from the PyGlass
        resources = []
        for item in os.listdir(PyGlassEnvironment.getPyGlassResourcePath('..', isDir=True)):
            itemPath = PyGlassEnvironment.getPyGlassResourcePath('..', item)
            if os.path.isdir(itemPath):
                resources.append(item)

        for container in resources:
            self._copyResourceFolder(
                PyGlassEnvironment.getPyGlassResourcePath('..', container), [container])

        # Create a stamp file in resources for comparing on future installations
        creationStampFile = FileUtils.makeFilePath(self._targetPath, 'install.stamp')
        JSON.toFile(creationStampFile, {'CTS':TimeUtils.toZuluPreciseTimestamp()})

        #-------------------------------------------------------------------------------------------
        # CLEANUP
        if self._verbose:
            self._log.write('CLEANUP: Removing unwanted destination files.')
        self._cleanupFiles(self._targetPath)

        self._copyPythonStaticResources()

        if self._verbose:
            self._log.write('COMPLETE: Resource Collection')

        return True
開發者ID:sernst,項目名稱:PyGlass,代碼行數:62,代碼來源:ResourceCollector.py

示例2: _createNsisInstallerScript

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def _createNsisInstallerScript(self, binPath):
        path = FileUtils.createPath(binPath, 'installer.nsi', isFile=True)

        try:
            sourcePath = PyGlassEnvironment.getPyGlassResourcePath(
                '..', 'installer.tmpl.nsi', isFile=True)
            f = open(sourcePath, 'r+')
            source = f.read()
            f.close()
        except Exception as err:
            print(err)
            return None

        try:
            f = open(path, 'w+')
            f.write(source.replace(
                '##APP_NAME##', self.appDisplayName
            ).replace(
                '##APP_ID##', self.application.appID
            ).replace(
                '##APP_GROUP_ID##', self.application.appGroupID
            ).replace(
                '##SAFE_APP_NAME##', self.appDisplayName.replace(' ', '_') ))
            f.close()
        except Exception as err:
            print(err)
            return None

        return path
開發者ID:sernst,項目名稱:PyGlass,代碼行數:31,代碼來源:PyGlassApplicationCompiler.py

示例3: _createSetupFile

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def _createSetupFile(self, binPath):
        path = FileUtils.createPath(binPath, 'setup.py', isFile=True)
        scriptPath = inspect.getabsfile(self.applicationClass)

        try:
            sourcePath = PyGlassEnvironment.getPyGlassResourcePath(
                '..', 'setupSource.txt', isFile=True)
            f      = open(sourcePath, 'r+')
            source = f.read()
            f.close()
        except Exception as err:
            print(err)
            return None

        try:
            f = open(path, 'w+')
            f.write(source.replace(
                '##SCRIPT_PATH##', StringUtils.escapeBackSlashes(scriptPath)
            ).replace(
                '##RESOURCES##', StringUtils.escapeBackSlashes(JSON.asString(self.resources))
            ).replace(
                '##INCLUDES##', StringUtils.escapeBackSlashes(JSON.asString(self.siteLibraries))
            ).replace(
                '##ICON_PATH##', StringUtils.escapeBackSlashes(self._createIcon(binPath))
            ).replace(
                '##APP_NAME##', self.appDisplayName
            ).replace(
                '##SAFE_APP_NAME##', self.appDisplayName.replace(' ', '_') ))
            f.close()
        except Exception as err:
            print(err)
            return None

        return path
開發者ID:sernst,項目名稱:PyGlass,代碼行數:36,代碼來源:PyGlassApplicationCompiler.py

示例4: _getIconSheet

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
 def _getIconSheet(self):
     key = str(self._sizeIndex) + '-' + str(self._isDark)
     if key not in self._ICON_SHEETS:
         self._ICON_SHEETS[key] = QtGui.QPixmap(PyGlassEnvironment.getPyGlassResourcePath(
             'icons-%s-%s.png' % (
                 'dark' if self._isDark else 'light', str(self._ICON_SIZES[self._sizeIndex])
         ), isFile=True))
     return self._ICON_SHEETS[key]
開發者ID:hannahp,項目名稱:PyGlass,代碼行數:10,代碼來源:IconElement.py

示例5: run

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def run(self):
        """Doc..."""
        resources = self._compiler.resources

        #-------------------------------------------------------------------------------------------
        # APP RESOURCES
        #       If no resource folders were specified copy the entire contents of the resources
        #       folder. Make sure to skip the local resources path in the process.
        if not resources:
            for item in os.listdir(PyGlassEnvironment.getRootResourcePath(isDir=True)):
                itemPath = PyGlassEnvironment.getRootResourcePath(item)
                if os.path.isdir(itemPath) and not item == 'local':
                    resources.append(item)

        for container in resources:
            parts = container.replace('\\', '/').split('/')
            self._copyResourceFolder(
                PyGlassEnvironment.getRootResourcePath(*parts, isDir=True), parts
            )

        #-------------------------------------------------------------------------------------------
        # PYGLASS RESOURCES
        #       Copy the resources from the PyGlass
        resources = []
        for item in os.listdir(PyGlassEnvironment.getPyGlassResourcePath('..', isDir=True)):
            itemPath = PyGlassEnvironment.getPyGlassResourcePath('..', item)
            if os.path.isdir(itemPath):
                resources.append(item)

        for container in resources:
            self._copyResourceFolder(
                PyGlassEnvironment.getPyGlassResourcePath('..', container), [container]
            )

        #-------------------------------------------------------------------------------------------
        # CLEANUP
        if self._verbose:
            self._log.write('CLEANUP: Removing unwanted destination files.')
        self._cleanupFiles(self._targetPath)

        self._copyPythonStaticResources()

        if self._verbose:
            self._log.write('COMPLETE: Resource Collection')

        return True
開發者ID:hannahp,項目名稱:PyGlass,代碼行數:48,代碼來源:ResourceCollector.py

示例6: _createNsisInstallerScript

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def _createNsisInstallerScript(self, binPath):
        path = FileUtils.createPath(binPath, 'installer.nsi', isFile=True)

        try:
            sourcePath = PyGlassEnvironment.getPyGlassResourcePath(
                '..', 'installer.tmpl.nsi', isFile=True)
            f = open(sourcePath, 'r+')
            source = f.read()
            f.close()
        except Exception, err:
            print err
            return None
開發者ID:hannahp,項目名稱:PyGlass,代碼行數:14,代碼來源:PyGlassApplicationCompiler.py

示例7: _createSetupFile

# 需要導入模塊: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 別名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getPyGlassResourcePath [as 別名]
    def _createSetupFile(self, binPath):
        path = FileUtils.createPath(binPath, 'setup.py', isFile=True)
        scriptPath = inspect.getabsfile(self.applicationClass)

        try:
            sourcePath = PyGlassEnvironment.getPyGlassResourcePath(
                '..', 'setupSource.txt', isFile=True)
            f      = open(sourcePath, 'r+')
            source = f.read()
            f.close()
        except Exception, err:
            print err
            return None
開發者ID:hannahp,項目名稱:PyGlass,代碼行數:15,代碼來源:PyGlassApplicationCompiler.py


注:本文中的pyglass.app.PyGlassEnvironment.PyGlassEnvironment.getPyGlassResourcePath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。