def login(self): server = unicode(self.tServer.text()) port = unicode(self.tPort.text()) host = '%s:%s' % (str(server), str(port)) user = unicode(self.tAuthor.text()) password = unicode(self.tPassword.text()) pms.login(host, user, password, os.path.join(PILLARS_HOME, 'cookie')) self.loginButton.setIcon(QtGui.QIcon(QtGui.QPixmap(':/bool_true.png'))) projs = pms.projects() if not projs: return False for proj in projs: item = QtGui.QListWidgetItem(proj.name()) item.setData(1, proj.getAttribute('id')) self.projects_list.addItem(item) self.__user_data.setAttribute('server', server) self.__user_data.setAttribute('port', port) self.__user_data.setAttribute('user', user) self.__user_data.setAttribute('password', password) self.__user_data.save() self.showMessage(u'Hello: %s, Select a project.' % user) return True
def loadProjects(self): projs = pms.projects() if not projs: return False for proj in projs: item = AssetListItem(proj) self.projects_list.addItem(item) return True
def connectPMS(self): sel_dialog = pqt.SelectDialog(self) projects = pms.projects() for proj in projects: item = QtGui.QListWidgetItem(proj.name()) item.setData(1, proj.getAttribute('id')) sel_dialog.list.addItem(item) if sel_dialog.exec_() == QtGui.QDialog.Accepted: sel_item = sel_dialog.list.currentItem() self.proj_name = unicode(sel_item.text()) self.proj_id = unicode(sel_item.data(1).toString()) self.updata_assets() return True else: return False