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


Python PyGlassEnvironment.getRootResourcePath方法代码示例

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


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

示例1: run

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [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: __init__

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def __init__(self, rootPath =None, recursive =True, **kwargs):
        """Creates a new instance of WidgetUiCompiler."""
        self._log        = Logger(self)
        self._verbose    = ArgsUtils.get('verbose', False, kwargs)
        self._recursive  = recursive
        self._pythonPath = os.path.normpath(sys.exec_prefix)

        if rootPath and os.path.isabs(rootPath):
            self._rootPath = FileUtils.cleanupPath(rootPath, isDir=True)
        elif rootPath:
            parts = rootPath.split(os.sep if rootPath.find(os.sep) != -1 else '/')
            self._rootPath = PyGlassEnvironment.getRootResourcePath(*parts, isDir=True)
        else:
            self._rootPath = PyGlassEnvironment.getRootResourcePath()
开发者ID:hannahp,项目名称:PyGlass,代码行数:16,代码来源:WidgetUiCompiler.py

示例3: _deployResources

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def _deployResources(cls):
        """ On windows the resource folder data is stored within the application install directory.
            However, due to permissions issues, certain file types cannot be accessed from that
            directory without causing the program to crash. Therefore, the stored resources must
            be expanded into the user's AppData/Local folder. The method checks the currently
            deployed resources folder and deploys the stored resources if the existing resources
            either don't exist or don't match the currently installed version of the program. """

        if not OsUtils.isWindows() or not PyGlassEnvironment.isDeployed:
            return False

        storagePath       = PyGlassEnvironment.getInstallationPath('resource_storage', isDir=True)
        storageStampPath  = FileUtils.makeFilePath(storagePath, 'install.stamp')
        resourcePath      = PyGlassEnvironment.getRootResourcePath(isDir=True)
        resourceStampPath = FileUtils.makeFilePath(resourcePath, 'install.stamp')

        try:
            resousrceData = JSON.fromFile(resourceStampPath)
            storageData   = JSON.fromFile(storageStampPath)
            if resousrceData['CTS'] == storageData['CTS']:
                return False
        except Exception as err:
            pass

        SystemUtils.remove(resourcePath)
        FileUtils.mergeCopy(storagePath, resourcePath)
        return True
开发者ID:sernst,项目名称:PyGlass,代码行数:29,代码来源:PyGlassApplication.py

示例4: run

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [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

示例5: getAppDatabaseItems

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def getAppDatabaseItems(cls, appName):
        databaseRoot = PyGlassEnvironment.getRootResourcePath('apps', appName, 'data')
        if not os.path.exists(databaseRoot):
            return []

        results = []
        os.path.walk(databaseRoot, cls._findAppDatabases, {
            'root':databaseRoot,
            'results':results,
            'appName':appName
        })
        return results
开发者ID:hannahp,项目名称:PyGlass,代码行数:14,代码来源:AlembicUtils.py

示例6: upgradeDatabase

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def upgradeDatabase(cls, databaseUrl):
        """upgradeDatabase doc..."""
        from pyglass.alembic.AlembicUtils import AlembicUtils

        if not AlembicUtils.hasAlembic:
            return False

        AlembicUtils.upgradeDatabase(
            databaseUrl=databaseUrl,
            resourcesPath=PyGlassEnvironment.getRootResourcePath(isDir=True),
            localResourcesPath=PyGlassEnvironment.getRootLocalResourcePath(isDir=True),
        )
        return True
开发者ID:sernst,项目名称:PyGlass,代码行数:15,代码来源:PyGlassModelUtils.py

示例7: _showSplashScreen

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def _showSplashScreen(self):
        """_showSplashScreen doc..."""
        parts = str(self.splashScreenUrl).split(':', 1)
        if len(parts) == 1 or parts[0].lower == 'app':
            splashImagePath = PyGlassEnvironment.getRootResourcePath(
                'apps', self.appID, parts[-1], isFile=True)
        else:
            splashImagePath = None

        if splashImagePath and os.path.exists(splashImagePath):
            splash = QtGui.QSplashScreen(QtGui.QPixmap(splashImagePath))
            splash.show()
            self._splashScreen = splash
            self.updateSplashScreen('Initializing User Interface')
开发者ID:sernst,项目名称:PyGlass,代码行数:16,代码来源:PyGlassApplication.py

示例8: _getIconPath

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def _getIconPath(self):
        path = self.iconPath
        if not path:
            return ''

        if isinstance(path, basestring):
            if os.path.isabs(path) and os.path.exists(path):
                return FileUtils.cleanupPath(path)
            else:
                path = path.replace('\\', '/').strip('/').split('/')

        path.append('icons' if OsUtils.isWindows() else 'icons.iconset')
        out = PyGlassEnvironment.getRootResourcePath(*path, isDir=True)
        if os.path.exists(out):
            return out
        return ''
开发者ID:hannahp,项目名称:PyGlass,代码行数:18,代码来源:PyGlassApplicationCompiler.py

示例9: getMigrationPathFromDatabaseUrl

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def getMigrationPathFromDatabaseUrl(cls, databaseUrl, root=False, resourcesPath=None):
        urlParts = databaseUrl.split("://")
        if urlParts[0].lower() == "shared":
            path = ["shared", "alembic"]
        else:
            path = ["apps", urlParts[0], "alembic"]

        if not root:
            path += urlParts[-1].split("/")

            # Remove the extension
            if path[-1].endswith(".vdb"):
                path[-1] = path[-1][:-4]

        if resourcesPath:
            return FileUtils.makeFolderPath(resourcesPath, *path, isDir=True)

        return PyGlassEnvironment.getRootResourcePath(*path, isDir=True)
开发者ID:sernst,项目名称:PyGlass,代码行数:20,代码来源:PyGlassModelUtils.py

示例10: hasMigrationEnvironment

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
    def hasMigrationEnvironment(cls, databaseUrl, resourcesPath =None):
        """ Determines whether or not the specified application database currently has a migration
            environment setup
            :param databaseUrl:
            :param resourcesPath:
            :return: True or false depending on the presence of a migration environment """

        if not resourcesPath:
            resourcesPath = PyGlassEnvironment.getRootResourcePath(isDir=True)

        migrationPath = PyGlassModelUtils.getMigrationPathFromDatabaseUrl(
            databaseUrl=databaseUrl, resourcesPath=resourcesPath)

        if not os.path.exists(migrationPath):
            return False
        if not os.path.exists(FileUtils.makeFilePath(migrationPath, 'alembic.ini')):
            return False
        if not os.path.exists(FileUtils.makeFolderPath(migrationPath, 'versions')):
            return False
        return True
开发者ID:sernst,项目名称:PyGlass,代码行数:22,代码来源:AlembicUtils.py

示例11: _runPreMainWindowImpl

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
 def _runPreMainWindowImpl(self):
     # Overrides the resource path for running StaticFlow applications within the PyGlass app
     StaticFlowEnvironment.setResourceRootPath(PyGlassEnvironment.getRootResourcePath())
开发者ID:sernst,项目名称:StaticFlow,代码行数:5,代码来源:StaticFlowApplication.py

示例12: getRootResourcePath

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
 def getRootResourcePath(self, *args, **kwargs):
     return PyGlassEnvironment.getRootResourcePath(*args, **kwargs)
开发者ID:sernst,项目名称:PyGlass,代码行数:4,代码来源:PyGlassWindow.py

示例13: rootResourcePath

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
 def rootResourcePath(self):
     return PyGlassEnvironment.getRootResourcePath()
开发者ID:sernst,项目名称:PyGlass,代码行数:4,代码来源:PyGlassWindow.py

示例14: getAppResourcePath

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
 def getAppResourcePath(self, *args, **kwargs):
     return PyGlassEnvironment.getRootResourcePath('apps', self.appID, *args, **kwargs)
开发者ID:sernst,项目名称:PyGlass,代码行数:4,代码来源:PyGlassApplication.py

示例15: getAppResourcePath

# 需要导入模块: from pyglass.app.PyGlassEnvironment import PyGlassEnvironment [as 别名]
# 或者: from pyglass.app.PyGlassEnvironment.PyGlassEnvironment import getRootResourcePath [as 别名]
 def getAppResourcePath(cls, *args, **kwargs):
     """getAppResourcePath doc..."""
     return PyGlassEnvironment.getRootResourcePath(
         'apps', cls.APP_ID, *args, **kwargs)
开发者ID:sernst,项目名称:Cadence,代码行数:6,代码来源:CadenceEnvironment.py


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