當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。