18 changes: 13 additions & 5 deletions python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,11 @@ IF(PYQT4_VERSION_NUM LESS 264196) # 0x040804
ENDIF(PYQT4_VERSION_NUM LESS 264196)

# core module
FILE(GLOB sip_files_core core/*.sip)
FILE(GLOB_RECURSE sip_files_core core/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.core.api)
ADD_SIP_PYTHON_MODULE(qgis.core core/core.sip qgis_core)
ADD_DEPENDENCIES(python_module_qgis_core ${sip_files_core})

# additional gui includes
INCLUDE_DIRECTORIES(
Expand All @@ -87,10 +88,11 @@ INCLUDE_DIRECTORIES(
)

# gui module
FILE(GLOB sip_files_gui gui/*.sip)
FILE(GLOB_RECURSE sip_files_gui gui/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_gui})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
ADD_SIP_PYTHON_MODULE(qgis.gui gui/gui.sip qgis_core qgis_gui)
ADD_DEPENDENCIES(python_module_qgis_gui python_module_qgis_core ${sip_files_gui})

# additional analysis includes
INCLUDE_DIRECTORIES(
Expand All @@ -105,16 +107,23 @@ INCLUDE_DIRECTORIES(
)

# analysis module
FILE(GLOB sip_files_analysis analysis/*.sip)
FILE(GLOB sip_files_analysis
analysis/*.sip
analysis/raster/*.sip
analysis/vector/*.sip
analysis/interpolation/*.sip
)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
ADD_SIP_PYTHON_MODULE(qgis.analysis analysis/analysis.sip qgis_core qgis_analysis)
ADD_DEPENDENCIES(python_module_qgis_analysis python_module_qgis_core ${sip_files_analysis})

# network-analysis module
FILE(GLOB sip_files_network_analysis analysis/network/*.sip)
FILE(GLOB_RECURSE sip_files_network_analysis analysis/network/*.sip)
SET(SIP_EXTRA_FILES_DEPEND ${sip_files_core} ${sip_files_network_analysis})
SET(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.networkanalysis.api)
ADD_SIP_PYTHON_MODULE(qgis.networkanalysis analysis/network/networkanalysis.sip qgis_core qgis_networkanalysis)
ADD_DEPENDENCIES(python_module_qgis_networkanalysis python_module_qgis_core ${sip_files_network_analysis})

SET (QGIS_PYTHON_DIR ${PYTHON_SITE_PACKAGES_DIR}/qgis)

Expand Down Expand Up @@ -143,4 +152,3 @@ PYTHON_INSTALL(utils.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(console_sci.py ${QGIS_PYTHON_DIR})
PYTHON_INSTALL(help.py ${QGIS_PYTHON_DIR})

2 changes: 1 addition & 1 deletion python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ class QgsRasterLayer : QgsMapLayer
virtual QStringList subLayers() const;

/** \brief Draws a thumbnail of the rasterlayer into the supplied pixmap pointer */
void thumbnailAsPixmap( QPixmap * theQPixmap );
void thumbnailAsPixmap( QPixmap * theQPixmap ) /Deprecated/;

/** \brief Draws a preview of the rasterlayer into a pixmap */
QPixmap previewAsPixmap( QSize size, QColor bgColor = QColor( 255, 255, 255 ) );
Expand Down
4 changes: 3 additions & 1 deletion src/core/raster/qgsrasterlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
/** Returns the data provider */
QgsRasterDataProvider* dataProvider();

/** Returns the data provider in a const-correct manner */
/** Returns the data provider in a const-correct manner
@note available in python bindings as constDataProvider()
*/
const QgsRasterDataProvider* dataProvider() const;

/**Synchronises with changes in the datasource
Expand Down
12 changes: 6 additions & 6 deletions src/gui/qgsattributeeditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,6 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed

case QgsVectorLayer::ValueRelation:
{
QSettings settings;
QString nullValue = settings.value( "qgis/nullValue", "NULL" ).toString();

const QgsVectorLayer::ValueRelationData &data = vl->valueRelation( idx );

QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( data.mLayer ) );
Expand All @@ -209,9 +206,6 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
if ( !data.mFilterAttributeColumn.isNull() )
fi = layer->fieldNameIndex( data.mFilterAttributeColumn );

if ( data.mAllowNull )
map.insert( nullValue, tr( "(no selection)" ) );

if ( ki >= 0 && vi >= 0 )
{
QgsAttributeList attributes;
Expand All @@ -236,6 +230,12 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
QComboBox *cb = comboBox( editor, parent );
if ( cb )
{
if ( data.mAllowNull )
{
QSettings settings;
cb->addItem( tr( "(no selection)" ), settings.value( "qgis/nullValue", "NULL" ).toString() );
}

for ( QMap< QString, QString >::const_iterator it = map.begin(); it != map.end(); it++ )
{
if ( data.mOrderByValue )
Expand Down
29 changes: 15 additions & 14 deletions src/providers/postgres/qgspostgresconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1021,28 +1021,29 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
{
QString table;

if ( !layerProperty.schemaName.isEmpty() )
{
table = QString("%1.%2").arg( quotedIdentifier( layerProperty.schemaName ) ).arg( layerProperty.tableName );
}
else
{
// Query
table = layerProperty.tableName;
}


// it is possible that the where clause restricts the feature type or srid
if ( useEstimatedMetadata )
{
table = QString( "(SELECT %1 FROM %2.%3 WHERE %1 IS NOT NULL%4 LIMIT %5) AS t" )
table = QString( "(SELECT %1 FROM %2 WHERE %1 IS NOT NULL%3 LIMIT %4) AS t" )
.arg( quotedIdentifier( layerProperty.geometryColName ) )
.arg( quotedIdentifier( layerProperty.schemaName ) )
.arg( quotedIdentifier( layerProperty.tableName ) )
.arg( table )
.arg( layerProperty.sql.isEmpty() ? "" : QString( " AND (%1)" ).arg( layerProperty.sql ) )
.arg( sGeomTypeSelectLimit );
}
else if ( !layerProperty.schemaName.isEmpty() )
{
table = QString( "%1.%2%3" )
.arg( quotedIdentifier( layerProperty.schemaName ) )
.arg( quotedIdentifier( layerProperty.tableName ) )
.arg( layerProperty.sql.isEmpty() ? "" : QString( " WHERE %1" ).arg( layerProperty.sql ) );
}
else
else if( !layerProperty.sql.isEmpty() )
{
table = QString( "%1%2" )
.arg( layerProperty.tableName )
.arg( layerProperty.sql.isEmpty() ? "" : QString( " WHERE %1" ).arg( layerProperty.sql ) );
table += QString( " WHERE %1" ).arg( layerProperty.sql );
}

QString query = QString( "SELECT DISTINCT"
Expand Down
12 changes: 10 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2778,8 +2778,16 @@ bool QgsPostgresProvider::getGeometryDetails()
if ( QgsPostgresConn::wkbTypeFromPostgis( detectedType ) == QGis::WKBUnknown )
{
QgsPostgresLayerProperty layerProperty;
layerProperty.schemaName = schemaName;
layerProperty.tableName = tableName;
if( !mIsQuery )
{
layerProperty.schemaName = schemaName;
layerProperty.tableName = tableName;
}
else
{
layerProperty.schemaName = "";
layerProperty.tableName = mQuery;
}
layerProperty.geometryColName = mGeometryColumn;
layerProperty.isGeography = mIsGeography;

Expand Down