Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 24th, 2012  |  syntax: None  |  size: 0.71 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. URI problem in PYQGIS
  2. # create the layer                      
  3.             uri = self.db.getURI()
  4.             uri.setDataSource("", "(" + query + ")", geomFieldName, "", uniqueFieldName)
  5.             vl = self.iface.addVectorLayer(uri.uri(), newLayerName, self.db.getProviderName())
  6.  
  7.             QApplication.restoreOverrideCursor()
  8.  
  9.             if vl and vl.isValid():
  10.                     self.saveQuery()
  11.                     self.accept()
  12.        
  13. def getURI(self):
  14.             # returns a new QgsDataSourceURI instance
  15.  
  16.             return qgis.core.QgsDataSourceURI( self.uri.connectionInfo() )
  17.        
  18. return qgis.core.QgsDataSourceURI( self.uri.connectionInfo() )
  19. AttributeError: 'NoneType' object has no attribute 'connectionInfo'