Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] added some in-code docs and comments
  • Loading branch information
volaya committed Sep 14, 2013
1 parent 2e3dfba commit a7dfcaa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion python/plugins/processing/algs/SaveSelectedFeatures.py
Expand Up @@ -80,7 +80,8 @@ def processAlgorithm(self, progress):
inputFilename = self.getParameterValue(self.INPUT_LAYER)

#The output. It will get the value of the destinatation file entered by the user.
#If the user select "Save to temporary file", when we arrive here it will already have an asigned value, which will be
#If the user select "Save to temporary file", when we arrive here it will already have an asigned value,
#which will be a temporary file using the first supported file format of the corresponding algorithm provider
output = self.getOutputFromName(self.OUTPUT_LAYER)

#input layers values are always a string with its location.
Expand All @@ -93,6 +94,9 @@ def processAlgorithm(self, progress):
#First we create the output layer.
#To do so, we call the getVectorWriter method in the Output object.
#That will give us a VectorWriter, that we can later use to add features.
#The destination file has its format selected based on the file extension.
#If the selected format is not supported, the first available format from
#the provider is used, and the corresponding file extension appended
provider = vectorLayer.dataProvider()
writer = output.getVectorWriter( provider.fields(),
provider.geometryType(),
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/gui/HistoryDialog.py
Expand Up @@ -52,6 +52,7 @@ def __init__(self):
self.tree.currentItemChanged.connect(self.changeText)
self.clearButton.clicked.connect(self.clearLog)

self.tree.setContextMenuPolicy(Qt.CustomContextMenu)
self.tree.customContextMenuRequested.connect(self.showPopupMenu)

self.fillTree()
Expand Down
7 changes: 6 additions & 1 deletion python/plugins/processing/tools/dataobjects.py
Expand Up @@ -2,7 +2,7 @@

"""
***************************************************************************
py
dataobject.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Expand Down Expand Up @@ -101,6 +101,7 @@ def loadList(layers):
load(layer)

def load(fileName, name = None, crs = None, style = None):
'''Loads a layer/table into the current project, given its file'''
if fileName == None:
return
prjSetting = None
Expand Down Expand Up @@ -156,6 +157,10 @@ def getObject(uriorname):
return ret

def getObjectFromUri(uri, forceLoad = True):
'''returns an object (layer/table) given a file location.
if forceLoad is true, it tries to load it if it is not currently open
Otherwise, it will return the object only if it is loaded in QGIS'''

if uri is None:
return None
layers = getRasterLayers()
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/tools/vector.py
Expand Up @@ -236,8 +236,8 @@ def getUniqueValues(layer, fieldIndex):
def getUniqueValuesCount(layer, fieldIndex):
return len(getUniqueValues(layer, fieldIndex))

# From two input field maps, create single field map
def combineVectorFields(layerA, layerB):
'''Create single field map from two input field maps'''
fields = []
fieldsA = layerA.dataProvider().fields()
fields.extend(fieldsA)
Expand Down

0 comments on commit a7dfcaa

Please sign in to comment.