Skip to content

Commit

Permalink
Merge pull request #2 from alexbruy/processing-ux
Browse files Browse the repository at this point in the history
[processing] PEP8 fixes
  • Loading branch information
volaya committed Jan 8, 2016
2 parents 6230237 + 4137437 commit b0a8c18
Show file tree
Hide file tree
Showing 9 changed files with 130 additions and 127 deletions.
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/gdal/GdalAlgorithmDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def parametersHaveChanged(self):
commands = self.alg.getConsoleCommands()
commands = [c for c in commands if c not in ['cmd.exe', '/C ']]
self.text.setPlainText(" ".join(commands))
except AlgorithmDialogBase.InvalidParameterValue, e:
except AlgorithmDialogBase.InvalidParameterValue as e:
self.text.setPlainText("Invalid value for parameter '%s'" % e.parameter.description)
except:
self.text.setPlainText("")
5 changes: 3 additions & 2 deletions python/plugins/processing/algs/help/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from qgis.core import *
from PyQt4.QtCore import QSettings, QLocale


def loadShortHelp():
h = {}
path = os.path.dirname(__file__)
Expand All @@ -18,14 +19,14 @@ def loadShortHelp():
else:
locale = QSettings().value('locale/userLocale', '')
locale = locale.split("_")[0]

def replace(s):
if s is not None:
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
else:
return None
h = {k:replace(v) for k,v in h.iteritems()}
h = {k: replace(v) for k, v in h.iteritems()}
return h


shortHelp = loadShortHelp()

2 changes: 1 addition & 1 deletion python/plugins/processing/algs/qgis/FieldsCalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from processing.core.outputs import OutputVector
from processing.tools import dataobjects, vector, system

from ui.FieldsCalculatorDialog import FieldsCalculatorDialog
from .ui.FieldsCalculatorDialog import FieldsCalculatorDialog


class FieldsCalculator(GeoAlgorithm):
Expand Down
235 changes: 118 additions & 117 deletions python/plugins/processing/algs/saga/SagaNameDecorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,129 +26,130 @@
__revision__ = '$Format:%H$'

groups = {'grid_analysis': 'Raster analysis',
'grid_calculus': 'Raster calculus',
'grid_calculus_bsl': 'Raster calculus',
'grid_discretisation': 'Raster analysis',
'grid_filter': 'Raster filter',
'grid_gridding': 'Raster creation tools',
'grid_spline': 'Raster creation tools',
'grid_tools': 'Raster tools',
'grid_visualisation': 'Raster visualization',
'imagery_classification': 'Image analysis',
'imagery_rga': 'Image analysis',
'imagery_segmentation': 'Image analysis',
'imagery_tools': 'Image analysis',
'io_esri_e00': 'I/O',
'io_gdal': 'I/O',
'io_gps': 'I/O',
'io_grid': 'I/O',
'io_grid_grib2': 'I/O',
'io_grid_image': 'I/O',
'io_odbc': 'I/O',
'io_shapes': 'I/O',
'io_shapes_dxf': 'I/O',
'io_shapes_las': 'I/O',
'io_table': 'I/O',
'pj_georeference': 'Georeferencing',
'pj_geotrans': 'Projections and Transformations',
'pj_proj4': 'Projections and Transformations',
'pointcloud_tools': 'Point clouds',
'shapes_grid': 'Vector to raster',
'shapes_lines': 'Vector line tools',
'shapes_points': 'Vector point tools',
'shapes_polygons': 'Vector polygon tools',
'shapes_tools': 'Vector general tools',
'shapes_transect': 'Vector general tools',
'sim_cellular_automata': 'Simulation',
'sim_ecosystems_hugget': 'Simulation',
'sim_fire_spreading': 'Simulation',
'sim_hydrology': 'Simulation',
'statistics_grid': 'Geostatistics',
'statistics_kriging': 'Raster creation tools',
'statistics_points': 'Geostatistics',
'statistics_regression': 'Geostatistics',
'ta_channels': 'Terrain Analysis - Channels',
'ta_compound': 'Terrain Analysis - Morphometry',
'ta_hydrology': 'Terrain Analysis - Hydrology',
'ta_lighting': 'Terrain Analysis - Lighting',
'ta_morphometry': 'Terrain Analysis - Morphometry',
'ta_preprocessor': 'Terrain Analysis - Hydrology',
'ta_profiles': 'Terrain Analysis - Profiles',
'table_calculus': 'Table tools',
'table_tools': 'Table tools',
'tin_tools': 'TIN'}
'grid_calculus': 'Raster calculus',
'grid_calculus_bsl': 'Raster calculus',
'grid_discretisation': 'Raster analysis',
'grid_filter': 'Raster filter',
'grid_gridding': 'Raster creation tools',
'grid_spline': 'Raster creation tools',
'grid_tools': 'Raster tools',
'grid_visualisation': 'Raster visualization',
'imagery_classification': 'Image analysis',
'imagery_rga': 'Image analysis',
'imagery_segmentation': 'Image analysis',
'imagery_tools': 'Image analysis',
'io_esri_e00': 'I/O',
'io_gdal': 'I/O',
'io_gps': 'I/O',
'io_grid': 'I/O',
'io_grid_grib2': 'I/O',
'io_grid_image': 'I/O',
'io_odbc': 'I/O',
'io_shapes': 'I/O',
'io_shapes_dxf': 'I/O',
'io_shapes_las': 'I/O',
'io_table': 'I/O',
'pj_georeference': 'Georeferencing',
'pj_geotrans': 'Projections and Transformations',
'pj_proj4': 'Projections and Transformations',
'pointcloud_tools': 'Point clouds',
'shapes_grid': 'Vector to raster',
'shapes_lines': 'Vector line tools',
'shapes_points': 'Vector point tools',
'shapes_polygons': 'Vector polygon tools',
'shapes_tools': 'Vector general tools',
'shapes_transect': 'Vector general tools',
'sim_cellular_automata': 'Simulation',
'sim_ecosystems_hugget': 'Simulation',
'sim_fire_spreading': 'Simulation',
'sim_hydrology': 'Simulation',
'statistics_grid': 'Geostatistics',
'statistics_kriging': 'Raster creation tools',
'statistics_points': 'Geostatistics',
'statistics_regression': 'Geostatistics',
'ta_channels': 'Terrain Analysis - Channels',
'ta_compound': 'Terrain Analysis - Morphometry',
'ta_hydrology': 'Terrain Analysis - Hydrology',
'ta_lighting': 'Terrain Analysis - Lighting',
'ta_morphometry': 'Terrain Analysis - Morphometry',
'ta_preprocessor': 'Terrain Analysis - Hydrology',
'ta_profiles': 'Terrain Analysis - Profiles',
'table_calculus': 'Table tools',
'table_tools': 'Table tools',
'tin_tools': 'TIN'}


def decoratedGroupName(name):
return groups.get(name, name)

algorithms = {'Add Grid Values to Points': 'Add raster values to points',
'Add Grid Values to Shapes': 'Add raster values to features',
'Change Grid Values': 'Reclassify values (simple)',
'Clip Grid with Polygon': 'Clip raster with polygon',
'Cluster Analysis for Grids': 'Cluster Analysis',
'Contour Lines from Grid': 'Contour Lines',
'Cubic Spline Approximation': 'Interpolate (Cubic spline)',
'Cut Shapes Layer': 'Cut vector Layer',
'Directional Statistics for Single Grid': 'Directional Statistics for raster layer',
'Filter Clumps': 'Remove small pixel clumps (to no-data)',
'Fire Risk Analysis': 'Fire Risk Analysis',
'Fit N Points to shape': 'Fit n points in polygon',
'Flat Detection': 'Flat Detection',
'Flow Accumulation (Flow Tracing)': 'Catchment area (Flow Tracing)',
'Flow Accumulation (Recursive)': 'Catchment area (Recursive)',
'Flow Accumulation (Top-Down)': 'Catchment area',
'GWR for Multiple Predictor Grids': 'GWR for Multiple Predictor layers',
'GWR for Single Predictor Grid': 'GWR for Single Predictor layer',
'Geographically Weighted Multiple Regression (Points/Grids)': 'Geographically Weighted Multiple Regression (Points/Raster)',
'Geographically Weighted Regression (Points/Grid)': 'Geographically Weighted Regression (Points/Raster)',
'Geometric Figures': 'Geometric Figures',
'Get Shapes Extents': 'Feature extents',
"Global Moran's I for Grids": "Global Moran's I for raster layer",
'Grid Buffer': 'Raster Buffer',
'Grid Cell Index': 'Raster Cell Index',
'Grid Difference': 'Raster Difference',
'Grid Division': 'Raster Division',
'Grid Masking': 'Raster Masking',
'Grid Normalisation': 'Raster Normalisation',
'Grid Orientation': 'Raster Orientation',
'Grid Proximity Buffer': 'Raster Proximity Buffer',
'Grid Skeletonization': 'Raster Skeletonization',
'Grid Standardisation': 'Raster Standardisation',
'Grid Statistics for Polygons': 'Raster Statistics for Polygons',
'Grid Values to Points': 'Raster Values to Points',
'Grid Values to Points (randomly)': 'Raster Values to Points (randomly)',
'Grid Volume': 'Raster Volume',
'Grids Product': 'Raster Product',
'Grids Sum': 'Rasters Sum',
'Inverse Distance Weighted': 'Inverse Distance Weighted Interpolation',
'Identity': 'Polygon identity',
'Merge Layers': 'Merge vector layers',
'Modified Quadratic Shepard': 'Modified Quadratic Shepard interpolation',
'Mosaick raster layers': 'Mosaic raster layers',
'Multilevel B-Spline Interpolation': 'Multilevel B-Spline Interpolation',
'Multilevel B-Spline Interpolation (from Grid)': 'Multilevel B-Spline Interpolation (from Raster)',
'Multiple Regression Analysis (Grid/Grids)': 'Multiple Regression Analysis (Raster/Raster)',
'Multiple Regression Analysis (Points/Grids)': 'Multiple Regression Analysis (Points/Raster)',
'Proximity Grid': 'Proximity Raster',
'QuadTree Structure to Shapes': 'QuadTree Structure to polygons',
'Radius of Variance (Grid)': 'Radius of Variance (Raster)',
'Reclassify Grid Values': 'Reclassify values',
'Shapes Buffer (Attribute distance)': 'Variable distance buffer',
'Shapes Buffer (Fixed distance)': 'fixed distance buffer',
'Shapes to Grid': 'Rasterize',
'Statistics for Grids': 'Statistics for Rasters',
'Terrain Ruggedness Index (TRI)': 'Terrain Ruggedness Index (TRI)',
'Thin Plate Spline (Global)': 'Thin Plate Spline (Global)',
'Thin Plate Spline (Local)': 'Thin Plate Spline (Local)',
'Thin Plate Spline (TIN)': 'Thin Plate Spline (TIN)',
'Threshold Buffer': 'Threshold raster buffer',
'Transform Shapes': 'Transform vector layer',
'Transpose Grids': 'Transpose Raster layers',
'Union': 'Polygon uUnion',
'Update': 'Polygon update',
'Upslope Area': 'Upslope Area',
'Zonal Grid Statistics': 'Zonal raster statistics'}
'Add Grid Values to Shapes': 'Add raster values to features',
'Change Grid Values': 'Reclassify values (simple)',
'Clip Grid with Polygon': 'Clip raster with polygon',
'Cluster Analysis for Grids': 'Cluster Analysis',
'Contour Lines from Grid': 'Contour Lines',
'Cubic Spline Approximation': 'Interpolate (Cubic spline)',
'Cut Shapes Layer': 'Cut vector Layer',
'Directional Statistics for Single Grid': 'Directional Statistics for raster layer',
'Filter Clumps': 'Remove small pixel clumps (to no-data)',
'Fire Risk Analysis': 'Fire Risk Analysis',
'Fit N Points to shape': 'Fit n points in polygon',
'Flat Detection': 'Flat Detection',
'Flow Accumulation (Flow Tracing)': 'Catchment area (Flow Tracing)',
'Flow Accumulation (Recursive)': 'Catchment area (Recursive)',
'Flow Accumulation (Top-Down)': 'Catchment area',
'GWR for Multiple Predictor Grids': 'GWR for Multiple Predictor layers',
'GWR for Single Predictor Grid': 'GWR for Single Predictor layer',
'Geographically Weighted Multiple Regression (Points/Grids)': 'Geographically Weighted Multiple Regression (Points/Raster)',
'Geographically Weighted Regression (Points/Grid)': 'Geographically Weighted Regression (Points/Raster)',
'Geometric Figures': 'Geometric Figures',
'Get Shapes Extents': 'Feature extents',
"Global Moran's I for Grids": "Global Moran's I for raster layer",
'Grid Buffer': 'Raster Buffer',
'Grid Cell Index': 'Raster Cell Index',
'Grid Difference': 'Raster Difference',
'Grid Division': 'Raster Division',
'Grid Masking': 'Raster Masking',
'Grid Normalisation': 'Raster Normalisation',
'Grid Orientation': 'Raster Orientation',
'Grid Proximity Buffer': 'Raster Proximity Buffer',
'Grid Skeletonization': 'Raster Skeletonization',
'Grid Standardisation': 'Raster Standardisation',
'Grid Statistics for Polygons': 'Raster Statistics for Polygons',
'Grid Values to Points': 'Raster Values to Points',
'Grid Values to Points (randomly)': 'Raster Values to Points (randomly)',
'Grid Volume': 'Raster Volume',
'Grids Product': 'Raster Product',
'Grids Sum': 'Rasters Sum',
'Inverse Distance Weighted': 'Inverse Distance Weighted Interpolation',
'Identity': 'Polygon identity',
'Merge Layers': 'Merge vector layers',
'Modified Quadratic Shepard': 'Modified Quadratic Shepard interpolation',
'Mosaick raster layers': 'Mosaic raster layers',
'Multilevel B-Spline Interpolation': 'Multilevel B-Spline Interpolation',
'Multilevel B-Spline Interpolation (from Grid)': 'Multilevel B-Spline Interpolation (from Raster)',
'Multiple Regression Analysis (Grid/Grids)': 'Multiple Regression Analysis (Raster/Raster)',
'Multiple Regression Analysis (Points/Grids)': 'Multiple Regression Analysis (Points/Raster)',
'Proximity Grid': 'Proximity Raster',
'QuadTree Structure to Shapes': 'QuadTree Structure to polygons',
'Radius of Variance (Grid)': 'Radius of Variance (Raster)',
'Reclassify Grid Values': 'Reclassify values',
'Shapes Buffer (Attribute distance)': 'Variable distance buffer',
'Shapes Buffer (Fixed distance)': 'fixed distance buffer',
'Shapes to Grid': 'Rasterize',
'Statistics for Grids': 'Statistics for Rasters',
'Terrain Ruggedness Index (TRI)': 'Terrain Ruggedness Index (TRI)',
'Thin Plate Spline (Global)': 'Thin Plate Spline (Global)',
'Thin Plate Spline (Local)': 'Thin Plate Spline (Local)',
'Thin Plate Spline (TIN)': 'Thin Plate Spline (TIN)',
'Threshold Buffer': 'Threshold raster buffer',
'Transform Shapes': 'Transform vector layer',
'Transpose Grids': 'Transpose Raster layers',
'Union': 'Polygon uUnion',
'Update': 'Polygon update',
'Upslope Area': 'Upslope Area',
'Zonal Grid Statistics': 'Zonal raster statistics'}


def decoratedAlgorithmName(name):
decorated = algorithms.get(name, name)
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"""



__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
Expand Down Expand Up @@ -46,6 +45,7 @@
from processing.tools.system import setTempOutput
from processing.algs.help import shortHelp


class GeoAlgorithm:

_icon = QIcon(os.path.dirname(__file__) + '/../images/alg.png')
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/gui/AlgorithmClassification.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def loadClassification():
def classificationFile():
return os.path.join(os.path.dirname(__file__), 'algclasssification.txt')


def getClassificationEn(alg):
if alg.commandLineName().lower() in classification:
group, subgroup = classification[alg.commandLineName()]
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/gui/AlgorithmDialogBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(self, alg):
self.textShortHelp.setHtml(algHelp)

self.textShortHelp.setOpenLinks(False)

def linkClicked(url):
webbrowser.open(url.toString())
self.textShortHelp.connect(self.textShortHelp, SIGNAL("anchorClicked(const QUrl&)"), linkClicked)
Expand Down
7 changes: 3 additions & 4 deletions python/plugins/processing/gui/ProcessingToolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def __init__(self):
self.txtTip.setOpenLinks(False)
self.txtDisabled.connect(self.txtDisabled, SIGNAL("anchorClicked(const QUrl&)"),
self.showDisabled)

def openSettings():
dlg = ConfigDialog(self)
dlg.exec_()
Expand Down Expand Up @@ -144,7 +145,7 @@ def activateProvider(self, providerName):
provider = Processing.getProviderFromName(providerName)
if not provider.canBeActivated():
QMessageBox.warning(self, "Activate provider",
"The provider has been activated, but it might need additional configuration.")
"The provider has been activated, but it might need additional configuration.")

def algsListHasChanged(self):
if self.updateAlgList:
Expand Down Expand Up @@ -287,7 +288,6 @@ def addRecentAlgorithms(self, updating):

self.algorithmTree.setWordWrap(True)


def fillTreeUsingProviders(self):
self.algorithmTree.clear()
self.disabledProviderItems = {}
Expand All @@ -305,6 +305,7 @@ def fillTreeUsingProviders(self):
providerItem.setHidden(True)
self.disabledProviderItems[providerName] = providerItem


class TreeAlgorithmItem(QTreeWidgetItem):

def __init__(self, alg):
Expand Down Expand Up @@ -402,5 +403,3 @@ def activateProvider():
self.setToolTip(0, self.text(0))
for groupItem in groups.values():
self.addChild(groupItem)


2 changes: 1 addition & 1 deletion python/plugins/processing/modeler/ModelerDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def fillAlgorithmTree(self):
if text != '':
self.algorithmTree.expandAll()

def fillAlgorithmTreeUsingProviders(self):
def fillAlgorithmTreeUsingProviders(self):
self.algorithmTree.clear()
text = unicode(self.searchBox.text())
allAlgs = ModelerUtils.allAlgs
Expand Down

0 comments on commit b0a8c18

Please sign in to comment.