Пример #1
0
 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')
Пример #2
0
 def dataColumnForLookup(self,Node):
     attrib  = {
         'name' : 'value',
         'fullname' : 'Choice list',
         'type' : 'character varying',
         'size' : '50'
          }
     writeTableColumn(attrib,self.profile,Node,self.table,'columns')
Пример #3
0
 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')
Пример #4
0
 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")
Пример #5
0
 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')            
Пример #6
0
 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')
Пример #7
0
    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")
Пример #8
0
 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')
Пример #9
0
 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')
Пример #10
0
 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')
Пример #11
0
    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")