Skip to content
Permalink
Browse files

indentation update

  • Loading branch information
jef-n committed Apr 2, 2013
1 parent 7d34f02 commit d5dcaa3e4155a384ea6f74efc2397bc98c91b4a7
@@ -84,18 +84,18 @@ def getName(self):

def getIcon(self):
return QIcon(os.path.dirname(__file__) + "/../images/grass.png")

def getPostProcessingErrorMessage(self, wrongLayers):
html = AlgorithmProvider.getPostProcessingErrorMessage(self, wrongLayers)
html = AlgorithmProvider.getPostProcessingErrorMessage(self, wrongLayers)
msg = GrassUtils.checkGrassIsInstalled(True)
html += ("<p>This algorithm requires GRASS to be run. A test to check if GRASS is correctly installed "
html += ("<p>This algorithm requires GRASS to be run. A test to check if GRASS is correctly installed "
"and configured in your system has been performed, with the following result:</p><ul><i>")
if msg is None:
html += "GRASS seems to be correctly installed and configured</li></ul>"
else:
html += msg + "</i></li></ul>"
html += '<p><a href= "http://docs.qgis.org/html/en/docs/user_manual/sextante/3rdParty.html">Click here</a> to know more about how to install and configure GRASS to be used with SEXTANTE</p>'

return html

def getSupportedOutputVectorLayerExtensions(self):
@@ -343,7 +343,7 @@ def checkGrassIsInstalled(ignoreRegistrySettings=False):
if settings.contains(GRASS_INSTALLED):
return

try:
try:
from sextante.core.Sextante import runalg
result = runalg("grass:v.voronoi", points(),False,False,"270778.60198,270855.745301,4458921.97814,4458983.8488",-1,0.0001,None)
if not os.path.exists(result['output']):
@@ -151,16 +151,16 @@ def fillTree(self):

def addRecentAlgorithms(self, updating):
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent:
if showRecent:
recent = SextanteLog.getRecentAlgorithms()
if len(recent) != 0:
found = False
if updating:
recentItem = self.algorithmTree.topLevelItem(0)
treeWidget = recentItem.treeWidget()
treeWidget.takeTopLevelItem(treeWidget.indexOfTopLevelItem(recentItem))
treeWidget = recentItem.treeWidget()
treeWidget.takeTopLevelItem(treeWidget.indexOfTopLevelItem(recentItem))
#self.algorithmTree.removeItemWidget(first, 0)

recentItem = QTreeWidgetItem()
recentItem.setText(0, self.tr("Recently used algorithms"))
for algname in recent:
@@ -169,7 +169,7 @@ def addRecentAlgorithms(self, updating):
algItem = TreeAlgorithmItem(alg)
recentItem.addChild(algItem)
found = True
if found:
if found:
self.algorithmTree.insertTopLevelItem(0, recentItem)
recentItem.setExpanded(True)

@@ -13,23 +13,22 @@
x = 0
y = 0
for ft in features:
c = ft.geometry().centroid().asPoint()
c = ft.geometry().centroid().asPoint()
x += c.x()
y += c.y()
y += c.y()
attrs = ft.attributes()
for f in range(len(fields)):
try:
mean[f] += float(attrs[f].toDouble()[0])
except:
pass
count += 1
count += 1
if count != 0:
mean = [value / count for value in mean]
x /= count
y /= count
outFeat = QgsFeature()
y /= count
outFeat = QgsFeature()
meanPoint = QgsPoint(x, y)
outFeat.setGeometry(QgsGeometry.fromPoint(meanPoint))
outFeat.setAttributes([QVariant(v) for v in mean])
outputLayer.addFeature(outFeat)

@@ -19,7 +19,7 @@ def test_sagametricconversions(self):
dataset=gdal.Open(output, GA_ReadOnly)
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
self.assertEqual(strhash,-2137931723)

def test_sagasortgrid(self):
outputs=sextante.runalg("saga:sortgrid",raster(),True,None)
output=outputs['OUTPUT']
@@ -28,8 +28,8 @@ def test_sagasortgrid(self):
strhash=hash(str(dataset.ReadAsArray(0).tolist()))
self.assertEqual(strhash,1320073153)

'''the following tests are not meant to test the algorithms themselves,
but the algorithm provider, testing things such as the file conversion,
'''the following tests are not meant to test the algorithms themselves,
but the algorithm provider, testing things such as the file conversion,
the selection awareness of SAGA process, etc'''

def test_SagaVectorAlgorithmWithSelection(self):
@@ -268,8 +268,8 @@ void QgsDualView::previewColumnChanged( QObject* action )
QMessageBox::warning( this
, tr( "Could not set preview column" )
, tr( "Could not set column '%1' as preview column.\nParser error:\n%2" )
.arg( previewAction->text() )
.arg( mFeatureList->parserErrorString() )
.arg( previewAction->text() )
.arg( mFeatureList->parserErrorString() )
);
}

@@ -55,7 +55,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(
cbxIgnoreAxisOrientation->setChecked( settings.value( key + "/ignoreAxisOrientation", false ).toBool() );
cbxInvertAxisOrientation->setChecked( settings.value( key + "/invertAxisOrientation", false ).toBool() );
cbxIgnoreGetFeatureInfoURI->setChecked( settings.value( key + "/ignoreGetFeatureInfoURI", false ).toBool() );

txtReferer->setText( settings.value( key + "/referer" ).toString() );

txtUserName->setText( settings.value( credentialsKey + "/username" ).toString() );
@@ -81,7 +81,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(

cbxIgnoreGetFeatureInfoURI->setVisible( false );
mGroupBox->layout()->removeWidget( cbxIgnoreGetFeatureInfoURI );

txtReferer->setVisible( false );
mGroupBox->layout()->removeWidget( txtReferer );
lblReferer->setVisible( false );
@@ -26,7 +26,7 @@ QgsDataDefinedSymbolDialog::QgsDataDefinedSymbolDialog( const QMap< QString, QPa
QCheckBox* cb = new QCheckBox( this );
cb->setChecked( !it.value().second.isEmpty() );
mTableWidget->setCellWidget( i, 0, cb );
mTableWidget->setColumnWidth(0, cb->width() );
mTableWidget->setColumnWidth( 0, cb->width() );


//property name
@@ -94,8 +94,8 @@ QgsWFSSourceSelect::QgsWFSSourceSelect( QWidget* parent, Qt::WFlags fl, bool emb
mModelProxy->setSortCaseSensitivity( Qt::CaseInsensitive );
treeView->setModel( mModelProxy );

connect( treeView, SIGNAL( doubleClicked(const QModelIndex&) ), this, SLOT( on_treeWidget_itemDoubleClicked(const QModelIndex&) ) );
connect( treeView->selectionModel(), SIGNAL( currentRowChanged ( QModelIndex, QModelIndex) ), this, SLOT( on_treeWidget_currentRowChanged(const QModelIndex&, const QModelIndex&) ) );
connect( treeView, SIGNAL( doubleClicked( const QModelIndex& ) ), this, SLOT( on_treeWidget_itemDoubleClicked( const QModelIndex& ) ) );
connect( treeView->selectionModel(), SIGNAL( currentRowChanged( QModelIndex, QModelIndex ) ), this, SLOT( on_treeWidget_currentRowChanged( const QModelIndex&, const QModelIndex& ) ) );
}

QgsWFSSourceSelect::~QgsWFSSourceSelect()
@@ -229,7 +229,7 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished()
cachedItem->setCheckState( Qt::Checked );

typedef QList< QStandardItem* > StandardItemList;
mModel->appendRow( StandardItemList() << titleItem << nameItem << abstractItem << cachedItem << filterItem);
mModel->appendRow( StandardItemList() << titleItem << nameItem << abstractItem << cachedItem << filterItem );

// insert the available CRS into mAvailableCRS
std::list<QString> currentCRSList;
@@ -246,16 +246,16 @@ void QgsWFSSourceSelect::capabilitiesReplyFinished()
treeView->resizeColumnToContents( 1 );
treeView->resizeColumnToContents( 2 );
treeView->resizeColumnToContents( 3 );
for ( int i = 0; i < 2; i++ )
for ( int i = 0; i < 2; i++ )
{
if ( treeView->columnWidth( i ) > 300 )
{
treeView->setColumnWidth( i, 300 );
}
if ( treeView->columnWidth( i ) > 300 )
{
treeView->setColumnWidth( i, 300 );
}
}
if ( treeView->columnWidth( 2 ) > 150 )
{
treeView->setColumnWidth( 2, 150 );
treeView->setColumnWidth( 2, 150 );
}
btnChangeSpatialRefSys->setEnabled( true );
treeView->selectionModel()->select( mModel->index( 0, 0 ), QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
@@ -311,7 +311,7 @@ void QgsWFSSourceSelect::connectToServer()
btnConnect->setEnabled( false );
if ( mModel )
{
mModel->removeRows( 0, mModel->rowCount() );
mModel->removeRows( 0, mModel->rowCount() );
}
if ( mCapabilities )
{
@@ -382,7 +382,7 @@ void QgsWFSSourceSelect::addLayer()
QString layerName = typeName;
if ( cbxUseTitleLayerName->isChecked() && !titleName.isEmpty() )
{
layerName = titleName;
layerName = titleName;
}
QgsDebugMsg( "Layer " + typeName + " Filter is " + filter );
//is "cache features" checked?
@@ -401,44 +401,44 @@ void QgsWFSSourceSelect::addLayer()

void QgsWFSSourceSelect::buildQuery( const QModelIndex& index )
{
if ( !index.isValid() )
{
return;
}
QModelIndex filterIndex = index.sibling( index.row(), 4 );
QString typeName = index.sibling( index.row(), 1 ).data().toString();

//get available fields for wfs layer
QgsWFSProvider p( "" ); //bypasses most provider instantiation logic
QgsOWSConnection connection( "WFS", cmbConnections->currentText() );
QgsWFSCapabilities conn( connection.uri().encodedUri() );
QString uri = conn.uriDescribeFeatureType( typeName );

QgsFields fields;
QString geometryAttribute;
QGis::WkbType geomType;
if ( p.describeFeatureType( uri, geometryAttribute, fields, geomType ) != 0 )
{
return;
}
if ( !index.isValid() )
{
return;
}
QModelIndex filterIndex = index.sibling( index.row(), 4 );
QString typeName = index.sibling( index.row(), 1 ).data().toString();

//show expression builder
QgsExpressionBuilderDialog d( 0, filterIndex.data().toString() );
//get available fields for wfs layer
QgsWFSProvider p( "" ); //bypasses most provider instantiation logic
QgsOWSConnection connection( "WFS", cmbConnections->currentText() );
QgsWFSCapabilities conn( connection.uri().encodedUri() );
QString uri = conn.uriDescribeFeatureType( typeName );

//add available attributes to expression builder
QgsExpressionBuilderWidget* w = d.expressionBuilder();
if ( !w )
{
return;
}
QgsFields fields;
QString geometryAttribute;
QGis::WkbType geomType;
if ( p.describeFeatureType( uri, geometryAttribute, fields, geomType ) != 0 )
{
return;
}

w->loadFieldNames( fields );
//show expression builder
QgsExpressionBuilderDialog d( 0, filterIndex.data().toString() );

if ( d.exec() == QDialog::Accepted )
{
QgsDebugMsg( "Expression text = " + w->expressionText() );
mModelProxy->setData( filterIndex, QVariant( w->expressionText() ) );
}
//add available attributes to expression builder
QgsExpressionBuilderWidget* w = d.expressionBuilder();
if ( !w )
{
return;
}

w->loadFieldNames( fields );

if ( d.exec() == QDialog::Accepted )
{
QgsDebugMsg( "Expression text = " + w->expressionText() );
mModelProxy->setData( filterIndex, QVariant( w->expressionText() ) );
}
}

void QgsWFSSourceSelect::changeCRS()
@@ -452,7 +452,7 @@ void QgsWFSSourceSelect::changeCRS()

void QgsWFSSourceSelect::changeCRSFilter()
{
QgsDebugMsg("changeCRSFilter called");
QgsDebugMsg( "changeCRSFilter called" );
//evaluate currently selected typename and set the CRS filter in mProjectionSelector
QModelIndex currentIndex = treeView->selectionModel()->currentIndex();
if ( currentIndex.isValid() )
@@ -527,7 +527,7 @@ void QgsWFSSourceSelect::on_treeWidget_itemDoubleClicked( const QModelIndex& ind
buildQuery( index );
}

void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous)
void QgsWFSSourceSelect::on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous )
{
Q_UNUSED( previous )
QgsDebugMsg( "treeWidget_currentRowChanged called" );
@@ -542,7 +542,7 @@ void QgsWFSSourceSelect::on_mBuildQueryButton_clicked()
buildQuery( treeView->selectionModel()->currentIndex() );
}

void QgsWFSSourceSelect::filterChanged(QString text)
void QgsWFSSourceSelect::filterChanged( QString text )
{
QgsDebugMsg( "WFS FeatureType filter changed to :" + text );
QRegExp::PatternSyntax mySyntax = QRegExp::PatternSyntax( QRegExp::RegExp );
@@ -552,16 +552,16 @@ void QgsWFSSourceSelect::filterChanged(QString text)
mModelProxy->sort( mModelProxy->sortColumn(), mModelProxy->sortOrder() );
}

QSize QgsWFSItemDelegate::sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
QSize QgsWFSItemDelegate::sizeHint( const QStyleOptionViewItem & option, const QModelIndex & index ) const
{
QVariant indexData;
indexData = index.data(Qt::DisplayRole);
if ( indexData.isNull() )
{
return QSize();
}
QString data = indexData.toString();
QSize size = option.fontMetrics.boundingRect(data).size();
size.setHeight(size.height() + 2);
return size;
QVariant indexData;
indexData = index.data( Qt::DisplayRole );
if ( indexData.isNull() )
{
return QSize();
}
QString data = indexData.toString();
QSize size = option.fontMetrics.boundingRect( data ).size();
size.setHeight( size.height() + 2 );
return size;
}
@@ -30,13 +30,13 @@ class QgsWFSCapabilities;

class QgsWFSItemDelegate : public QItemDelegate
{
Q_OBJECT
Q_OBJECT

public:

QgsWFSItemDelegate(QObject *parent=0) : QItemDelegate(parent){ }
QgsWFSItemDelegate( QObject *parent = 0 ) : QItemDelegate( parent ) { }

virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
virtual QSize sizeHint( const QStyleOptionViewItem &option, const QModelIndex &index ) const;

};

@@ -92,9 +92,9 @@ class QgsWFSSourceSelect: public QDialog, private Ui::QgsWFSSourceSelectBase
void on_btnSave_clicked();
void on_btnLoad_clicked();
void on_treeWidget_itemDoubleClicked( const QModelIndex & index );
void on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous);
void on_treeWidget_currentRowChanged( const QModelIndex & current, const QModelIndex & previous );
void on_mBuildQueryButton_clicked();
void filterChanged(QString text);
void filterChanged( QString text );

void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }

0 comments on commit d5dcaa3

Please sign in to comment.
You can’t perform that action at this time.