def accept(self): if str(self.txtCol.text()).lower() == RESERVED_ID or str(self.txtCol.text()).lower() in self.defaults: self.ErrorInfoMessage( QApplication.translate( "AttributeEditor", "(%s) " "is a reserved word and cannot be used for column name" ) % (self.txtCol.text()) ) return if self.tableName == None: self.ErrorInfoMessage(QApplication.translate("AttributeEditor", "No selected table found")) return if UserData(self.cboDatatype) not in self.defaults and self.txtAttrib.text() == "": self.ErrorInfoMessage(QApplication.translate("AttributeEditor", "Attribute length is not given")) return if self.txtCol.text() == "": self.ErrorInfoMessage(QApplication.translate("AttributeEditor", "Column name is not given")) return if self.args != None: self.updateColumnData() if self.args == None: if table_column_exist(self.profile, self.tableName, formatColumnName(self.txtCol.text())): QMessageBox.critical( self, QApplication.translate("AttributeEditor", "Duplicate Column"), QApplication.translate("AttributeEditor", "The entered column name already exist"), ) return else: self.writeAttributeData() self.clearControls() self.close()
def autoCreatePrimaryKeyColumn(self,Node): """Allow automatic created of primary column in the table""" attrib = { 'name' : 'id', 'fullname' : 'Primary Key', 'type' : 'serial', 'size' : '', 'key' : '1' } if table_column_exist(self.profile, self.table, 'id'): return QMessageBox.information(self, "ID exist", "Id exisit") else: writeTableColumn(attrib,self.profile,Node,self.table,'columns')