def updateVersInfo(self): try: ver = self.versions[int(vers)-1] spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers, elpass) self.verCreatedBy.setText(ver["created_by"]) self.verCreatedAt.setText(ueCore.formatDatetime(ver["created_at"])) files = glob.glob(os.path.join(ver["path"], ver["file_name"]+"*")) self.verFilesList.clear() for f in sorted(files): self.verFilesList.addItem(QtGui.QListWidgetItem(os.path.basename(f))) if "comment" in ver: self.verComment.setText(ver["comment"]) else: self.verComment.setText("N/A") if "thumbnail" in ver: spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers) f = ueAssetUtils.getThumbnailPath(spec) img = QtGui.QImage(f) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) else: img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png")) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) except IndexError: pass
def updateVersInfo(self): try: ver = self.versions[int(vers) - 1] spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers, elpass) self.verCreatedBy.setText(ver["created_by"]) self.verCreatedAt.setText(ueCore.formatDatetime(ver["created_at"])) files = glob.glob(os.path.join(ver["path"], ver["file_name"] + "*")) self.verFilesList.clear() for f in sorted(files): self.verFilesList.addItem(QtGui.QListWidgetItem(os.path.basename(f))) if "comment" in ver: self.verComment.setText(ver["comment"]) else: self.verComment.setText("N/A") if "thumbnail" in ver: spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname, vers) f = ueAssetUtils.getThumbnailPath(spec) img = QtGui.QImage(f) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) else: img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png")) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.verThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) except IndexError: pass
def printInfo(): if "spec" not in info: print "ERROR: Spec not set" sys.exit(2) spec = ueSpec.Spec(info["spec"]) if spec.grp == None: # Project info assetType = "project" assetInfo = ueAssetUtils.getProject(spec) elif spec.asst == None: # Group info assetType = "group" assetInfo = ueAssetUtils.getGroup(spec) elif spec.elclass == None and \ spec.eltype == None and \ spec.elname == None: # Asset info assetType = "asset" assetInfo = ueAssetUtils.getAsset(spec) elif spec.vers == None: # Element info assetType = "element" assetInfo = ueAssetUtils.getElement(spec) assetInfo = assetInfo[spec.elclass][spec.eltype][spec.elname] elif spec.elpass == None: # Version info assetType = "version" assetInfo = ueAssetUtils.getVersions(spec)[int(spec.vers)-1] else: print "ERROR: Could not identify spec as a valid element" sys.exit(2) print "Information on %s:\n%s\n" % (assetType, str(info["spec"])) for a in sorted(assetInfo): # Get a padding value so the key/value columns will be neatly aligned spacePadding = 28-len(a) # Parse the version and datetime info correctly if a == "versions": assetInfo[a] = len(assetInfo[a]) elif a in ["created_at", "updated_at"]: assetInfo[a] = ueCore.formatDatetime(str(assetInfo[a])) # Get rid of the keys with _id because they're database stuff if not re.match(".*_id$", a): print "%s:%s%s" % (a, " "*spacePadding, str(assetInfo[a])) print ""
def printInfo(): if "spec" not in info: print "ERROR: Spec not set" sys.exit(2) spec = ueSpec.Spec(info["spec"]) if spec.grp == None: # Project info assetType = "project" assetInfo = ueAssetUtils.getProject(spec) elif spec.asst == None: # Group info assetType = "group" assetInfo = ueAssetUtils.getGroup(spec) elif spec.elclass == None and \ spec.eltype == None and \ spec.elname == None: # Asset info assetType = "asset" assetInfo = ueAssetUtils.getAsset(spec) elif spec.vers == None: # Element info assetType = "element" assetInfo = ueAssetUtils.getElement(spec) assetInfo = assetInfo[spec.elclass][spec.eltype][spec.elname] elif spec.elpass == None: # Version info assetType = "version" assetInfo = ueAssetUtils.getVersions(spec)[int(spec.vers) - 1] else: print "ERROR: Could not identify spec as a valid element" sys.exit(2) print "Information on %s:\n%s\n" % (assetType, str(info["spec"])) for a in sorted(assetInfo): # Get a padding value so the key/value columns will be neatly aligned spacePadding = 28 - len(a) # Parse the version and datetime info correctly if a == "versions": assetInfo[a] = len(assetInfo[a]) elif a in ["created_at", "updated_at"]: assetInfo[a] = ueCore.formatDatetime(str(assetInfo[a])) # Get rid of the keys with _id because they're database stuff if not re.match(".*_id$", a): print "%s:%s%s" % (a, " " * spacePadding, str(assetInfo[a])) print ""
def updateElInfo(self): try: el = self.elements[elclass][eltype][elname] self.elCreatedBy.setText(el["created_by"]) self.elCreatedAt.setText(ueCore.formatDatetime(el["created_at"])) if not el["comment"] == None: self.elComment.setText(el["comment"]) else: self.elComment.setText("N/A") if not el["thumbnail"] == None: spec = ueSpec.Spec(proj, grp, asst, elclass, eltype, elname) f = ueAssetUtils.getThumbnailPath(spec) img = QtGui.QImage(f) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.elThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) else: img = QtGui.QImage(os.path.join(os.getenv("UE_PATH"), "lib", "placeholders", "thumbnail.png")) imgs = img.scaled(200, 80, aspectRatioMode=QtCore.Qt.KeepAspectRatio) self.elThumb.setPixmap(QtGui.QPixmap.fromImage(imgs)) except KeyError: pass
def printTree(): if "spec" not in info: print "ERROR: Spec not set" sys.exit(2) spec = ueSpec.Spec(info["spec"]) print "Asset tree on asset:" print spec print "|" groups = ueAssetUtils.getGroupsList(spec) lastGroup = "|" for g, group in enumerate(sorted(groups)): spec.grp = group group = ueAssetUtils.getGroup(spec) if g == len(groups) - 1: lastGroup = " " groupSpaceCount = 34 printLine = "+-+-> %s" % group["name"] printLine += (groupSpaceCount - len(printLine)) * " " if info["time"]: printLine += "%s - %s" % (str(group["startFrame"]), str(group["endFrame"])) groupSpaceCount += 10 printLine += (groupSpaceCount - len(printLine)) * " " if info["path"]: printLine += group["path"] groupSpaceCount += 30 printLine += (groupSpaceCount - len(printLine)) * " " if info["date"]: printLine += "%s, %s" % ( ueCore.formatDatetime(group["created_at"]), ueCore.formatDatetime(group["updated_at"]), ) groupSpaceCount += 38 printLine += (groupSpaceCount - len(printLine)) * " " if info["user"]: printLine += group["created_by"] print printLine assets = ueAssetUtils.getAssetsList(spec) for asset in sorted(assets): spec.asst = asset asset = ueAssetUtils.getAsset(spec) assetSpaceCount = 34 printLine = "%s +---> %s" % (lastGroup, asset["name"]) printLine += (assetSpaceCount - len(printLine)) * " " if info["time"]: printLine += "%s - %s" % (str(asset["startFrame"]), str(asset["endFrame"])) assetSpaceCount += 10 printLine += (assetSpaceCount - len(printLine)) * " " if info["path"]: printLine += group["path"] assetSpaceCount += 30 printLine += (assetSpaceCount - len(printLine)) * " " if info["date"]: printLine += "%s, %s" % ( ueCore.formatDatetime(asset["created_at"]), ueCore.formatDatetime(asset["updated_at"]), ) assetSpaceCount += 38 printLine += (assetSpaceCount - len(printLine)) * " " if info["user"]: printLine += asset["created_by"] print printLine print ""