def _assetSelected(self, fileID): # Update background color for buttons. if self._currentSelectedAsset != None: _pmCore.iconTextButton(self._uiWidget[_UiWidgetEnum.assetBtnList][self._assetBtnName(self._currentSelectedAsset)], edit=True, backgroundColor=self._defaultColor) btnName = self._assetBtnName(fileID) button = self._uiWidget[_UiWidgetEnum.assetBtnList].get(btnName) _pmCore.iconTextButton(button, edit=True, backgroundColor=self._highlightColor) # Get file info from database. fileInfo = _Database.getFileInfo(fileID) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.sceneNameTextField], edit=True, text=fileInfo[1]) _pmCore.textFieldGrp(self._uiWidget[_UiWidgetEnum.filePathTextField], edit=True, text=fileInfo[2]) _pmCore.scrollField(self._uiWidget[_UiWidgetEnum.descriptionTextField], edit=True, text=fileInfo[4]) _pmCore.optionMenuGrp(self._uiWidget[_UiWidgetEnum.categoryCombox], edit=True, value=fileInfo[5]) # Update version text. versionNum = _Database.getCurrentVersion(fileID) _pmCore.text(self._uiWidget[_UiWidgetEnum.versionNumText], edit=True, label=str(versionNum)) self._currentSelectedAsset = fileID
def _assetAdded(self, fileID, category): categoryLayout = self._uiWidget[category] _pmCore.setParent(categoryLayout) _, sceneName, _, versionID, _, _, _ = _Database.getFileInfo(fileID) self._addAssetButton(fileID, sceneName, versionID)
def _deleteAssetClicked(self): if self._currentSelectedAsset == None: raise RuntimeError('Nothing selected for deletion.') _, _, filePath, _, _, _, _ = _Database.getFileInfo(self._currentSelectedAsset) _Database.deleteFile(filePath) self._refreshAssetButtonView()