def gotoProject(self, item): name = item.asset.name() aid = item.asset.getAttribute('id') work_path = os.path.join(user_data.getAttribute('workspace'), 'Project') work_path = os.path.join(work_path, name) if not os.path.isdir(work_path): os.makedirs(work_path) os.chdir(work_path) proj_path = os.path.join(user_data.getAttribute('project_root'), name) penv.setWorkspace(work_path) penv.setProject(str(name)) penv.setProjectID(str(aid)) penv.setProjectPath(str(proj_path)) penv.setJob(str(proj_path)) ts = pms.myTasks(aid.replace('p', '')) self.tasks_list.clear() for t in ts: a = pms.asset(task_id = t.getAttribute('id')) item = AssetListItem(t, a) self.tasks_list.addItem(item) self.goto_project.emit(name) return True
def gotoProject(self): sel_item = self.projects_list.currentItem() if not sel_item: return False name = unicode(sel_item.text()) aid = unicode(sel_item.data(1).toString()) os.environ['PILLARS_PROJECT'] = str(name) os.environ['PILLARS_PROJECT_ID'] = str(aid) ts = pms.myTasks(aid.replace('p', '')) self.tasks_list.clear() for t in ts: task_id = t.getAttribute('id') a = pms.asset(task_id = task_id) item = QtGui.QListWidgetItem('%s : %s' % (a.name(), t.name())) item.setData(1, task_id) self.tasks_list.addItem(item) self.showMessage(u'Into Project < %s >, Select a task.' % name) return True