Skip to content
Permalink
Browse files

[processing] minor bug fixes

  • Loading branch information
volaya committed Oct 7, 2013
1 parent 503ee57 commit 0150fe7c98a17f31e52abddf41948ccdf8f8d182
@@ -115,29 +115,28 @@ def processAlgorithm(self, progress):
# first available format from the provider is used, and the
# corresponding file extension appended.

provider = vectorLayer.dataProvider()

# vectorLayer.crs() is the layer crs. By default all resulting
# layers are assumed to be in the same crs are the inputs, and
# will be loaded with this assumptions when executed from the
# toolbox. The self.crs variable has to be canged in case this
# toolbox. The self.crs variable has to be changed in case this
# is not true, or in case there are no input layer from which
# the output crs can be infered


provider = vectorLayer.dataProvider()

writer = output.getVectorWriter(provider.fields(),
provider.geometryType(), vectorLayer.crs())

# Now we take the selected features and add them to the output
# layer
features = vector.features(vectorLayer)
total = len(features)
i = 0
total = len(features)
for (i, feat) in enumerate(features):
writer.addFeature(feat)

# We use the progress object to communicate with the user
progress.setPercentage(100 * i / float(total))
i += 1
progress.setPercentage(100 * i / float(total))
del writer

# There is nothing more to do here. We do not have to open the
@@ -28,6 +28,9 @@

class SilentProgress:

def error(self, msg):
print msg

def setText(self, text):
pass

@@ -28,6 +28,7 @@
from PyQt4.QtCore import *
from PyQt4 import QtGui
from processing import interface
from qgis.gui import *


class MessageBarProgress:
@@ -42,6 +43,12 @@ def __init__(self):
interface.iface.messageBar().pushWidget(self.progressMessageBar,
interface.iface.messageBar().INFO)

def error(self, msg):
interface.iface.messageBar().clearWidgets()
interface.iface.messageBar().pushMessage("Error", msg,
level = QgsMessageBar.CRITICAL,
duration = 3)

def setText(self, text):
pass

@@ -99,7 +99,7 @@ def showPopupMenu(self, point):
executeAction = QAction(self.tr('Execute'), self.algorithmTree)
executeAction.triggered.connect(self.executeAlgorithm)
popupmenu.addAction(executeAction)
if alg.canRunInBatchMode and not self.allowOnlyOpenedLayers:
if alg.canRunInBatchMode and not alg.allowOnlyOpenedLayers:
executeBatchAction = QAction(
self.tr('Execute as batch process'),
self.algorithmTree)
@@ -60,7 +60,7 @@ def runalg(alg, progress):
msg = 'Uncaught error executing ' + str(alg.name) \
+ '\nSee log for more information'
ProcessingLog.addToLog(sys.exc_info()[0], ProcessingLog.LOG_ERROR)
progress.error(e.msg)
progress.error(msg)
return False

@staticmethod
@@ -16,6 +16,7 @@
* *
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
@@ -119,8 +120,7 @@ def openModel(self, filename):
self.algParameters = []
self.algOutputs = []
self.paramValues = {}
self.dependencies = []

self.dependencies = []
self.descriptionFile = filename
lines = codecs.open(filename, 'r', encoding='utf-8')
line = lines.readline().strip('\n').strip('\r')

0 comments on commit 0150fe7

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