From 12d7cfca0325f046a49a0aefa7174d999782ff08 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Tue, 7 Apr 2015 14:27:39 +0200 Subject: [PATCH] indentation update --- python/core/effects/qgsblureffect.sip | 2 +- python/core/effects/qgscoloreffect.sip | 2 +- python/core/effects/qgseffectstack.sip | 4 +- python/core/effects/qgspainteffect.sip | 2 +- python/core/effects/qgstransformeffect.sip | 2 +- python/core/symbology-ng/qgssymbollayerv2.sip | 2 +- .../qgseffectstackpropertieswidget.sip | 2 +- .../db_manager/db_plugins/info_model.py | 8 ++-- .../plugins/db_manager/db_plugins/plugin.py | 4 +- .../db_plugins/postgis/connector.py | 30 ++++++------- .../db_plugins/postgis/data_model.py | 4 +- .../db_plugins/postgis/info_model.py | 18 ++++---- .../plugins/versioning/dlg_versioning.py | 4 +- .../db_plugins/spatialite/connector.py | 12 ++--- .../plugins/fTools/tools/doPointsInPolygon.py | 8 ++-- python/plugins/fTools/tools/doVectorGrid.py | 36 +++++++-------- scripts/astyle-all.sh | 2 +- scripts/generate_test_mask_image.py | 14 +++--- src/app/qgsfieldsproperties.cpp | 2 +- src/core/qgsexpression.h | 6 +-- src/core/qgsvectorlayer.cpp | 2 +- .../qgsvaluerelationwidgetwrapper.cpp | 8 ++-- src/gui/qgsquerybuilder.cpp | 2 +- src/gui/qgsrubberband.cpp | 2 +- src/gui/qgsunitselectionwidget.cpp | 2 +- .../qgsdelimitedtextfeatureiterator.cpp | 2 +- .../qgsdelimitedtextprovider.cpp | 6 +-- tests/src/gui/testqgsrubberband.cpp | 44 +++++++++---------- .../test_qgsdelimitedtextprovider_wanted.py | 26 +++++------ 29 files changed, 127 insertions(+), 131 deletions(-) diff --git a/python/core/effects/qgsblureffect.sip b/python/core/effects/qgsblureffect.sip index b86bb3d9ef3..db9ce736bd1 100644 --- a/python/core/effects/qgsblureffect.sip +++ b/python/core/effects/qgsblureffect.sip @@ -34,7 +34,7 @@ class QgsBlurEffect : QgsPaintEffect virtual QgsStringMap properties() const; virtual void readProperties( const QgsStringMap& props ); virtual QgsPaintEffect* clone() const /Factory/; - + /** Sets blur level (strength) * @param level blur level. Depending on the current @link blurMethod @endlink, this parameter * has different effects diff --git a/python/core/effects/qgscoloreffect.sip b/python/core/effects/qgscoloreffect.sip index f673d78d0d4..3eeb6904edd 100644 --- a/python/core/effects/qgscoloreffect.sip +++ b/python/core/effects/qgscoloreffect.sip @@ -11,7 +11,7 @@ class QgsColorEffect : QgsPaintEffect %TypeHeaderCode #include %End - + public: /** Creates a new QgsColorEffect effect from a properties string map. diff --git a/python/core/effects/qgseffectstack.sip b/python/core/effects/qgseffectstack.sip index 5c146a9eb9b..5955d77afa0 100644 --- a/python/core/effects/qgseffectstack.sip +++ b/python/core/effects/qgseffectstack.sip @@ -83,13 +83,13 @@ class QgsEffectStack : QgsPaintEffect * @param index position of effect to take */ QgsPaintEffect* takeEffect( const int index ); - + /** Returns a pointer to the list of effects currently contained by * the stack * @returns list of QgsPaintEffects within the stack */ QList< QgsPaintEffect* >* effectList(); - + /** Returns count of effects contained by the stack * @returns count of effects */ diff --git a/python/core/effects/qgspainteffect.sip b/python/core/effects/qgspainteffect.sip index 2e69ebe612a..bb0203e6110 100644 --- a/python/core/effects/qgspainteffect.sip +++ b/python/core/effects/qgspainteffect.sip @@ -293,7 +293,7 @@ class QgsDrawSourceEffect : QgsPaintEffect * @see setBlendMode */ QPainter::CompositionMode blendMode() const; - + protected: virtual void draw( QgsRenderContext& context ); diff --git a/python/core/effects/qgstransformeffect.sip b/python/core/effects/qgstransformeffect.sip index 3ff9f60a88f..3c2d4accac2 100644 --- a/python/core/effects/qgstransformeffect.sip +++ b/python/core/effects/qgstransformeffect.sip @@ -11,7 +11,7 @@ class QgsTransformEffect : QgsPaintEffect %TypeHeaderCode #include %End - + public: /** Creates a new QgsTransformEffect effect from a properties string map. diff --git a/python/core/symbology-ng/qgssymbollayerv2.sip b/python/core/symbology-ng/qgssymbollayerv2.sip index a9025a860b1..2f7cf6ec85b 100644 --- a/python/core/symbology-ng/qgssymbollayerv2.sip +++ b/python/core/symbology-ng/qgssymbollayerv2.sip @@ -67,7 +67,7 @@ class QgsSymbolLayerV2 public: virtual ~QgsSymbolLayerV2(); - + // not necessarily supported by all symbol layers... virtual QColor color() const; virtual void setColor( const QColor& color ); diff --git a/python/gui/effects/qgseffectstackpropertieswidget.sip b/python/gui/effects/qgseffectstackpropertieswidget.sip index 677657df372..6ab74d984df 100644 --- a/python/gui/effects/qgseffectstackpropertieswidget.sip +++ b/python/gui/effects/qgseffectstackpropertieswidget.sip @@ -133,7 +133,7 @@ class QgsEffectStackPropertiesDialog : QgsDialog * @param picture preview picture */ void setPreviewPicture( const QPicture& picture ); - + }; /** \ingroup gui diff --git a/python/plugins/db_manager/db_plugins/info_model.py b/python/plugins/db_manager/db_plugins/info_model.py index 8d13a317478..59833e15ab9 100644 --- a/python/plugins/db_manager/db_plugins/info_model.py +++ b/python/plugins/db_manager/db_plugins/info_model.py @@ -206,8 +206,8 @@ class TableInfo: # define the table header header = ( - "#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"), - QApplication.translate("DBManagerPlugin", "Null"), QApplication.translate("DBManagerPlugin", "Default") ) + "#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"), + QApplication.translate("DBManagerPlugin", "Null"), QApplication.translate("DBManagerPlugin", "Default") ) tbl.append(HtmlTableHeader(header)) # add table contents @@ -251,7 +251,7 @@ class TableInfo: # define the table header header = ( - QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Column(s)") ) + QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Column(s)") ) tbl.append(HtmlTableHeader(header)) # add table contents @@ -271,7 +271,7 @@ class TableInfo: # define the table header header = ( - QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function") ) + QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function") ) tbl.append(HtmlTableHeader(header)) # add table contents diff --git a/python/plugins/db_manager/db_plugins/plugin.py b/python/plugins/db_manager/db_plugins/plugin.py index 17d08d4838b..9630d402146 100644 --- a/python/plugins/db_manager/db_plugins/plugin.py +++ b/python/plugins/db_manager/db_plugins/plugin.py @@ -835,7 +835,7 @@ class Table(DbItemObject): trigger_action = parts[2] msg = QApplication.translate("DBManagerPlugin", "Do you want to %s trigger %s?") % ( - trigger_action, trigger_name) + trigger_action, trigger_name) QApplication.restoreOverrideCursor() try: if QMessageBox.question(None, QApplication.translate("DBManagerPlugin", "Table trigger"), msg, @@ -932,7 +932,7 @@ class VectorTable(Table): spatialIndex_action = parts[1] msg = QApplication.translate("DBManagerPlugin", "Do you want to %s spatial index for field %s?") % ( - spatialIndex_action, self.geomColumn ) + spatialIndex_action, self.geomColumn ) QApplication.restoreOverrideCursor() try: if QMessageBox.question(None, QApplication.translate("DBManagerPlugin", "Spatial Index"), msg, diff --git a/python/plugins/db_manager/db_plugins/postgis/connector.py b/python/plugins/db_manager/db_plugins/postgis/connector.py index 3161fcaca97..4d0f4c90f91 100644 --- a/python/plugins/db_manager/db_plugins/postgis/connector.py +++ b/python/plugins/db_manager/db_plugins/postgis/connector.py @@ -215,7 +215,7 @@ class PostGisDBConnector(DBConnector): t = self.quoteId(table) sql = u"""SELECT has_table_privilege(%(t)s, 'SELECT'), has_table_privilege(%(t)s, 'INSERT'), has_table_privilege(%(t)s, 'UPDATE'), has_table_privilege(%(t)s, 'DELETE')""" % { - 't': self.quoteString(t)} + 't': self.quoteString(t)} c = self._execute(None, sql) res = self._fetchone(c) self._close_cursor(c) @@ -477,7 +477,7 @@ class PostGisDBConnector(DBConnector): JOIN pg_namespace nsp ON pg_class.relnamespace = nsp.oid WHERE pg_class.relname=%s %s AND indisprimary != 't' """ % ( - self.quoteString(tablename), schema_where) + self.quoteString(tablename), schema_where) c = self._execute(None, sql) res = self._fetchall(c) self._close_cursor(c) @@ -512,7 +512,7 @@ class PostGisDBConnector(DBConnector): LEFT JOIN pg_proc p ON trig.tgfoid = p.oid JOIN pg_namespace nsp ON t.relnamespace = nsp.oid WHERE t.relname = %s %s """ % ( - self.quoteString(tablename), schema_where) + self.quoteString(tablename), schema_where) c = self._execute(None, sql) res = self._fetchall(c) @@ -573,7 +573,7 @@ class PostGisDBConnector(DBConnector): schema_part = u"%s," % self.quoteString(schema) if schema is not None else "" subquery = u"SELECT st_estimated_extent(%s%s,%s) AS extent" % ( - schema_part, self.quoteString(tablename), self.quoteString(geom)) + schema_part, self.quoteString(tablename), self.quoteString(geom)) sql = u"""SELECT st_xmin(extent), st_ymin(extent), st_xmax(extent), st_ymax(extent) FROM (%s) AS subquery """ % subquery try: @@ -594,7 +594,7 @@ class PostGisDBConnector(DBConnector): sql = u"""SELECT pg_get_viewdef(c.oid) FROM pg_class c JOIN pg_namespace nsp ON c.relnamespace = nsp.oid WHERE relname=%s %s AND (relkind='v' OR relkind='m') """ % ( - self.quoteString(tablename), schema_where) + self.quoteString(tablename), schema_where) c = self._execute(None, sql) res = self._fetchone(c) @@ -626,7 +626,7 @@ class PostGisDBConnector(DBConnector): if self.has_geometry_columns and self.has_geometry_columns_access: schema, tablename = self.getSchemaTableName(table) sql = u"SELECT count(*) FROM geometry_columns WHERE f_table_schema = %s AND f_table_name = %s" % ( - self.quoteString(schema), self.quoteString(tablename)) + self.quoteString(schema), self.quoteString(tablename)) c = self._execute(None, sql) res = self._fetchone(c) @@ -639,7 +639,7 @@ class PostGisDBConnector(DBConnector): if self.has_raster_columns and self.has_raster_columns_access: schema, tablename = self.getSchemaTableName(table) sql = u"SELECT count(*) FROM raster_columns WHERE r_table_schema = %s AND r_table_name = %s" % ( - self.quoteString(schema), self.quoteString(tablename)) + self.quoteString(schema), self.quoteString(tablename)) c = self._execute(None, sql) res = self._fetchone(c) @@ -700,7 +700,7 @@ class PostGisDBConnector(DBConnector): if self.has_geometry_columns and not self.is_geometry_columns_view: schema_where = u" AND f_table_schema=%s " % self.quoteString(schema) if schema is not None else "" sql = u"UPDATE geometry_columns SET f_table_name=%s WHERE f_table_name=%s %s" % ( - self.quoteString(new_table), self.quoteString(tablename), schema_where) + self.quoteString(new_table), self.quoteString(tablename), schema_where) self._execute(c, sql) self._commit() @@ -720,7 +720,7 @@ class PostGisDBConnector(DBConnector): schema, tablename = self.getSchemaTableName(table) schema_where = u" AND f_table_schema=%s " % self.quoteString(schema) if schema is not None else "" sql = u"UPDATE geometry_columns SET f_table_schema=%s WHERE f_table_name=%s %s" % ( - self.quoteString(new_schema), self.quoteString(tablename), schema_where) + self.quoteString(new_schema), self.quoteString(tablename), schema_where) self._execute(c, sql) self._commit() @@ -752,7 +752,7 @@ class PostGisDBConnector(DBConnector): schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else "" schema_part = u" f_table_schema=%s, " % self.quoteString(new_schema) if schema is not None else "" sql = u"UPDATE geometry_columns SET %s f_table_name=%s WHERE %s f_table_name=%s" % ( - schema_part, self.quoteString(new_table), schema_where, self.quoteString(tablename)) + schema_part, self.quoteString(new_table), schema_where, self.quoteString(tablename)) self._execute(c, sql) self._commit() @@ -807,7 +807,7 @@ class PostGisDBConnector(DBConnector): schema, tablename = self.getSchemaTableName(table) schema_part = u"%s, " % self._quote_str(schema) if schema else "" sql = u"SELECT DropGeometryColumn(%s%s, %s)" % ( - schema_part, self.quoteString(tablename), self.quoteString(column)) + schema_part, self.quoteString(tablename), self.quoteString(column)) else: sql = u"ALTER TABLE %s DROP %s" % (self.quoteId(table), self.quoteId(column)) self._execute_and_commit(sql) @@ -839,7 +839,7 @@ class PostGisDBConnector(DBConnector): # rename the column if new_name is not None and new_name != column: sql = u"ALTER TABLE %s RENAME %s TO %s" % ( - self.quoteId(table), self.quoteId(column), self.quoteId(new_name)) + self.quoteId(table), self.quoteId(column), self.quoteId(new_name)) self._execute(c, sql) # update geometry_columns if postgis is enabled @@ -847,7 +847,7 @@ class PostGisDBConnector(DBConnector): schema, tablename = self.getSchemaTableName(table) schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else "" sql = u"UPDATE geometry_columns SET f_geometry_column=%s WHERE %s f_table_name=%s AND f_geometry_column=%s" % ( - self.quoteString(new_name), schema_where, self.quoteString(tablename), self.quoteString(column)) + self.quoteString(new_name), schema_where, self.quoteString(tablename), self.quoteString(column)) self._execute(c, sql) self._commit() @@ -876,7 +876,7 @@ class PostGisDBConnector(DBConnector): schema_where = u" f_table_schema=%s AND " % self.quoteString(schema) if schema is not None else "" sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE %s f_table_name=%s AND f_geometry_column=%s" % ( - schema_where, self.quoteString(tablename), self.quoteString(column)) + schema_where, self.quoteString(tablename), self.quoteString(column)) c = self._execute(None, sql) res = self._fetchone(c)[0] == 't' @@ -888,7 +888,7 @@ class PostGisDBConnector(DBConnector): schema_part = u"%s, " % self.quoteString(schema) if schema else "" sql = u"SELECT AddGeometryColumn(%s%s, %s, %d, %s, %d)" % ( - schema_part, self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim) + schema_part, self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim) self._execute_and_commit(sql) def deleteGeometryColumn(self, table, geom_column): diff --git a/python/plugins/db_manager/db_plugins/postgis/data_model.py b/python/plugins/db_manager/db_plugins/postgis/data_model.py index 3df6669cdce..855c3ab1ab8 100644 --- a/python/plugins/db_manager/db_plugins/postgis/data_model.py +++ b/python/plugins/db_manager/db_plugins/postgis/data_model.py @@ -50,10 +50,10 @@ class PGTableDataModel(TableDataModel): # get fields, ignore geometry columns if field.dataType.lower() == "geometry": return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE GeometryType(%(fld)s) END AS %(fld)s" % { - 'fld': self.db.quoteId(field.name)} + 'fld': self.db.quoteId(field.name)} elif field.dataType.lower() == "raster": return u"CASE WHEN %(fld)s IS NULL THEN NULL ELSE 'RASTER' END AS %(fld)s" % { - 'fld': self.db.quoteId(field.name)} + 'fld': self.db.quoteId(field.name)} return u"%s::text" % self.db.quoteId(field.name) def _deleteCursor(self): diff --git a/python/plugins/db_manager/db_plugins/postgis/info_model.py b/python/plugins/db_manager/db_plugins/postgis/info_model.py index 7c6c7443a8c..178ef3c0ccb 100644 --- a/python/plugins/db_manager/db_plugins/postgis/info_model.py +++ b/python/plugins/db_manager/db_plugins/postgis/info_model.py @@ -95,7 +95,7 @@ class PGTableInfo(TableInfo): if self.table.rowCount is not None: if abs(self.table.estimatedRowCount - self.table.rowCount) > 1 and \ (self.table.estimatedRowCount > 2 * self.table.rowCount or - self.table.rowCount > 2 * self.table.estimatedRowCount): + self.table.rowCount > 2 * self.table.estimatedRowCount): ret.append(HtmlParagraph(QApplication.translate("DBManagerPlugin", " There's a significant difference between estimated and real row count. " 'Consider running VACUUM ANALYZE.'))) @@ -145,9 +145,9 @@ class PGTableInfo(TableInfo): # define the table header header = ( - "#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"), - QApplication.translate("DBManagerPlugin", "Length"), QApplication.translate("DBManagerPlugin", "Null"), - QApplication.translate("DBManagerPlugin", "Default") ) + "#", QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Type"), + QApplication.translate("DBManagerPlugin", "Length"), QApplication.translate("DBManagerPlugin", "Null"), + QApplication.translate("DBManagerPlugin", "Default") ) tbl.append(HtmlTableHeader(header)) # add table contents @@ -173,8 +173,8 @@ class PGTableInfo(TableInfo): tbl = [] # define the table header header = ( - QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function"), - QApplication.translate("DBManagerPlugin", "Type"), QApplication.translate("DBManagerPlugin", "Enabled") ) + QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Function"), + QApplication.translate("DBManagerPlugin", "Type"), QApplication.translate("DBManagerPlugin", "Enabled") ) tbl.append(HtmlTableHeader(header)) # add table contents @@ -183,9 +183,9 @@ class PGTableInfo(TableInfo): "action": "delete"} (enabled, action) = (QApplication.translate("DBManagerPlugin", "Yes"), "disable") if trig.enabled else ( - QApplication.translate("DBManagerPlugin", "No"), "enable") + QApplication.translate("DBManagerPlugin", "No"), "enable") txt_enabled = u'%(enabled)s (%(action)s)' % { - "name": trig.name, "action": action, "enabled": enabled} + "name": trig.name, "action": action, "enabled": enabled} tbl.append((name, trig.function, trig.type2String(), txt_enabled)) @@ -203,7 +203,7 @@ class PGTableInfo(TableInfo): tbl = [] # define the table header header = ( - QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Definition") ) + QApplication.translate("DBManagerPlugin", "Name"), QApplication.translate("DBManagerPlugin", "Definition") ) tbl.append(HtmlTableHeader(header)) # add table contents diff --git a/python/plugins/db_manager/db_plugins/postgis/plugins/versioning/dlg_versioning.py b/python/plugins/db_manager/db_plugins/postgis/plugins/versioning/dlg_versioning.py index a60bd97774c..4491b5cc470 100644 --- a/python/plugins/db_manager/db_plugins/postgis/plugins/versioning/dlg_versioning.py +++ b/python/plugins/db_manager/db_plugins/postgis/plugins/versioning/dlg_versioning.py @@ -176,11 +176,11 @@ class DlgVersioning(QDialog, Ui_DlgVersioning): def sql_alterTable(self): return u"ALTER TABLE %s ADD %s serial, ADD %s timestamp, ADD %s timestamp;" % ( - self.schematable, self.colPkey, self.colStart, self.colEnd) + self.schematable, self.colPkey, self.colStart, self.colEnd) def sql_setPkey(self): return u"ALTER TABLE %s DROP CONSTRAINT %s, ADD PRIMARY KEY (%s);" % ( - self.schematable, self.origPkeyName, self.colPkey) + self.schematable, self.origPkeyName, self.colPkey) def sql_currentView(self): cols = ",".join(self.columns) diff --git a/python/plugins/db_manager/db_plugins/spatialite/connector.py b/python/plugins/db_manager/db_plugins/spatialite/connector.py index 75972064c8a..9b4097ae293 100644 --- a/python/plugins/db_manager/db_plugins/spatialite/connector.py +++ b/python/plugins/db_manager/db_plugins/spatialite/connector.py @@ -324,7 +324,7 @@ class SpatiaLiteDBConnector(DBConnector): c = self._get_cursor() schema, tablename = self.getSchemaTableName(table) sql = u"SELECT name, sql FROM sqlite_master WHERE tbl_name = %s AND type = 'trigger'" % ( - self.quoteString(tablename)) + self.quoteString(tablename)) self._execute(c, sql) return c.fetchall() @@ -447,7 +447,7 @@ class SpatiaLiteDBConnector(DBConnector): # update geometry_columns if self.has_geometry_columns: sql = u"UPDATE geometry_columns SET f_table_name = %s WHERE upper(f_table_name) = upper(%s)" % ( - self.quoteString(new_table), self.quoteString(tablename)) + self.quoteString(new_table), self.quoteString(tablename)) self._execute(c, sql) self._commit() @@ -511,14 +511,14 @@ class SpatiaLiteDBConnector(DBConnector): c = self._get_cursor() schema, tablename = self.getSchemaTableName(table) sql = u"SELECT count(*) > 0 FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % ( - self.quoteString(tablename), self.quoteString(column)) + self.quoteString(tablename), self.quoteString(column)) self._execute(c, sql) return c.fetchone()[0] == 't' def addGeometryColumn(self, table, geom_column='geometry', geom_type='POINT', srid=-1, dim=2): schema, tablename = self.getSchemaTableName(table) sql = u"SELECT AddGeometryColumn(%s, %s, %d, %s, %s)" % ( - self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim) + self.quoteString(tablename), self.quoteString(geom_column), srid, self.quoteString(geom_type), dim) self._execute_and_commit(sql) def deleteGeometryColumn(self, table, geom_column): @@ -544,7 +544,7 @@ class SpatiaLiteDBConnector(DBConnector): """ create index on one column using default options """ unique_str = u"UNIQUE" if unique else "" sql = u"CREATE %s INDEX %s ON %s (%s)" % ( - unique_str, self.quoteId(name), self.quoteId(table), self.quoteId(column)) + unique_str, self.quoteId(name), self.quoteId(table), self.quoteId(column)) self._execute_and_commit(sql) def deleteTableIndex(self, table, name): @@ -581,7 +581,7 @@ class SpatiaLiteDBConnector(DBConnector): c = self._get_cursor() schema, tablename = self.getSchemaTableName(table) sql = u"SELECT spatial_index_enabled FROM geometry_columns WHERE upper(f_table_name) = upper(%s) AND upper(f_geometry_column) = upper(%s)" % ( - self.quoteString(tablename), self.quoteString(geom_column)) + self.quoteString(tablename), self.quoteString(geom_column)) self._execute(c, sql) row = c.fetchone() return row is not None and row[0] == 1 diff --git a/python/plugins/fTools/tools/doPointsInPolygon.py b/python/plugins/fTools/tools/doPointsInPolygon.py index 42d036f2d45..b60a1778d4e 100644 --- a/python/plugins/fTools/tools/doPointsInPolygon.py +++ b/python/plugins/fTools/tools/doPointsInPolygon.py @@ -80,11 +80,11 @@ class Dialog(QDialog, Ui_Dialog): if field.type() == QVariant.Int or field.type() ==QVariant.Double: if field.type() == QVariant.Int: global typeInt - item = QListWidgetItem(str(field.name()), None, typeInt) + item = QListWidgetItem(str(field.name()), None, typeInt) else: global typeDouble - item = QListWidgetItem(str(field.name()), None, typeDouble) - item.setToolTip("Attribute <%s> of type %s"%(field.name(), field.typeName())) + item = QListWidgetItem(str(field.name()), None, typeDouble) + item.setToolTip("Attribute <%s> of type %s" % (field.name(), field.typeName())) self.attributeList.addItem(item) def outFile(self): @@ -272,7 +272,7 @@ class PointsInPolygonThread(QThread): # Check if the input contains non-numeric values non_numeric_values = False for value in values: - if (isinstance(value, type(float())) != True) and (isinstance(value, type(int())) != True): + if not isinstance(value, type(float())) and not isinstance(value, type(int())): non_numeric_values = True break # Jump over invalid values diff --git a/python/plugins/fTools/tools/doVectorGrid.py b/python/plugins/fTools/tools/doVectorGrid.py index 39369c3dd02..57ff9883160 100644 --- a/python/plugins/fTools/tools/doVectorGrid.py +++ b/python/plugins/fTools/tools/doVectorGrid.py @@ -46,7 +46,7 @@ class Dialog(QDialog, Ui_Dialog): QObject.connect(self.btnUpdate, SIGNAL("clicked()"), self.updateLayer) QObject.connect(self.btnCanvas, SIGNAL("clicked()"), self.updateCanvas) QObject.connect(self.chkAlign, SIGNAL("toggled(bool)"), self.chkAlignToggled) - self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok ) + self.buttonOk = self.buttonBox_2.button(QDialogButtonBox.Ok) self.setWindowTitle(self.tr("Vector grid")) self.xMin.setValidator(QDoubleValidator(self.xMin)) self.xMax.setValidator(QDoubleValidator(self.xMax)) @@ -156,7 +156,7 @@ class Dialog(QDialog, Ui_Dialog): def compute( self, bound, xOffset, yOffset, polygon ): crs = None layer = ftools_utils.getMapLayerByName(unicode(self.inShape.currentText())) - + if self.angle.value() != 0.0: bound = self.initRotation(bound) @@ -204,7 +204,7 @@ class Dialog(QDialog, Ui_Dialog): while y >= bound.yMinimum(): pt1 = QgsPoint(bound.xMinimum(), y) pt2 = QgsPoint(bound.xMaximum(), y) - + if self.angle.value() != 0.0: self.rotatePoint(pt1) self.rotatePoint(pt2) @@ -254,20 +254,20 @@ class Dialog(QDialog, Ui_Dialog): while y >= bound.yMinimum(): x = bound.xMinimum() while x <= bound.xMaximum(): - + pt1 = QgsPoint(x, y) pt2 = QgsPoint(x + xOffset, y) pt3 = QgsPoint(x + xOffset, y - yOffset) pt4 = QgsPoint(x, y - yOffset) pt5 = QgsPoint(x, y) - + if self.angle.value() != 0.0: self.rotatePoint(pt1) self.rotatePoint(pt2) self.rotatePoint(pt3) self.rotatePoint(pt4) self.rotatePoint(pt5) - + polygon = [[pt1, pt2, pt3, pt4, pt5]] outFeat.setGeometry(outGeom.fromPolygon(polygon)) outFeat.setAttribute(0, idVar) @@ -293,30 +293,30 @@ class Dialog(QDialog, Ui_Dialog): # We convert the angle from degree to radiant rad = self.angle.value() * math.pi / 180.0 - a = math.cos( rad ); - b = -1 * math.sin( rad ); - c = anchorPoint.x() - math.cos( rad ) * anchorPoint.x() + math.sin( rad ) * anchorPoint.y(); - d = math.sin( rad ); - e = math.cos( rad ); - f = anchorPoint.y() - math.sin( rad ) * anchorPoint.x() - math.cos( rad ) * anchorPoint.y(); + a = math.cos(rad) + b = -1 * math.sin( rad ) + c = anchorPoint.x() - math.cos( rad ) * anchorPoint.x() + math.sin( rad ) * anchorPoint.y() + d = math.sin( rad ) + e = math.cos( rad ) + f = anchorPoint.y() - math.sin( rad ) * anchorPoint.x() - math.cos( rad ) * anchorPoint.y() self.rotationParams = (a,b,c,d,e,f) - + # Rotate the bounding box to set a new extent ptMin = QgsPoint(boundBox.xMinimum(), boundBox.yMinimum()) ptMax = QgsPoint(boundBox.xMaximum(), boundBox.yMaximum()) - + self.rotatePoint(ptMin) self.rotatePoint(ptMax) - + newBoundBox = QgsRectangle(ptMin, ptMax) newBoundBox.combineExtentWith(boundBox) - + return newBoundBox def rotatePoint(self, point): - x = self.rotationParams[0] * point.x() + self.rotationParams[1] * point.y() + self.rotationParams[2]; - y = self.rotationParams[3] * point.x() + self.rotationParams[4] * point.y() + self.rotationParams[5]; + x = self.rotationParams[0] * point.x() + self.rotationParams[1] * point.y() + self.rotationParams[2] + y = self.rotationParams[3] * point.x() + self.rotationParams[4] * point.y() + self.rotationParams[5] point.setX(x) point.setY(y) diff --git a/scripts/astyle-all.sh b/scripts/astyle-all.sh index 274183266dc..9587e554f0a 100755 --- a/scripts/astyle-all.sh +++ b/scripts/astyle-all.sh @@ -33,7 +33,7 @@ find python src tests -type f -print | while read f; do fi echo -ne "Reformatting $f $elcr" - astyle.sh "$f" + astyle.sh "$f" || true done echo diff --git a/scripts/generate_test_mask_image.py b/scripts/generate_test_mask_image.py index 3793f81596b..48fe04c948b 100644 --- a/scripts/generate_test_mask_image.py +++ b/scripts/generate_test_mask_image.py @@ -3,7 +3,7 @@ # Generates (or updates) a unit test image mask, which is used to specify whether # a pixel in the control image should be checked (black pixel in mask) or not (white # pixel in mask). For non black or white pixels, the pixels lightness is used to -# specify a maximum delta for each color component +# specify a maximum delta for each color component import os import sys @@ -15,7 +15,7 @@ import struct def error ( msg ): print msg sys.exit( 1 ) - + def colorDiff( c1, c2 ): redDiff = abs( qRed( c1 ) - qRed( c2 ) ) greenDiff = abs( qGreen( c1 ) - qGreen( c2 ) ) @@ -36,7 +36,7 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path): control_image.height(), rendered_image.width(), rendered_image.height())) - + #read current mask, if it exist mask_image = QImage( mask_image_path ) if mask_image.isNull(): @@ -69,18 +69,16 @@ def updateMask(control_image_path, rendered_image_path, mask_image_path): #update mask image mask_image.setPixel( x, y, qRgb( difference, difference, difference ) ) mismatch_count += 1 - + if mismatch_count: #update mask - mask_image.save( mask_image_path, "png" ); + mask_image.save( mask_image_path, "png" ) print 'Updated {} pixels'.format( mismatch_count ) -parser = argparse.ArgumentParser() #OptionParser("usage: %prog control_image rendered_image mask_image") +parser = argparse.ArgumentParser() # OptionParser("usage: %prog control_image rendered_image mask_image") parser.add_argument('control_image') parser.add_argument('rendered_image') parser.add_argument('mask_image') args = parser.parse_args() - updateMask(args.control_image, args.rendered_image, args.mask_image) - diff --git a/src/app/qgsfieldsproperties.cpp b/src/app/qgsfieldsproperties.cpp index da52fe52d78..f19d71548ed 100644 --- a/src/app/qgsfieldsproperties.cpp +++ b/src/app/qgsfieldsproperties.cpp @@ -250,7 +250,7 @@ void QgsFieldsProperties::setRow( int row, int idx, const QgsField& field ) expressionWidget->setLayout( new QHBoxLayout ); QToolButton* editExpressionButton = new QToolButton; editExpressionButton->setIcon( QgsApplication::getThemeIcon( "/mIconExpression.svg" ) ); - connect( editExpressionButton, SIGNAL(clicked()), this, SLOT(updateExpression()) ); + connect( editExpressionButton, SIGNAL( clicked() ), this, SLOT( updateExpression() ) ); expressionWidget->layout()->setContentsMargins( 0, 0, 0, 0 ); expressionWidget->layout()->addWidget( editExpressionButton ); expressionWidget->layout()->addWidget( new QLabel( mLayer->expressionField( idx ) ) ); diff --git a/src/core/qgsexpression.h b/src/core/qgsexpression.h index 23bcceb033c..2d482288730 100644 --- a/src/core/qgsexpression.h +++ b/src/core/qgsexpression.h @@ -521,10 +521,10 @@ class CORE_EXPORT QgsExpression virtual QStringList referencedColumns() const override { QStringList lst( mNode->referencedColumns() ); foreach ( Node* n, mList->list() ) lst.append( n->referencedColumns() ); return lst; } virtual bool needsGeometry() const override { bool needs = false; foreach ( Node* n, mList->list() ) needs |= n->needsGeometry(); return needs; } - virtual void accept( Visitor& v ) const override { v.visit( *this ); } + virtual void accept( Visitor& v ) const override { v.visit( *this ); } - protected: - Node* mNode; + protected: + Node* mNode; NodeList* mList; bool mNotIn; }; diff --git a/src/core/qgsvectorlayer.cpp b/src/core/qgsvectorlayer.cpp index 632a7662ccf..de1f2514f2c 100644 --- a/src/core/qgsvectorlayer.cpp +++ b/src/core/qgsvectorlayer.cpp @@ -2866,7 +2866,7 @@ const QString QgsVectorLayer::expressionField( int index ) return mExpressionFieldBuffer->expressions().value( oi ).expression; } -void QgsVectorLayer::updateExpressionField( int index, const QString& exp ) +void QgsVectorLayer::updateExpressionField( int index, const QString& exp ) { int oi = mUpdatedFields.fieldOriginIndex( index ); mExpressionFieldBuffer->updateExpression( oi, exp ); diff --git a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp index c429763b40a..c73bf89c3e9 100644 --- a/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp +++ b/src/gui/editorwidgets/qgsvaluerelationwidgetwrapper.cpp @@ -87,7 +87,7 @@ QVariant QgsValueRelationWidgetWrapper::value() if ( mLineEdit ) { - Q_FOREACH( const ValueRelationItem& i , mCache ) + Q_FOREACH ( const ValueRelationItem& i , mCache ) { if ( i.second == mLineEdit->text() ) { @@ -121,7 +121,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor ) mComboBox = qobject_cast( editor ); mListWidget = qobject_cast( editor ); - mLineEdit= qobject_cast( editor ); + mLineEdit = qobject_cast( editor ); if ( mComboBox ) { @@ -152,7 +152,7 @@ void QgsValueRelationWidgetWrapper::initWidget( QWidget* editor ) else if ( mLineEdit ) { QStringList values; - Q_FOREACH( const ValueRelationItem& i, mCache ) + Q_FOREACH ( const ValueRelationItem& i, mCache ) { values << i.second; } @@ -189,7 +189,7 @@ void QgsValueRelationWidgetWrapper::setValue( const QVariant& value ) } else if ( mLineEdit ) { - Q_FOREACH( ValueRelationItem i, mCache ) + Q_FOREACH ( ValueRelationItem i, mCache ) { if ( i.first == value ) { diff --git a/src/gui/qgsquerybuilder.cpp b/src/gui/qgsquerybuilder.cpp index 84075ed3373..0482887ea1f 100644 --- a/src/gui/qgsquerybuilder.cpp +++ b/src/gui/qgsquerybuilder.cpp @@ -72,7 +72,7 @@ void QgsQueryBuilder::populateFields() const QgsFields& fields = mLayer->pendingFields(); for ( int idx = 0; idx < fields.count(); ++idx ) { - if ( fields.fieldOrigin(idx) != QgsFields::OriginProvider ) + if ( fields.fieldOrigin( idx ) != QgsFields::OriginProvider ) { // only consider native fields continue; diff --git a/src/gui/qgsrubberband.cpp b/src/gui/qgsrubberband.cpp index d9ede04c2d4..e12e2f40dea 100644 --- a/src/gui/qgsrubberband.cpp +++ b/src/gui/qgsrubberband.cpp @@ -538,7 +538,7 @@ void QgsRubberBand::updateRect() const QgsMapToPixel& m2p = *( mMapCanvas->getCoordinateTransform() ); qreal res = m2p.mapUnitsPerPixel(); - qreal w = ( ( mIconSize - 1 ) / 2 + mPen.width() ) / res; + qreal w = (( mIconSize - 1 ) / 2 + mPen.width() ) / res; QgsRectangle r; for ( int i = 0; i < mPoints.size(); ++i ) diff --git a/src/gui/qgsunitselectionwidget.cpp b/src/gui/qgsunitselectionwidget.cpp index 9155c8ea3b2..0dcb4f094ff 100644 --- a/src/gui/qgsunitselectionwidget.cpp +++ b/src/gui/qgsunitselectionwidget.cpp @@ -120,7 +120,7 @@ void QgsUnitSelectionWidget::setUnits( const QgsSymbolV2::OutputUnitList &units QgsSymbolV2::OutputUnit QgsUnitSelectionWidget::unit() const { if ( mUnitCombo->count() == 0 ) - return QgsSymbolV2::Mixed; + return QgsSymbolV2::Mixed; QVariant currentData = mUnitCombo->itemData( mUnitCombo->currentIndex() ); if ( currentData.isValid() ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp index 9c73cb7f608..1ffbe3e5a2d 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextfeatureiterator.cpp @@ -447,7 +447,7 @@ void QgsDelimitedTextFeatureIterator::fetchAttribute( QgsFeature& feature, int f QgsDelimitedTextFeatureSource::QgsDelimitedTextFeatureSource( const QgsDelimitedTextProvider* p ) : mGeomRep( p->mGeomRep ) - , mSubsetExpression( p->mSubsetExpression ? new QgsExpression(p->mSubsetExpression->expression()) : 0 ) + , mSubsetExpression( p->mSubsetExpression ? new QgsExpression( p->mSubsetExpression->expression() ) : 0 ) , mExtent( p->mExtent ) , mUseSpatialIndex( p->mUseSpatialIndex ) , mSpatialIndex( p->mSpatialIndex ? new QgsSpatialIndex( *p->mSpatialIndex ) : 0 ) diff --git a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp index 380d2b794dc..25c3a6e3785 100644 --- a/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp +++ b/src/providers/delimitedtext/qgsdelimitedtextprovider.cpp @@ -88,7 +88,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri ) // Add supported types to enable creating expression fields in field calculator mNativeTypes << QgsVectorDataProvider::NativeType( tr( "Whole number (integer)" ), "integer", QVariant::Int, 0, 10 ) - << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64 bit)"), "int8", QVariant::LongLong ) + << QgsVectorDataProvider::NativeType( tr( "Whole number (integer - 64 bit)" ), "int8", QVariant::LongLong ) << QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 ) << QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 ) ; @@ -563,7 +563,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) { QString &value = parts[i]; - // Ignore empty fields - spreadsheet generated CSV files often + // Ignore empty fields - spreadsheet generated CSV files often // have random empty fields at the end of a row if ( value.isEmpty() ) continue; @@ -640,7 +640,7 @@ void QgsDelimitedTextProvider::scanFile( bool buildIndexes ) fieldType = QVariant::Int; typeName = "integer"; } - else if ( csvtTypes[i] == "long" || csvtTypes[i]== "longlong" || csvtTypes[i] == "int8" ) + else if ( csvtTypes[i] == "long" || csvtTypes[i] == "longlong" || csvtTypes[i] == "int8" ) { fieldType = QVariant::LongLong; //QVariant doesn't support long typeName = "longlong"; diff --git a/tests/src/gui/testqgsrubberband.cpp b/tests/src/gui/testqgsrubberband.cpp index 589aa3f87e0..a0ac5d3b1e1 100644 --- a/tests/src/gui/testqgsrubberband.cpp +++ b/tests/src/gui/testqgsrubberband.cpp @@ -117,40 +117,40 @@ void TestQgsRubberband::testBoundingRect() // Set extent to match canvas size. // This is to ensure a 1:1 scale mCanvas->setExtent( QgsRectangle( QRectF( - QPointF(0,0), mapSize - ) ) ); - QCOMPARE( mCanvas->mapUnitsPerPixel (), 1.0 ); + QPointF( 0, 0 ), mapSize + ) ) ); + QCOMPARE( mCanvas->mapUnitsPerPixel(), 1.0 ); // Polygon extent is 10,10 to 30,30 QSharedPointer geom( QgsGeometry::fromWkt( - "POLYGON((10 10,10 30,30 30,30 10,10 10))" - ) ); + "POLYGON((10 10,10 30,30 30,30 10,10 10))" + ) ); mRubberband = new QgsRubberBand( mCanvas, mPolygonLayer->geometryType() ); mRubberband->setIconSize( 5 ); // default, but better be explicit mRubberband->setWidth( 1 ); // default, but better be explicit mRubberband->addGeometry( geom.data(), mPolygonLayer ); // 20 pixels for the extent + 3 for pen & icon per side + 2 of padding - QCOMPARE( mRubberband->boundingRect(), QRectF(QPointF(-1,-1),QSizeF(28,28)) ); + QCOMPARE( mRubberband->boundingRect(), QRectF( QPointF( -1, -1 ), QSizeF( 28, 28 ) ) ); QCOMPARE( mRubberband->pos(), QPointF( - // 10 for extent minx - 3 for pen & icon - 7, - // 30 for extent maxy - 3 for pen & icon - mapSize.height() - 30 - 3 - ) ); + // 10 for extent minx - 3 for pen & icon + 7, + // 30 for extent maxy - 3 for pen & icon + mapSize.height() - 30 - 3 + ) ); mCanvas->setExtent( QgsRectangle( QRectF( - QPointF(0,0), mapSize/2 - ) ) ); + QPointF( 0, 0 ), mapSize / 2 + ) ) ); // 40 pixels for the extent + 6 for pen & icon per side + 2 of padding - QCOMPARE( mRubberband->boundingRect(), QRectF(QPointF(-1,-1),QSizeF(54,54)) ); + QCOMPARE( mRubberband->boundingRect(), QRectF( QPointF( -1, -1 ), QSizeF( 54, 54 ) ) ); QCOMPARE( mRubberband->pos(), QPointF( - // 10 for extent minx - 3 for pen & icon - 7 * 2, - // 30 for extent maxy - 3 for pen & icon - mapSize.height() - ( 30 + 3 ) * 2 - ) ); + // 10 for extent minx - 3 for pen & icon + 7 * 2, + // 30 for extent maxy - 3 for pen & icon + mapSize.height() - ( 30 + 3 ) * 2 + ) ); } @@ -173,8 +173,8 @@ void TestQgsRubberband::testVisibility() // Check visibility after setting to valid geometry QSharedPointer geom( QgsGeometry::fromWkt( - "POLYGON((10 10,10 30,30 30,30 10,10 10))" - ) ); + "POLYGON((10 10,10 30,30 30,30 10,10 10))" + ) ); mRubberband->setToGeometry( geom.data(), mPolygonLayer ); QCOMPARE( mRubberband->isVisible(), true ); @@ -191,7 +191,7 @@ void TestQgsRubberband::testVisibility() mRubberband->setVisible( false ); mCanvas->zoomIn(); QCOMPARE( mRubberband->isVisible(), false ); - + } diff --git a/tests/src/python/test_qgsdelimitedtextprovider_wanted.py b/tests/src/python/test_qgsdelimitedtextprovider_wanted.py index c2076a65afb..f168677a33f 100644 --- a/tests/src/python/test_qgsdelimitedtextprovider_wanted.py +++ b/tests/src/python/test_qgsdelimitedtextprovider_wanted.py @@ -2055,7 +2055,7 @@ def test_034_csvt_file(): 'field_12': u'NULL', '#fid': 2L, '#geometry': 'None', - }, + }, 3L: { 'id': u'2', 'description': u'Test csvt 2', @@ -2071,10 +2071,9 @@ def test_034_csvt_file(): 'field_12': u'-3123724580211819352', '#fid': 3L, '#geometry': 'None', - }, - } - wanted['log']=[ - ] + }, + } + wanted['log']=[] return wanted @@ -2194,7 +2193,7 @@ def test_038_type_inference(): 'text2': u'1', '#fid': 2L, '#geometry': 'POINT(1 1)', - }, + }, 3L: { 'id': u'line2', 'description': u'1.0', @@ -2208,7 +2207,7 @@ def test_038_type_inference(): 'text2': u'-4', '#fid': 3L, '#geometry': 'POINT(1 5)', - }, + }, 4L: { 'id': u'line3', 'description': u'5.0', @@ -2222,7 +2221,7 @@ def test_038_type_inference(): 'text2': u'1x', '#fid': 4L, '#geometry': 'POINT(5 5)', - }, + }, 5L: { 'id': u'line4', 'description': u'5.0', @@ -2236,7 +2235,7 @@ def test_038_type_inference(): 'text2': u'NULL', '#fid': 5L, '#geometry': 'POINT(5 1)', - }, + }, 6L: { 'id': u'line5', 'description': u'3.0', @@ -2250,7 +2249,7 @@ def test_038_type_inference(): 'text2': u'23', '#fid': 6L, '#geometry': 'POINT(3 1)', - }, + }, 7L: { 'id': u'line6', 'description': u'1.0', @@ -2264,8 +2263,7 @@ def test_038_type_inference(): 'text2': u'0', '#fid': 7L, '#geometry': 'POINT(1 3)', - }, - } - wanted['log']=[ - ] + }, + } + wanted['log']=[] return wanted