Skip to content

Commit b0a8c18

Browse files
committed
Merge pull request #2 from alexbruy/processing-ux
[processing] PEP8 fixes
2 parents 6230237 + 4137437 commit b0a8c18

File tree

9 files changed

+130
-127
lines changed

9 files changed

+130
-127
lines changed

python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def parametersHaveChanged(self):
9797
commands = self.alg.getConsoleCommands()
9898
commands = [c for c in commands if c not in ['cmd.exe', '/C ']]
9999
self.text.setPlainText(" ".join(commands))
100-
except AlgorithmDialogBase.InvalidParameterValue, e:
100+
except AlgorithmDialogBase.InvalidParameterValue as e:
101101
self.text.setPlainText("Invalid value for parameter '%s'" % e.parameter.description)
102102
except:
103103
self.text.setPlainText("")

python/plugins/processing/algs/help/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from qgis.core import *
44
from PyQt4.QtCore import QSettings, QLocale
55

6+
67
def loadShortHelp():
78
h = {}
89
path = os.path.dirname(__file__)
@@ -18,14 +19,14 @@ def loadShortHelp():
1819
else:
1920
locale = QSettings().value('locale/userLocale', '')
2021
locale = locale.split("_")[0]
22+
2123
def replace(s):
2224
if s is not None:
2325
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
2426
else:
2527
return None
26-
h = {k:replace(v) for k,v in h.iteritems()}
28+
h = {k: replace(v) for k, v in h.iteritems()}
2729
return h
2830

2931

3032
shortHelp = loadShortHelp()
31-

python/plugins/processing/algs/qgis/FieldsCalculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from processing.core.outputs import OutputVector
3939
from processing.tools import dataobjects, vector, system
4040

41-
from ui.FieldsCalculatorDialog import FieldsCalculatorDialog
41+
from .ui.FieldsCalculatorDialog import FieldsCalculatorDialog
4242

4343

4444
class FieldsCalculator(GeoAlgorithm):

python/plugins/processing/algs/saga/SagaNameDecorator.py

Lines changed: 118 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -26,129 +26,130 @@
2626
__revision__ = '$Format:%H$'
2727

2828
groups = {'grid_analysis': 'Raster analysis',
29-
'grid_calculus': 'Raster calculus',
30-
'grid_calculus_bsl': 'Raster calculus',
31-
'grid_discretisation': 'Raster analysis',
32-
'grid_filter': 'Raster filter',
33-
'grid_gridding': 'Raster creation tools',
34-
'grid_spline': 'Raster creation tools',
35-
'grid_tools': 'Raster tools',
36-
'grid_visualisation': 'Raster visualization',
37-
'imagery_classification': 'Image analysis',
38-
'imagery_rga': 'Image analysis',
39-
'imagery_segmentation': 'Image analysis',
40-
'imagery_tools': 'Image analysis',
41-
'io_esri_e00': 'I/O',
42-
'io_gdal': 'I/O',
43-
'io_gps': 'I/O',
44-
'io_grid': 'I/O',
45-
'io_grid_grib2': 'I/O',
46-
'io_grid_image': 'I/O',
47-
'io_odbc': 'I/O',
48-
'io_shapes': 'I/O',
49-
'io_shapes_dxf': 'I/O',
50-
'io_shapes_las': 'I/O',
51-
'io_table': 'I/O',
52-
'pj_georeference': 'Georeferencing',
53-
'pj_geotrans': 'Projections and Transformations',
54-
'pj_proj4': 'Projections and Transformations',
55-
'pointcloud_tools': 'Point clouds',
56-
'shapes_grid': 'Vector to raster',
57-
'shapes_lines': 'Vector line tools',
58-
'shapes_points': 'Vector point tools',
59-
'shapes_polygons': 'Vector polygon tools',
60-
'shapes_tools': 'Vector general tools',
61-
'shapes_transect': 'Vector general tools',
62-
'sim_cellular_automata': 'Simulation',
63-
'sim_ecosystems_hugget': 'Simulation',
64-
'sim_fire_spreading': 'Simulation',
65-
'sim_hydrology': 'Simulation',
66-
'statistics_grid': 'Geostatistics',
67-
'statistics_kriging': 'Raster creation tools',
68-
'statistics_points': 'Geostatistics',
69-
'statistics_regression': 'Geostatistics',
70-
'ta_channels': 'Terrain Analysis - Channels',
71-
'ta_compound': 'Terrain Analysis - Morphometry',
72-
'ta_hydrology': 'Terrain Analysis - Hydrology',
73-
'ta_lighting': 'Terrain Analysis - Lighting',
74-
'ta_morphometry': 'Terrain Analysis - Morphometry',
75-
'ta_preprocessor': 'Terrain Analysis - Hydrology',
76-
'ta_profiles': 'Terrain Analysis - Profiles',
77-
'table_calculus': 'Table tools',
78-
'table_tools': 'Table tools',
79-
'tin_tools': 'TIN'}
29+
'grid_calculus': 'Raster calculus',
30+
'grid_calculus_bsl': 'Raster calculus',
31+
'grid_discretisation': 'Raster analysis',
32+
'grid_filter': 'Raster filter',
33+
'grid_gridding': 'Raster creation tools',
34+
'grid_spline': 'Raster creation tools',
35+
'grid_tools': 'Raster tools',
36+
'grid_visualisation': 'Raster visualization',
37+
'imagery_classification': 'Image analysis',
38+
'imagery_rga': 'Image analysis',
39+
'imagery_segmentation': 'Image analysis',
40+
'imagery_tools': 'Image analysis',
41+
'io_esri_e00': 'I/O',
42+
'io_gdal': 'I/O',
43+
'io_gps': 'I/O',
44+
'io_grid': 'I/O',
45+
'io_grid_grib2': 'I/O',
46+
'io_grid_image': 'I/O',
47+
'io_odbc': 'I/O',
48+
'io_shapes': 'I/O',
49+
'io_shapes_dxf': 'I/O',
50+
'io_shapes_las': 'I/O',
51+
'io_table': 'I/O',
52+
'pj_georeference': 'Georeferencing',
53+
'pj_geotrans': 'Projections and Transformations',
54+
'pj_proj4': 'Projections and Transformations',
55+
'pointcloud_tools': 'Point clouds',
56+
'shapes_grid': 'Vector to raster',
57+
'shapes_lines': 'Vector line tools',
58+
'shapes_points': 'Vector point tools',
59+
'shapes_polygons': 'Vector polygon tools',
60+
'shapes_tools': 'Vector general tools',
61+
'shapes_transect': 'Vector general tools',
62+
'sim_cellular_automata': 'Simulation',
63+
'sim_ecosystems_hugget': 'Simulation',
64+
'sim_fire_spreading': 'Simulation',
65+
'sim_hydrology': 'Simulation',
66+
'statistics_grid': 'Geostatistics',
67+
'statistics_kriging': 'Raster creation tools',
68+
'statistics_points': 'Geostatistics',
69+
'statistics_regression': 'Geostatistics',
70+
'ta_channels': 'Terrain Analysis - Channels',
71+
'ta_compound': 'Terrain Analysis - Morphometry',
72+
'ta_hydrology': 'Terrain Analysis - Hydrology',
73+
'ta_lighting': 'Terrain Analysis - Lighting',
74+
'ta_morphometry': 'Terrain Analysis - Morphometry',
75+
'ta_preprocessor': 'Terrain Analysis - Hydrology',
76+
'ta_profiles': 'Terrain Analysis - Profiles',
77+
'table_calculus': 'Table tools',
78+
'table_tools': 'Table tools',
79+
'tin_tools': 'TIN'}
8080

8181

8282
def decoratedGroupName(name):
8383
return groups.get(name, name)
8484

8585
algorithms = {'Add Grid Values to Points': 'Add raster values to points',
86-
'Add Grid Values to Shapes': 'Add raster values to features',
87-
'Change Grid Values': 'Reclassify values (simple)',
88-
'Clip Grid with Polygon': 'Clip raster with polygon',
89-
'Cluster Analysis for Grids': 'Cluster Analysis',
90-
'Contour Lines from Grid': 'Contour Lines',
91-
'Cubic Spline Approximation': 'Interpolate (Cubic spline)',
92-
'Cut Shapes Layer': 'Cut vector Layer',
93-
'Directional Statistics for Single Grid': 'Directional Statistics for raster layer',
94-
'Filter Clumps': 'Remove small pixel clumps (to no-data)',
95-
'Fire Risk Analysis': 'Fire Risk Analysis',
96-
'Fit N Points to shape': 'Fit n points in polygon',
97-
'Flat Detection': 'Flat Detection',
98-
'Flow Accumulation (Flow Tracing)': 'Catchment area (Flow Tracing)',
99-
'Flow Accumulation (Recursive)': 'Catchment area (Recursive)',
100-
'Flow Accumulation (Top-Down)': 'Catchment area',
101-
'GWR for Multiple Predictor Grids': 'GWR for Multiple Predictor layers',
102-
'GWR for Single Predictor Grid': 'GWR for Single Predictor layer',
103-
'Geographically Weighted Multiple Regression (Points/Grids)': 'Geographically Weighted Multiple Regression (Points/Raster)',
104-
'Geographically Weighted Regression (Points/Grid)': 'Geographically Weighted Regression (Points/Raster)',
105-
'Geometric Figures': 'Geometric Figures',
106-
'Get Shapes Extents': 'Feature extents',
107-
"Global Moran's I for Grids": "Global Moran's I for raster layer",
108-
'Grid Buffer': 'Raster Buffer',
109-
'Grid Cell Index': 'Raster Cell Index',
110-
'Grid Difference': 'Raster Difference',
111-
'Grid Division': 'Raster Division',
112-
'Grid Masking': 'Raster Masking',
113-
'Grid Normalisation': 'Raster Normalisation',
114-
'Grid Orientation': 'Raster Orientation',
115-
'Grid Proximity Buffer': 'Raster Proximity Buffer',
116-
'Grid Skeletonization': 'Raster Skeletonization',
117-
'Grid Standardisation': 'Raster Standardisation',
118-
'Grid Statistics for Polygons': 'Raster Statistics for Polygons',
119-
'Grid Values to Points': 'Raster Values to Points',
120-
'Grid Values to Points (randomly)': 'Raster Values to Points (randomly)',
121-
'Grid Volume': 'Raster Volume',
122-
'Grids Product': 'Raster Product',
123-
'Grids Sum': 'Rasters Sum',
124-
'Inverse Distance Weighted': 'Inverse Distance Weighted Interpolation',
125-
'Identity': 'Polygon identity',
126-
'Merge Layers': 'Merge vector layers',
127-
'Modified Quadratic Shepard': 'Modified Quadratic Shepard interpolation',
128-
'Mosaick raster layers': 'Mosaic raster layers',
129-
'Multilevel B-Spline Interpolation': 'Multilevel B-Spline Interpolation',
130-
'Multilevel B-Spline Interpolation (from Grid)': 'Multilevel B-Spline Interpolation (from Raster)',
131-
'Multiple Regression Analysis (Grid/Grids)': 'Multiple Regression Analysis (Raster/Raster)',
132-
'Multiple Regression Analysis (Points/Grids)': 'Multiple Regression Analysis (Points/Raster)',
133-
'Proximity Grid': 'Proximity Raster',
134-
'QuadTree Structure to Shapes': 'QuadTree Structure to polygons',
135-
'Radius of Variance (Grid)': 'Radius of Variance (Raster)',
136-
'Reclassify Grid Values': 'Reclassify values',
137-
'Shapes Buffer (Attribute distance)': 'Variable distance buffer',
138-
'Shapes Buffer (Fixed distance)': 'fixed distance buffer',
139-
'Shapes to Grid': 'Rasterize',
140-
'Statistics for Grids': 'Statistics for Rasters',
141-
'Terrain Ruggedness Index (TRI)': 'Terrain Ruggedness Index (TRI)',
142-
'Thin Plate Spline (Global)': 'Thin Plate Spline (Global)',
143-
'Thin Plate Spline (Local)': 'Thin Plate Spline (Local)',
144-
'Thin Plate Spline (TIN)': 'Thin Plate Spline (TIN)',
145-
'Threshold Buffer': 'Threshold raster buffer',
146-
'Transform Shapes': 'Transform vector layer',
147-
'Transpose Grids': 'Transpose Raster layers',
148-
'Union': 'Polygon uUnion',
149-
'Update': 'Polygon update',
150-
'Upslope Area': 'Upslope Area',
151-
'Zonal Grid Statistics': 'Zonal raster statistics'}
86+
'Add Grid Values to Shapes': 'Add raster values to features',
87+
'Change Grid Values': 'Reclassify values (simple)',
88+
'Clip Grid with Polygon': 'Clip raster with polygon',
89+
'Cluster Analysis for Grids': 'Cluster Analysis',
90+
'Contour Lines from Grid': 'Contour Lines',
91+
'Cubic Spline Approximation': 'Interpolate (Cubic spline)',
92+
'Cut Shapes Layer': 'Cut vector Layer',
93+
'Directional Statistics for Single Grid': 'Directional Statistics for raster layer',
94+
'Filter Clumps': 'Remove small pixel clumps (to no-data)',
95+
'Fire Risk Analysis': 'Fire Risk Analysis',
96+
'Fit N Points to shape': 'Fit n points in polygon',
97+
'Flat Detection': 'Flat Detection',
98+
'Flow Accumulation (Flow Tracing)': 'Catchment area (Flow Tracing)',
99+
'Flow Accumulation (Recursive)': 'Catchment area (Recursive)',
100+
'Flow Accumulation (Top-Down)': 'Catchment area',
101+
'GWR for Multiple Predictor Grids': 'GWR for Multiple Predictor layers',
102+
'GWR for Single Predictor Grid': 'GWR for Single Predictor layer',
103+
'Geographically Weighted Multiple Regression (Points/Grids)': 'Geographically Weighted Multiple Regression (Points/Raster)',
104+
'Geographically Weighted Regression (Points/Grid)': 'Geographically Weighted Regression (Points/Raster)',
105+
'Geometric Figures': 'Geometric Figures',
106+
'Get Shapes Extents': 'Feature extents',
107+
"Global Moran's I for Grids": "Global Moran's I for raster layer",
108+
'Grid Buffer': 'Raster Buffer',
109+
'Grid Cell Index': 'Raster Cell Index',
110+
'Grid Difference': 'Raster Difference',
111+
'Grid Division': 'Raster Division',
112+
'Grid Masking': 'Raster Masking',
113+
'Grid Normalisation': 'Raster Normalisation',
114+
'Grid Orientation': 'Raster Orientation',
115+
'Grid Proximity Buffer': 'Raster Proximity Buffer',
116+
'Grid Skeletonization': 'Raster Skeletonization',
117+
'Grid Standardisation': 'Raster Standardisation',
118+
'Grid Statistics for Polygons': 'Raster Statistics for Polygons',
119+
'Grid Values to Points': 'Raster Values to Points',
120+
'Grid Values to Points (randomly)': 'Raster Values to Points (randomly)',
121+
'Grid Volume': 'Raster Volume',
122+
'Grids Product': 'Raster Product',
123+
'Grids Sum': 'Rasters Sum',
124+
'Inverse Distance Weighted': 'Inverse Distance Weighted Interpolation',
125+
'Identity': 'Polygon identity',
126+
'Merge Layers': 'Merge vector layers',
127+
'Modified Quadratic Shepard': 'Modified Quadratic Shepard interpolation',
128+
'Mosaick raster layers': 'Mosaic raster layers',
129+
'Multilevel B-Spline Interpolation': 'Multilevel B-Spline Interpolation',
130+
'Multilevel B-Spline Interpolation (from Grid)': 'Multilevel B-Spline Interpolation (from Raster)',
131+
'Multiple Regression Analysis (Grid/Grids)': 'Multiple Regression Analysis (Raster/Raster)',
132+
'Multiple Regression Analysis (Points/Grids)': 'Multiple Regression Analysis (Points/Raster)',
133+
'Proximity Grid': 'Proximity Raster',
134+
'QuadTree Structure to Shapes': 'QuadTree Structure to polygons',
135+
'Radius of Variance (Grid)': 'Radius of Variance (Raster)',
136+
'Reclassify Grid Values': 'Reclassify values',
137+
'Shapes Buffer (Attribute distance)': 'Variable distance buffer',
138+
'Shapes Buffer (Fixed distance)': 'fixed distance buffer',
139+
'Shapes to Grid': 'Rasterize',
140+
'Statistics for Grids': 'Statistics for Rasters',
141+
'Terrain Ruggedness Index (TRI)': 'Terrain Ruggedness Index (TRI)',
142+
'Thin Plate Spline (Global)': 'Thin Plate Spline (Global)',
143+
'Thin Plate Spline (Local)': 'Thin Plate Spline (Local)',
144+
'Thin Plate Spline (TIN)': 'Thin Plate Spline (TIN)',
145+
'Threshold Buffer': 'Threshold raster buffer',
146+
'Transform Shapes': 'Transform vector layer',
147+
'Transpose Grids': 'Transpose Raster layers',
148+
'Union': 'Polygon uUnion',
149+
'Update': 'Polygon update',
150+
'Upslope Area': 'Upslope Area',
151+
'Zonal Grid Statistics': 'Zonal raster statistics'}
152+
152153

153154
def decoratedAlgorithmName(name):
154155
decorated = algorithms.get(name, name)

python/plugins/processing/core/GeoAlgorithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
"""
1919

2020

21-
2221
__author__ = 'Victor Olaya'
2322
__date__ = 'August 2012'
2423
__copyright__ = '(C) 2012, Victor Olaya'
@@ -46,6 +45,7 @@
4645
from processing.tools.system import setTempOutput
4746
from processing.algs.help import shortHelp
4847

48+
4949
class GeoAlgorithm:
5050

5151
_icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')

python/plugins/processing/gui/AlgorithmClassification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def loadClassification():
5151
def classificationFile():
5252
return os.path.join(os.path.dirname(__file__), 'algclasssification.txt')
5353

54+
5455
def getClassificationEn(alg):
5556
if alg.commandLineName().lower() in classification:
5657
group, subgroup = classification[alg.commandLineName()]

python/plugins/processing/gui/AlgorithmDialogBase.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def __init__(self, alg):
8282
self.textShortHelp.setHtml(algHelp)
8383

8484
self.textShortHelp.setOpenLinks(False)
85+
8586
def linkClicked(url):
8687
webbrowser.open(url.toString())
8788
self.textShortHelp.connect(self.textShortHelp, SIGNAL("anchorClicked(const QUrl&)"), linkClicked)

python/plugins/processing/gui/ProcessingToolbox.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(self):
7070
self.txtTip.setOpenLinks(False)
7171
self.txtDisabled.connect(self.txtDisabled, SIGNAL("anchorClicked(const QUrl&)"),
7272
self.showDisabled)
73+
7374
def openSettings():
7475
dlg = ConfigDialog(self)
7576
dlg.exec_()
@@ -144,7 +145,7 @@ def activateProvider(self, providerName):
144145
provider = Processing.getProviderFromName(providerName)
145146
if not provider.canBeActivated():
146147
QMessageBox.warning(self, "Activate provider",
147-
"The provider has been activated, but it might need additional configuration.")
148+
"The provider has been activated, but it might need additional configuration.")
148149

149150
def algsListHasChanged(self):
150151
if self.updateAlgList:
@@ -287,7 +288,6 @@ def addRecentAlgorithms(self, updating):
287288

288289
self.algorithmTree.setWordWrap(True)
289290

290-
291291
def fillTreeUsingProviders(self):
292292
self.algorithmTree.clear()
293293
self.disabledProviderItems = {}
@@ -305,6 +305,7 @@ def fillTreeUsingProviders(self):
305305
providerItem.setHidden(True)
306306
self.disabledProviderItems[providerName] = providerItem
307307

308+
308309
class TreeAlgorithmItem(QTreeWidgetItem):
309310

310311
def __init__(self, alg):
@@ -402,5 +403,3 @@ def activateProvider():
402403
self.setToolTip(0, self.text(0))
403404
for groupItem in groups.values():
404405
self.addChild(groupItem)
405-
406-

python/plugins/processing/modeler/ModelerDialog.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def fillAlgorithmTree(self):
468468
if text != '':
469469
self.algorithmTree.expandAll()
470470

471-
def fillAlgorithmTreeUsingProviders(self):
471+
def fillAlgorithmTreeUsingProviders(self):
472472
self.algorithmTree.clear()
473473
text = unicode(self.searchBox.text())
474474
allAlgs = ModelerUtils.allAlgs

0 commit comments

Comments
 (0)