Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
indentation update
  • Loading branch information
jef-n committed Jul 21, 2013
1 parent 67376d1 commit ed286eb
Show file tree
Hide file tree
Showing 16 changed files with 64 additions and 65 deletions.
2 changes: 1 addition & 1 deletion python/plugins/sextante/algs/PointsLayerFromTable.py
Expand Up @@ -50,7 +50,7 @@ def processAlgorithm(self, progress):
writer = output.getVectorWriter(fields, QGis.WKBPoint, self.crs)
xfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.XFIELD))
yfieldindex = vlayer.fieldNameIndex(self.getParameterValue(self.YFIELD))

crsId = self.getParameterValue(self.TARGET_CRS)
targetCrs = QgsCoordinateReferenceSystem(crsId)
self.crs = targetCrs
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/core/AlgorithmProvider.py
Expand Up @@ -83,7 +83,7 @@ def getName(self):

def getDescription(self):
'''Returns the full name of the provider'''
return "Generic algorithm provider"
return "Generic algorithm provider"

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + "/../images/alg.png")
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/core/GeoAlgorithm.py
Expand Up @@ -408,7 +408,7 @@ def getAsCommand(self):
s+=out.getValueAsCommandLineParameter() + ","
s= s[:-1] + ")"
return s

def getPostProcessingErrorMessage(self, wrongLayers):
'''Returns the message to be shown to the user when, after running this algorithm,
there is a problem loading the resulting layer.
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/sextante/gui/SextanteToolbox.py
Expand Up @@ -220,8 +220,8 @@ def fillTreeUsingCategories(self):
for alg in algs:
if not alg.showInToolbox:
continue
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
if altgroup is None:
altgroup, altsubgroup, altname = AlgorithmDecorator.getGroupsAndName(alg)
if altgroup is None:
continue
if text =="" or text.lower() in altname.lower():
if altgroup not in groups:
Expand Down
12 changes: 6 additions & 6 deletions python/plugins/sextante/r/RAlgorithm.py
Expand Up @@ -270,17 +270,17 @@ def getExportCommands(self):

def getImportCommands(self):
commands = []

# just use main mirror
commands.append('options("repos"="http://cran.at.r-project.org/")')

# try to install packages if needed
packages = RUtils.getRequiredPackages(self.script)
packages.extend(['rgdal', 'raster'])
for p in packages:
for p in packages:
commands.append(
'tryCatch(find.package("' + p +
'"), error=function(e) install.packages("' + p +'", dependencies=TRUE))')
'tryCatch(find.package("' + p +
'"), error=function(e) install.packages("' + p +'", dependencies=TRUE))')
commands.append('library("raster")')
commands.append('library("rgdal")')

Expand Down Expand Up @@ -401,7 +401,7 @@ def getPostProcessingErrorMessage(self, wrongLayers):
html += "<p>The script you have executed needs the following packages:</p><ul>"
packages = RUtils.getRequiredPackages(self.script)
for p in packages:
html += '<li>' + p + '</li>'
html += '<li>' + p + '</li>'
html += "</ul><p>Make sure they are installed in your R environment before trying to execute this script.</p>"
else:
html += msg + "</i></li></ul>"
Expand Down
5 changes: 2 additions & 3 deletions python/plugins/sextante/r/RUtils.py
Expand Up @@ -125,7 +125,7 @@ def getConsoleOutput():
s+="</font>\n"

return s

@staticmethod
def checkRIsInstalled(ignoreRegistrySettings=False):
if SextanteUtils.isWindows():
Expand Down Expand Up @@ -157,9 +157,8 @@ def checkRIsInstalled(ignoreRegistrySettings=False):
'<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/sextante/3rdParty.html">Click here</a>'
'to know more about how to install and configure R to be used with SEXTANTE</p>')
return html

@staticmethod
def getRequiredPackages(code):
regex = re.compile('library\("?(.*?)"?\)')
return regex.findall(code)

2 changes: 1 addition & 1 deletion python/plugins/sextante/saga/SagaAlgorithm.py
Expand Up @@ -374,7 +374,7 @@ def checkParameterValuesBeforeExecuting(self):
layer = QGisLayers.getObjectFromUri(value)
if layer is not None and layer.bandCount() > 1:
return ("Input layer " + str(layer.name()) + " has more than one band.\n"
+ "Multiband layers are not supported by SAGA")
+ "Multiband layers are not supported by SAGA")

def helpFile(self):
return os.path.join(os.path.dirname(__file__), "help", self.name.replace(" ", "") + ".html")
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/sextante/saga/SagaAlgorithmProvider.py
Expand Up @@ -83,7 +83,7 @@ def createAlgsList(self):
alg = SagaAlgorithm(os.path.join(folder, descriptionFile))
if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
else:
else:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile)
except Exception,e:
SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open SAGA algorithm: " + descriptionFile +"\n" + str(e))
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsattributetabledialog.cpp
Expand Up @@ -570,8 +570,8 @@ void QgsAttributeTableDialog::filterQueryAccepted()
{
if ( mFilterQuery->text().isEmpty() )
{
filterShowAll();
return;
filterShowAll();
return;
}
filterQueryChanged( mFilterQuery->text() );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposeritemgroup.cpp
Expand Up @@ -22,7 +22,7 @@
#include <QPainter>

QgsComposerItemGroup::QgsComposerItemGroup( QgsComposition* c )
: QgsComposerItem( c )
: QgsComposerItem( c )
{
setZValue( 90 );
show();
Expand Down
44 changes: 22 additions & 22 deletions src/core/qgsmimedatautils.cpp
Expand Up @@ -46,26 +46,26 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )
QChar escape = '\\';
QString part;
bool inEscape = false;
for (int i = 0; i < encData.length(); ++i)
for ( int i = 0; i < encData.length(); ++i )
{
if (encData.at(i) == escape && !inEscape)
{
inEscape = true;
}
else if (encData.at(i) == split && !inEscape)
{
parts << part;
part = "";
}
else
{
part += encData.at(i);
inEscape = false;
}
if ( encData.at( i ) == escape && !inEscape )
{
inEscape = true;
}
else if ( encData.at( i ) == split && !inEscape )
{
parts << part;
part = "";
}
else
{
part += encData.at( i );
inEscape = false;
}
}
if (!part.isEmpty())
if ( !part.isEmpty() )
{
parts << part;
parts << part;
}

if ( parts.size() == 4 )
Expand All @@ -80,11 +80,11 @@ QgsMimeDataUtils::Uri::Uri( QString& encData )

QString QgsMimeDataUtils::Uri::data() const
{
QString escapedName = name;
QString escapeUri = uri;
escapedName.replace(":", "\\:");
escapeUri.replace(":", "\\:");
return layerType + ":" + providerKey + ":" + escapedName + ":" + escapeUri;
QString escapedName = name;
QString escapeUri = uri;
escapedName.replace( ":", "\\:" );
escapeUri.replace( ":", "\\:" );
return layerType + ":" + providerKey + ":" + escapedName + ":" + escapeUri;
}

// -----
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsprojectfiletransform.cpp
Expand Up @@ -820,7 +820,7 @@ int QgsProjectFileTransform::rasterBandNumber( const QDomElement& rasterProperti

if ( re.indexIn( rasterBandElem.text() ) >= 0 )
{
return re.cap(1).toInt();
return re.cap( 1 ).toInt();
}
}
return band;
Expand Down
38 changes: 19 additions & 19 deletions src/core/qgsvectorlayereditbuffer.cpp
Expand Up @@ -267,7 +267,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
commitErrors << tr( "ERROR: %n attribute(s) not deleted.", "not deleted attributes count", mDeletedAttributeIds.size() );
#if 0
QString list = "ERROR: Pending attribute deletes:";
foreach( int idx, mDeletedAttributeIds )
foreach ( int idx, mDeletedAttributeIds )
{
list.append( " " + L->pendingFields()[idx].name() );
}
Expand Down Expand Up @@ -296,7 +296,7 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
commitErrors << tr( "ERROR: %n new attribute(s) not added", "not added attributes count", mAddedAttributes.size() );
#if 0
QString list = "ERROR: Pending adds:";
foreach( QgsField f, mAddedAttributes )
foreach ( QgsField f, mAddedAttributes )
{
list.append( " " + f.name() );
}
Expand Down Expand Up @@ -353,14 +353,14 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
commitErrors << tr( "ERROR: %n attribute value change(s) not applied.", "not changed attribute values count", mChangedAttributeValues.size() );
#if 0
QString list = "ERROR: pending changes:";
foreach( QgsFeatureId id, mChangedAttributeValues.keys() )
foreach ( QgsFeatureId id, mChangedAttributeValues.keys() )
{
list.append( "\n " + FID_TO_STRING( id ) + "[" );
foreach( int idx, mChangedAttributeValues[ id ].keys() )
list.append( "\n " + FID_TO_STRING( id ) + "[" );
foreach ( int idx, mChangedAttributeValues[ id ].keys() )
{
list.append( QString( " %1:%2" ).arg( L->pendingFields()[idx].name() ).arg( mChangedAttributeValues[id][idx].toString() ) );
}
list.append( " ]" );
list.append( " ]" );
}
commitErrors << list;
#endif
Expand Down Expand Up @@ -392,9 +392,9 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
commitErrors << tr( "ERROR: %n feature(s) not deleted.", "not deleted features count", mDeletedFeatureIds.size() );
#if 0
QString list = "ERROR: pending deletes:";
foreach( QgsFeatureId id, mDeletedFeatureIds )
foreach ( QgsFeatureId id, mDeletedFeatureIds )
{
list.append( " " + FID_TO_STRING( id ) );
list.append( " " + FID_TO_STRING( id ) );
}
commitErrors << list;
#endif
Expand Down Expand Up @@ -440,17 +440,17 @@ bool QgsVectorLayerEditBuffer::commitChanges( QStringList& commitErrors )
{
commitErrors << tr( "ERROR: %n feature(s) not added.", "not added features count", mAddedFeatures.size() );
#if 0
QString list = "ERROR: pending adds:";
foreach( QgsFeature f, mAddedFeatures )
{
list.append( " " + FID_TO_STRING( f.id() ) + "[" );
for( int i = 0; i < L->pendingFields().size(); i++ )
{
list.append( QString( " %1:%2" ).arg( L->pendingFields()[i].name() ).arg( f.attributes()[i].toString() ) );
}
list.append( " ]" );
}
commitErrors << list;
QString list = "ERROR: pending adds:";
foreach ( QgsFeature f, mAddedFeatures )
{
list.append( " " + FID_TO_STRING( f.id() ) + "[" );
for ( int i = 0; i < L->pendingFields().size(); i++ )
{
list.append( QString( " %1:%2" ).arg( L->pendingFields()[i].name() ).arg( f.attributes()[i].toString() ) );
}
list.append( " ]" );
}
commitErrors << list;
#endif
success = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/mapserver/qgis_map_serv.cpp
Expand Up @@ -604,7 +604,7 @@ int main( int argc, char * argv[] )
}
else if ( request.compare( "GetLegendGraphic", Qt::CaseInsensitive ) == 0 ||
request.compare( "GetLegendGraphics", Qt::CaseInsensitive ) == 0 )
// GetLegendGraphics for compatibility with earlier QGIS versions
// GetLegendGraphics for compatibility with earlier QGIS versions
{
QImage* result = 0;
try
Expand Down
4 changes: 2 additions & 2 deletions src/providers/spatialite/qgsspatialiteprovider.cpp
Expand Up @@ -649,9 +649,9 @@ void QgsSpatiaLiteProvider::loadFieldsAbstractInterface( gaiaVectorLayerPtr lyr
QString name = QString::fromUtf8( results[( i * columns ) + 1] );
QString pk = results[( i * columns ) + 5];
if ( pk.toInt() == 0 )
continue;
continue;

if( mPrimaryKey.isEmpty() )
if ( mPrimaryKey.isEmpty() )
mPrimaryKey = name;
mPrimaryKeyAttrs << i - 1;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/gui/testqgsrubberband.cpp
Expand Up @@ -90,7 +90,7 @@ void TestQgsRubberband::testAddSingleMultiGeometries()
QgsGeometry* geomSinglePart = QgsGeometry::fromWkt( "POLYGON((-0.00022418 -0.00000279,-0.0001039 0.00002395,-0.00008677 -0.00005313,-0.00020705 -0.00007987,-0.00022418 -0.00000279))" );
QgsGeometry* geomMultiPart = QgsGeometry::fromWkt( "MULTIPOLYGON(((-0.00018203 0.00012178,-0.00009444 0.00014125,-0.00007861 0.00007001,-0.00016619 0.00005054,-0.00018203 0.00012178)),((-0.00030957 0.00009464,-0.00021849 0.00011489,-0.00020447 0.00005184,-0.00029555 0.00003158,-0.00030957 0.00009464)))" );

mCanvas->setExtent(QgsRectangle(-1e-3,-1e-3,1e-3,1e-3)); // otherwise point cannot be converted to canvas coord
mCanvas->setExtent( QgsRectangle( -1e-3, -1e-3, 1e-3, 1e-3 ) ); // otherwise point cannot be converted to canvas coord

mRubberband->addGeometry( geomSinglePart, mPolygonLayer );
mRubberband->addGeometry( geomMultiPart, mPolygonLayer );
Expand Down

0 comments on commit ed286eb

Please sign in to comment.