def _handleAddApp(self): defaultPath = self.appConfig.get('LAST_APP_PATH', OsUtils.getDocumentsPath()) path = PyGlassBasicDialogManager.browseForDirectory( parent=self, caption=StringUtils.dedent(""" Specify the root path to a PyGlass application, in which a resource folder resides"""), defaultPath=defaultPath) if not path: return label = PyGlassBasicDialogManager.openTextQuery( parent=self, header='Enter Application Name', message='Specify the name of this application for display within Alembic Migrator', defaultText=os.path.basename(path.rstrip(os.sep)) ) apps = self.appConfig.get('APPLICATIONS', dict()) appData = { 'label':label, 'path':path, 'databases':dict(), 'id':TimeUtils.getUidTimecode('App', StringUtils.slugify(label))} apps[appData['id']] = appData self.appConfig.set('APPLICATIONS', apps) self.refresh() resultItem = self.appsListWidget.findItems(appData['id'], QtCore.Qt.MatchExactly) if resultItem: resultItem[0].setSelected(True)
def locateMayaEnvFiles(cls): """ Finds the location of all Maya.env files located in the default location on the host and return them as a list. If no such env files exist, the method returns an empty list. """ home = FileUtils.cleanupPath(OsUtils.getHomePath(), isDir=True) if not os.path.exists(home): return [] if OsUtils.isWindows(): root = FileUtils.createPath(OsUtils.getDocumentsPath(), 'maya', isDir=True) if not os.path.exists(root): return [] elif OsUtils.isMac(): root = FileUtils.createPath(home, 'Library', 'Preferences', 'Autodesk', 'maya', isDir=True) if not os.path.exists(root): return [] else: return [] out = [] FileUtils.walkPath(root, cls._handleFindEnvFiles, out) return out
def locateMayaEnvFiles(cls): """ Finds the location of all Maya.env files located in the default location on the host and return them as a list. If no such env files exist, the method returns an empty list. """ home = FileUtils.cleanupPath(OsUtils.getHomePath(), isDir=True) if not os.path.exists(home): return [] if OsUtils.isWindows(): root = FileUtils.createPath(OsUtils.getDocumentsPath(), 'maya', isDir=True) if not os.path.exists(root): return [] elif OsUtils.isMac(): root = FileUtils.createPath( home, 'Library', 'Preferences', 'Autodesk', 'maya', isDir=True) if not os.path.exists(root): return [] else: return [] out = [] FileUtils.walkPath(root, cls._handleFindEnvFiles, out) return out