Skip to content
Permalink
Browse files

[processing] fix algorithm execution

  • Loading branch information
alexbruy committed Oct 4, 2014
1 parent ba3cca2 commit b9f89ae2b162aaca4d37cbac82d9c4f372886bcf
@@ -25,6 +25,8 @@

__revision__ = '$Format:%H$'

import math

from PyQt4.QtCore import *
from qgis.core import *
from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -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):
@@ -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
@@ -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)
@@ -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
@@ -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)
@@ -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)

0 comments on commit b9f89ae

Please sign in to comment.
You can’t perform that action at this time.