Skip to content

Commit

Permalink
[processing] fix algorithm execution
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 4, 2014
1 parent ba3cca2 commit b9f89ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions python/plugins/processing/algs/qgis/Grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

__revision__ = '$Format:%H$'

import math

from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
Expand Down Expand Up @@ -132,8 +134,8 @@ def _rectangleGridLine(self, writer, width, height, originX, originY,
hSpacing, vSpacing):
ft = QgsFeature()

columns = int(floor(float(width) / hSpacing))
rows = int(floor(float(height) / vSpacing))
columns = int(math.floor(float(width) / hSpacing))
rows = int(math.floor(float(height) / vSpacing))

# Longitude lines
for col in xrange(0, columns + 1):
Expand Down Expand Up @@ -163,8 +165,8 @@ def _rectangleGridPoly(self, writer, width, height, originX, originY,
hSpacing, vSpacing):
ft = QgsFeature()

columns = int(floor(float(width) / hSpacing))
rows = int(floor(float(height) / vSpacing))
columns = int(math.floor(float(width) / hSpacing))
rows = int(math.floor(float(height) / vSpacing))

for col in xrange(0, columns):
# (column + 1) and (row + 1) calculation is used to maintain
Expand Down Expand Up @@ -194,8 +196,8 @@ def _diamondGrid(self, writer, width, height, originX, originY,
halfHSpacing = hSpacing / 2
halfVSpacing = vSpacing / 2

columns = int(floor(float(width) / halfHSpacing))
rows = int(floor(float(height) / vSpacing))
columns = int(math.floor(float(width) / halfHSpacing))
rows = int(math.floor(float(height) / vSpacing))

for col in xrange(0, columns):
x1 = originX + ((col + 0) * halfHSpacing)
Expand Down Expand Up @@ -234,8 +236,8 @@ def _hexagonGrid(self, writer, width, height, originX, originY,

halfVSpacing = vSpacing / 2

columns = int(floor(float(width) / hSpacing))
rows = int(floor(float(height) / vSpacing))
columns = int(math.floor(float(width) / hSpacing))
rows = int(math.floor(float(height) / vSpacing))

for col in xrange(0, columns):
# (column + 1) and (row + 1) calculation is used to maintain
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/gui/ParametersDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ class ParametersDialog(AlgorithmExecutionDialog):
NOT_SELECTED = QtCore.QCoreApplication.translate('ParametersDialog', '[Not selected]')

def __init__(self, alg):
AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)

self.paramTable = ParametersPanel(self, alg)
self.scrollArea = QtGui.QScrollArea()
self.scrollArea.setFrameShape(QtGui.QFrame.NoFrame);
self.scrollArea.setWidget(self.paramTable)
self.scrollArea.setWidgetResizable(True)
self.executed = False

AlgorithmExecutionDialog.__init__(self, alg, self.scrollArea)
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def getIcon(self):
def execute(self):
filename = QtGui.QFileDialog.getOpenFileName(self.toolbox,
self.tr('Script files', 'AddScriptFromFileAction'), None,
self.tr('Script files (*.py *.PY)', 'AddScriptFromFileAction'))
self.tr('Script files (*.py *.PY)', 'AddScriptFromFileAction'))
if filename:
try:
script = ScriptAlgorithm(filename)
Expand Down

0 comments on commit b9f89ae

Please sign in to comment.