def getProjectsBanner(self): projectName = str(self.ui.ProjectsEDIT.text()) # Don't requery for the project banner if its there if self.currentProjectName == projectName: return self.currentProjectName = projectName self.ui.ProjectsEDIT.currentProject = Project.recordByName(projectName) sgProj = sg.find_one( "Project", [["name", "is", projectName]], ["billboard"] ) if sgProj: if sgProj["billboard"]: billboardPath = sgProj["billboard"]["url"] if billboardPath: urllib.urlretrieve(billboardPath, self.BANNERPATH) if os.path.exists(self.BANNERPATH): bannerPixmap = QPixmap( self.ui.ProjectBannerView.maximumWidth(), self.ui.ProjectBannerView.maximumHeight() ) didLoad = bannerPixmap.load(self.BANNERPATH) # We actually don't care about the height # since this will be clamped from the width self.ui.ProjectBannerView.setPixmap( bannerPixmap.scaled(244, 200, Qt.KeepAspectRatio) ) self.ui.ProjectBannerView.setAlignment(Qt.AlignCenter) self.ui.ProjectBannerView.setScaledContents(True) # For some reason, calling the window repaint # fixes the issue with the flickering self.ui.header.show() self.repaint() self.parent.repaint()
def getPresets(self): aType = AssetType.recordByName("Project") fType = FileType.recordByAssetTypeAndId(aType, "Blast::Prefs") prefsPath = fType.fullPath(self.project) if not os.path.exists(prefsPath): # Use the prefs stored in _virtual_project as a default to fall back on # if the current project doesn't have a prefs file. prefsPath = fType.fullPath(Project.recordByName('_virtual_project')) presetsPath = os.path.normpath( os.path.join(prefsPath, "presets.json") ) with open(presetsPath, "r") as fileinfo: filesdata = fileinfo.read() presets = json.loads(filesdata) return presets
def getProjects(self): activeProjects = Project.recordsByProjectStatus(ProjectStatus(4)) return activeProjects