• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python PyGlassEnvironment.PyGlassEnvironment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _deployResources

    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,代码行数:27,代码来源:PyGlassApplication.py


示例2: __init__

    def __init__(self):
        """Creates a new instance of PyGlassApplication."""
        QtCore.QObject.__init__(self)
        self._qApplication = None
        self._window       = None
        self._splashScreen = None

        # Sets a temporary standard out and error for deployed applications in a write allowed
        # location to prevent failed write results.
        if PyGlassEnvironment.isDeployed:
            if appdirs:
                userDir = appdirs.user_data_dir(self.appID, self.appGroupID)
            else:
                userDir = FileUtils.createPath(
                    os.path.expanduser('~'), '.pyglass', self.appGroupID, self.appID, isDir=True)

            path = FileUtils.createPath(
                userDir,
                self.appID + '_out.log', isFile=True)
            folder = FileUtils.getDirectoryOf(path, createIfMissing=True)
            sys.stdout = open(path, 'w+')

            FileUtils.createPath(
                appdirs.user_data_dir(self.appID, self.appGroupID),
                self.appID + '_error.log',
                isFile=True)
            folder = FileUtils.getDirectoryOf(path, createIfMissing=True)
            sys.stderr = open(path, 'w+')

        PyGlassEnvironment.initializeAppSettings(self)
开发者ID:hannahp,项目名称:PyGlass,代码行数:30,代码来源:PyGlassApplication.py


示例3: __init__

    def __init__(self, *args, **kwargs):
        """Creates a new instance of PyGlassApplication."""
        QtCore.QObject.__init__(self)
        self._qApplication      = None
        self._window            = None
        self._splashScreen      = None

        self.redirectLogOutputs()
        PyGlassEnvironment.initializeAppSettings(self)
        self.redirectLogOutputs()
开发者ID:sernst,项目名称:PyGlass,代码行数:10,代码来源:PyGlassApplication.py


示例4: upgradeDatabase

    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,代码行数:13,代码来源:PyGlassModelUtils.py


示例5: __init__

    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,代码行数:14,代码来源:WidgetUiCompiler.py


示例6: _createSetupFile

    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,代码行数:34,代码来源:PyGlassApplicationCompiler.py


示例7: _createNsisInstallerScript

    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,代码行数:29,代码来源:PyGlassApplicationCompiler.py


示例8: _changeDirToLocalAppPath

 def _changeDirToLocalAppPath(cls, localResourcesPath):
     """_changeDirToLocalAppPath doc..."""
     if not localResourcesPath:
         localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)
     lastDir = os.path.abspath(os.curdir)
     os.chdir(localResourcesPath)
     return lastDir
开发者ID:sernst,项目名称:PyGlass,代码行数:7,代码来源:AlembicUtils.py


示例9: _getIconSheet

 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,代码行数:8,代码来源:IconElement.py


示例10: run

    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,代码行数:60,代码来源:ResourceCollector.py


示例11: getAnalysisSettings

def getAnalysisSettings():
    """ Retrieves the analysis configuration settings file as a SettingsConfig
        instance that can be modified and saved as needed.
        @return: SettingsConfig """
    if not __LOCALS__.SETTINGS_CONFIG:
        __LOCALS__.SETTINGS_CONFIG = SettingsConfig(
            FileUtils.makeFilePath(
                PyGlassEnvironment.getRootLocalResourcePath(
                    'analysis', isDir=True),
                'analysis.json'), pretty=True)
    return __LOCALS__.SETTINGS_CONFIG
开发者ID:sernst,项目名称:Cadence,代码行数:11,代码来源:DataLoadUtils.py


示例12: getAppDatabaseItems

    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,代码行数:12,代码来源:AlembicUtils.py


示例13: _createNsisInstallerScript

    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,代码行数:12,代码来源:PyGlassApplicationCompiler.py


示例14: _createSetupFile

    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,代码行数:13,代码来源:PyGlassApplicationCompiler.py


示例15: _showSplashScreen

    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,代码行数:14,代码来源:PyGlassApplication.py


示例16: getPathFromDatabaseUrl

    def getPathFromDatabaseUrl(cls, databaseUrl):
        urlParts = databaseUrl.split(u'://')

        # Determine the sqlite database path
        if urlParts[0].lower() == u'shared':
            path = [u'shared', u'data']
        else:
            path = [u'apps', urlParts[0], u'data']

        path += urlParts[1].strip(u'/').split(u'/')
        if not path[-1].endswith(u'.vdb'):
            path[-1] += u'.vdb'

        return PyGlassEnvironment.getRootLocalResourcePath(*path)
开发者ID:hannahp,项目名称:PyGlass,代码行数:14,代码来源:PyGlassModelUtils.py


示例17: getAppDatabaseItems

    def getAppDatabaseItems(cls, appName, localResourcesPath =None):
        if not localResourcesPath:
            localResourcesPath = PyGlassEnvironment.getRootLocalResourcePath(isDir=True)

        databaseRoot = FileUtils.makeFolderPath(localResourcesPath, 'apps', appName, 'data')
        if not os.path.exists(databaseRoot):
            return []

        results = []
        FileUtils.walkPath(databaseRoot, cls._findAppDatabases, {
            'root':databaseRoot,
            'results':results,
            'appName':appName })

        return results
开发者ID:sernst,项目名称:PyGlass,代码行数:15,代码来源:AlembicUtils.py


示例18: getMigrationPathFromDatabaseUrl

    def getMigrationPathFromDatabaseUrl(cls, databaseUrl, root =False):
        urlParts = databaseUrl.split(u'://')
        if urlParts[0].lower() == u'shared':
            path = [u'shared', u'migration']
        else:
            path = [u'apps', urlParts[0], u'migration']

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

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

        return PyGlassEnvironment.getResourcePath(*path)
开发者ID:hannahp,项目名称:PyGlass,代码行数:15,代码来源:PyGlassModelUtils.py


示例19: _getIconPath

    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,代码行数:16,代码来源:PyGlassApplicationCompiler.py


示例20: getPathFromDatabaseUrl

    def getPathFromDatabaseUrl(cls, databaseUrl, localResourcesPath=None):
        urlParts = databaseUrl.split("://")

        # Determine the sqlite database path
        if urlParts[0].lower() == "shared":
            path = ["shared", "data"]
        else:
            path = ["apps", urlParts[0], "data"]

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

        if localResourcesPath:
            return FileUtils.makeFilePath(localResourcesPath, *path)

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python app.run函数代码示例发布时间:2022-05-25
下一篇:
Python services._函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap