def tableCapabilities(self): options=['create', 'select', 'update', 'delete'] capabilities={} for opt in options: capabilities['name'] = opt capabilities['code'] = setUniversalCode() writeTableColumn(capabilities, self.profile, 'table', self.table, 'contentgroups')
def dataColumnForLookup(self,Node): attrib = { 'name' : 'value', 'fullname' : 'Choice list', 'type' : 'character varying', 'size' : '50' } writeTableColumn(attrib,self.profile,Node,self.table,'columns')
def enforceProjection(self): if self.geomCollection: geom={} geom['table'] = self.tableName geom['srid'] = self.geomCollection[0] geom['column'] = formatColumnName(self.txtCol.text()) geom['type'] = self.geomCollection[1] geom['arguments'] = '2' writeTableColumn(geom,self.profile,'table',self.tableName,'constraints')
def enforceProjection(self): if self.geomCollection: geom = {} geom["table"] = self.tableName geom["srid"] = self.geomCollection[0] geom["column"] = formatColumnName(self.txtCol.text()) geom["type"] = self.geomCollection[1] geom["arguments"] = "2" writeTableColumn(geom, self.profile, "table", self.tableName, "geometryz")
def setTableRelation(self): '''add new relation to the table in the config file''' attribDict={} attribDict['name']=formatColumnName(self.txtCol.text())+"_id" attribDict['table']=self.lookup attribDict['column']="id" attribDict['ondelete']="NO ACTION" attribDict['onupdate']="NO ACTION" writeTableColumn(attribDict,self.profile,'table',self.tableName,'relations')
def autoCreatePrimaryKeyColumn(self,Node): """Allow automatic created of primary column in the table""" attrib = { 'name' : 'id', 'fullname' : 'Primary Key', 'type' : 'serial', 'size' : '', 'key' : '1' } writeTableColumn(attrib,self.profile,Node,self.table,'columns')
def setTableRelation(self): """add new relation to the table in the config file""" attribDict = {} attribDict["name"] = formatColumnName(self.txtCol.text()) + "_id" attribDict["table"] = self.lookup attribDict["column"] = "id" attribDict["ondelete"] = "NO ACTION" attribDict["onupdate"] = "NO ACTION" writeTableColumn(attribDict, self.profile, "table", self.tableName, "relations")
def setTableRelation(self): '''add new relation to the table in the config file''' delAct=UserData(self.cboDelAct) updateAct=UserData(self.cboUpAct) attribDict={} attribDict['name']=formatColumnName(self.txtName.text()) attribDict['table']=self.cboTable.currentText() attribDict['fk']=self.cboRefCol.currentText() attribDict['column']=self.cboColumn.currentText() attribDict['ondelete']=delAct attribDict['onupdate']=updateAct writeTableColumn(attribDict,self.userProfile,'table',self.tableName,'relations')
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')
def writeAttributeData(self): #Flush the new attribute data to the xml file atType=UserData(self.cboDatatype) if atType 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 atType in self.defaults: sizeval='' if atType not in self.defaults: sizeval=self.txtAttrib.text() attribData=self.attributeData(sizeval) self.tableName=self.cboTabList.currentText() if str(self.tableName).startswith("check"): writeTableColumn(attribData,self.profile,'lookup',self.tableName,'columns') else: if atType=='geometry': self.InfoMessage(QApplication.translate("AttributeEditor","Geometry column will not appear in the list of column but it is loaded in the background")) self.enforceProjection() else: writeTableColumn(attribData,self.profile,'table',self.tableName,'columns')
def writeAttributeData(self): # Flush the new attribute data to the xml file atType = UserData(self.cboDatatype) if atType in self.defaults: sizeval = "" if atType not in self.defaults: sizeval = self.txtAttrib.text() attribData = self.attributeData(sizeval) self.tableName = self.cboTabList.currentText() if str(self.tableName).startswith("check"): writeTableColumn(attribData, self.profile, "lookup", self.tableName, "columns") else: if atType == "geometry": self.InfoMessage( QApplication.translate( "AttributeEditor", "Geometry column will not appear in the list of column but can be viewed under geometry tab", ) ) self.geomtag() self.enforceProjection() else: writeTableColumn(attribData, self.profile, "table", self.tableName, "columns")