def create_project(self): """ This method creates a project if it does not exit in the database. :return: none """ text, ok_pressed = QtWidgets.QInputDialog.getText(self.project_tab, "Create New Project", "Name of Project:", QtWidgets.QLineEdit.Normal, "") if ok_pressed and text != '': db_names = DBConnection.get_db() if text in db_names: msg = ErrorDialog(self.project_tab,"Project with that name already exists", "Error Creating Project") msg.exec_() return self.project_tab.lineEdit_2.setText(text) self.project_tab.textEdit_2.setText("") self.project_tab.lineEdit_3.setText("") self.project_tab.textEdit_2.setReadOnly(False) self.set_binary_prop() self.project_name = text self.project_tab.listWidget.addItem(text) item = self.project_tab.listWidget.findItems(text, QtCore.Qt.MatchExactly) self.project_tab.listWidget.setCurrentItem(item[0]) self.project_tab.setWindowTitle('Create Project') saved = True self.create_operations(self.project_creation_started, [self.project_tab.pushButton_7], [self.project_tab.pushButton_8, self.project_tab.pushButton_10], self.project_tab.listWidget)
def search_projects(self): """ This method gets all the existing projects from the database. :return: none """ cursor = DBConnection.get_db() self.project_tab.listWidget.clear() for db in cursor: if db not in ['admin', 'local', 'config', 'plugin']: self.project_tab.listWidget.addItem(db)