def get_assets(self): row = 0 assetDict = OrderedDict() assetList = [] project = str(self.ui.project_comboBox.currentText()) if self.serverMode: assetPath = ('/').join([self.server, project, config.asset]) types = sorted(file_utils.listFolder(assetPath)) for assetType in types: assetTypePath = ('/').join([assetPath, assetType]) subTypes = sorted(file_utils.listFolder(assetTypePath)) for subType in subTypes: assetEntityPath = ('/').join([assetTypePath, subType]) assets = sorted(file_utils.listFolder(assetEntityPath)) for asset in assets: dup = False if asset in assetList: dup = True index = assetList.index(asset) assetDict[index]['duplicated'] = True assetDict.update({row: {'asset': asset, 'type': assetType, 'subType': subType, 'duplicated': dup}}) row+=1 assetList.append(asset) return assetDict
def allSubtypes(mode_path = ''): subs = [] if mode_path: for typ in file_utils.listFolder(mode_path): typ_path = mode_path + '/' + typ for sub in file_utils.listFolder(typ_path): if not sub in subs: subs.append(sub) return subs
def set_project_combo(self): """ read project """ lastSelected = mc.optionVar(q=config.projectVar) if self.mode == self.server: # browse server projects = file_utils.listFolder(self.rootPubl) self.ui.project_comboBox.addItems(projects) if lastSelected in projects: self.ui.project_comboBox.setCurrentIndex(projects.index(lastSelected))
def list_subtype(self): selTypeItem = self.ui.typeAsset_listWidget.currentItem() self.ui.subTypeAsset_listWidget.clear() if selTypeItem: if self.mode == self.server: path = selTypeItem.data(QtCore.Qt.UserRole) subtypes = file_utils.listFolder(path) if self.mode == self.shotgun: subtypes = sg_process.get_subtype() # listSubtype iconWidget = QtGui.QIcon() iconWidget.addPixmap(QtGui.QPixmap(icon.dir),QtGui.QIcon.Normal,QtGui.QIcon.Off) for sub in subtypes: subPath = self.pathSep.join([path, sub]) item = QtWidgets.QListWidgetItem(self.ui.subTypeAsset_listWidget) item.setText(sub) item.setData(QtCore.Qt.UserRole, subPath) item.setIcon(iconWidget)
def allTypes(mode_path = ''): if mode_path: return file_utils.listFolder(mode_path)
def set_project(self): if self.serverMode: self.server = os.getenv(config.RFPROJECT) projects = sorted(file_utils.listFolder(self.server)) self.ui.project_comboBox.addItems(projects)