Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 2, 2013
1 parent 7d34f02 commit d5dcaa3
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 94 deletions.
8 changes: 4 additions & 4 deletions python/plugins/sextante/grass/GrassAlgorithmProvider.py
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/grass/GrassUtils.py
Expand Up @@ -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']):
Expand Down
10 changes: 5 additions & 5 deletions python/plugins/sextante/gui/SextanteToolbox.py
Expand Up @@ -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:
Expand All @@ -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)

Expand Down
11 changes: 5 additions & 6 deletions python/plugins/sextante/script/scripts/Summarize.py
Expand Up @@ -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)

6 changes: 3 additions & 3 deletions python/plugins/sextante/tests/SagaTest.py
Expand Up @@ -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']
Expand All @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/gui/attributetable/qgsdualview.cpp
Expand Up @@ -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() )
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsnewhttpconnection.cpp
Expand Up @@ -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() );
Expand All @@ -81,7 +81,7 @@ QgsNewHttpConnection::QgsNewHttpConnection(

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

txtReferer->setVisible( false );
mGroupBox->layout()->removeWidget( txtReferer );
lblReferer->setVisible( false );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/symbology-ng/qgsdatadefinedsymboldialog.cpp
Expand Up @@ -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
Expand Down
118 changes: 59 additions & 59 deletions src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand All @@ -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 );
Expand Down Expand Up @@ -311,7 +311,7 @@ void QgsWFSSourceSelect::connectToServer()
btnConnect->setEnabled( false );
if ( mModel )
{
mModel->removeRows( 0, mModel->rowCount() );
mModel->removeRows( 0, mModel->rowCount() );
}
if ( mCapabilities )
{
Expand Down Expand Up @@ -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?
Expand All @@ -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()
Expand All @@ -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() )
Expand Down Expand Up @@ -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" );
Expand All @@ -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 );
Expand All @@ -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;
}
10 changes: 5 additions & 5 deletions src/providers/wfs/qgswfssourceselect.h
Expand Up @@ -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;

};

Expand Down Expand Up @@ -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() ); }

Expand Down

0 comments on commit d5dcaa3

Please sign in to comment.