Skip to content

Commit

Permalink
indentation update
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 6, 2014
1 parent e9f43c4 commit a7b5a8a
Show file tree
Hide file tree
Showing 36 changed files with 198 additions and 197 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/ftools/MeanCoords.py
Expand Up @@ -66,12 +66,12 @@ def processAlgorithm(self, progress):
uniqueField = self.getParameterValue(self.UID)

print weightField, uniqueField

if weightField is None:
weightIndex = -1
else:
weightIndex = layer.fieldNameIndex(weightField)

if uniqueField is None:
uniqueIndex = -1
else:
Expand Down
20 changes: 10 additions & 10 deletions python/plugins/processing/algs/ftools/SpatialJoin.py
Expand Up @@ -56,7 +56,7 @@ def myself(L):
class SpatialJoin(GeoAlgorithm):
'''
Join by location
Port of the spatial join algorithm from fTools to the Processing Toolbox.
'''

Expand All @@ -67,7 +67,7 @@ class SpatialJoin(GeoAlgorithm):
GEOMETRY = "GEOMETRY"
KEEP = "KEEP"
OUTPUT = "OUTPUT"

SUMMARYS = [
'Take attributes of the first located feature',
'Take summary of intersecting features'
Expand All @@ -77,7 +77,7 @@ class SpatialJoin(GeoAlgorithm):
'Use geometry from target layer',
'Use geometry from joined layer (multipart if summary)'
]

KEEPS = [
'Only keep matching records',
'Keep all records (including non-matching target records)'
Expand All @@ -87,7 +87,7 @@ class SpatialJoin(GeoAlgorithm):
# def getIcon(self):
# return QIcon(os.path.dirname(__file__) + "/icons/join_location.png")
#===========================================================================

def defineCharacteristics(self):
self.name = "Join by location"
self.group = "Vector general tools"
Expand All @@ -106,7 +106,7 @@ def processAlgorithm(self, progress):
sumList = self.getParameterValue(self.STATS).upper().replace(' ','').split(',')
use_geom = self.getParameterValue(self.GEOMETRY)
keep = self.getParameterValue(self.KEEP) == 1

input1 = self.getParameterValue(self.INPUT1)
layer1 = dataobjects.getObjectFromUri(input1)
provider1 = layer1.dataProvider()
Expand All @@ -116,8 +116,8 @@ def processAlgorithm(self, progress):
layer2 = dataobjects.getObjectFromUri(input2)
provider2 = layer2.dataProvider()
fieldList2 = provider2.fields()
fieldList = QgsFields()

fieldList = QgsFields()
if not summary:
fieldList2 = vector.testForUniqueness(fieldList1, fieldList2)
seq = range(0, len(fieldList1) + len(fieldList2))
Expand Down Expand Up @@ -157,12 +157,12 @@ def processAlgorithm(self, progress):
geometry_type = provider2.geometryType()

writer = output.getVectorWriter(fields, geometry_type, crs)

inFeat = QgsFeature()
outFeat = QgsFeature()
inFeatB = QgsFeature()
inGeom = QgsGeometry()

progress.setPercentage(15)
start = 15.00
add = 85.00 / provider1.featureCount()
Expand Down Expand Up @@ -240,7 +240,7 @@ def processAlgorithm(self, progress):
writer.addFeature(outFeat)
start = start + add
progress.setPercentage(start)

del writer

def singleToMultiGeom(self, wkbType):
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/gui/ContextAction.py
Expand Up @@ -31,11 +31,11 @@ class ContextAction:
def setData(self, alg, toolbox):
self.alg = alg
self.toolbox = toolbox

def updateToolbox(self):
'''
Updates the list of algorithms and then the toolbox.
It only update the item corresponding to the provider of the algorithm.
Updates the list of algorithms and then the toolbox.
It only update the item corresponding to the provider of the algorithm.
To be called after the action is executed, if needed
'''
'''
self.toolbox.updateProvider(self.alg.provider.getName())
2 changes: 1 addition & 1 deletion python/plugins/processing/gui/CreateNewScriptAction.py
Expand Up @@ -54,5 +54,5 @@ def execute(self):
dlg = ScriptEditorDialog(ScriptEditorDialog.SCRIPT_R, None)
dlg.show()
dlg.exec_()
if dlg.update:
if dlg.update:
self.toolbox.updateProvider('model')
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/MultipleExternalInputDialog.py
Expand Up @@ -92,14 +92,14 @@ def addFile(self):
path = lastfolder
else :
path = QtCore.QDir.currentPath()

filesOpened = QtGui.QFileDialog.getOpenFileNames( None, "Select the file(s) to use", path, "All files (*.*)" )

lastfile = ""
for item in filesOpened:
self.options.append( str(item) )
lastfile=item

self.setTableContent()
folder = os.path.dirname( str( lastfile ) )
settings.setValue("processingFilesLastFolder", folder)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/gui/ParametersPanel.py
Expand Up @@ -9,7 +9,7 @@
(C) 2013 by CS Systemes d'information (CS SI)
Email : volayaf at gmail dot com
otb at c-s dot fr (CS SI)
Contributors : Victor Olaya
Contributors : Victor Olaya
Alexia Mondot (CS SI) - managing the new parameter ParameterMultipleExternalInput
***************************************************************************
* *
Expand Down Expand Up @@ -221,7 +221,7 @@ def getWidgetFromParameter(self, param):
items.append((self.getExtendedLayerName(layer), layer))
# if already set, put first in list
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterTable):
Expand All @@ -243,7 +243,7 @@ def getWidgetFromParameter(self, param):
items.append((layer.name(), layer))
# if already set, put first in list
for i,(name,layer) in enumerate(items):
if layer and layer.source() == param.value:
if layer and layer.source() == param.value:
items.insert(0, items.pop(i))
item = InputLayerSelectorPanel(items)
elif isinstance(param, ParameterBoolean):
Expand Down
46 changes: 23 additions & 23 deletions python/plugins/processing/gui/ProcessingToolbox.py
Expand Up @@ -73,7 +73,7 @@ def __init__(self):
self.searchBox.setPlaceholderText(self.tr('Search...'))

self.fillTree()

def textChanged(self):
text = self.searchBox.text().strip(' ').lower()
self._filterItem(self.algorithmTree.invisibleRootItem(), text)
Expand All @@ -82,24 +82,24 @@ def textChanged(self):
else:
self.algorithmTree.collapseAll()
self.algorithmTree.invisibleRootItem().child(0).setExpanded(True)
def _filterItem(self, item, text):

def _filterItem(self, item, text):
if (item.childCount() > 0):
show = False
for i in xrange(item.childCount()):
for i in xrange(item.childCount()):
child = item.child(i)
showChild = self._filterItem(child, text)
show = showChild or show
item.setHidden(not show)
show = showChild or show
item.setHidden(not show)
return show
elif isinstance(item, (TreeAlgorithmItem, TreeActionItem)):
hide = bool(text) and (text not in item.text(0).lower())
item.setHidden(hide)
elif isinstance(item, (TreeAlgorithmItem, TreeActionItem)):
hide = bool(text) and (text not in item.text(0).lower())
item.setHidden(hide)
return not hide
else:
item.setHidden(True)
item.setHidden(True)
return False


def modeHasChanged(self):
idx = self.modeComboBox.currentIndex()
Expand All @@ -116,7 +116,7 @@ def modeHasChanged(self):
def updateTree(self):
Processing.updateAlgsList()
self.fillTree()

def updateProvider(self, providerName, updateAlgsList = True):
if updateAlgsList:
Processing.updateAlgsList()
Expand Down Expand Up @@ -308,9 +308,9 @@ def fillTreeUsingCategories(self):
name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
if not ProcessingConfig.getSetting(name):
continue
providerItem = TreeProviderItem(providerName)
providerItem = TreeProviderItem(providerName)
self.algorithmTree.addTopLevelItem(providerItem)

def fillTreeUsingProviders(self):
self.algorithmTree.clear()
for providerName in Processing.algs.keys():
Expand All @@ -320,7 +320,7 @@ def fillTreeUsingProviders(self):
providerItem = TreeProviderItem(providerName)
self.algorithmTree.addTopLevelItem(providerItem)
providerItem.setHidden(providerItem.childCount() == 0)



class TreeAlgorithmItem(QTreeWidgetItem):
Expand Down Expand Up @@ -348,20 +348,20 @@ def __init__(self, action):
self.action = action
self.setText(0, action.name)
self.setIcon(0, action.getIcon())

class TreeProviderItem(QTreeWidgetItem):

def __init__(self, providerName):
QTreeWidgetItem.__init__(self)
self.providerName = providerName
self.providerName = providerName
self.provider = Processing.getProviderFromName(providerName)
self.setIcon(0, self.provider.getIcon())
self.populate()

def refresh(self):
self.takeChildren()
self.populate()

def populate(self):
groups = {}
count = 0
Expand All @@ -384,21 +384,21 @@ def populate(self):
count += 1

actions = Processing.actions[self.providerName]
for action in actions:
for action in actions:
if action.group in groups:
groupItem = groups[action.group]
else:
groupItem = QTreeWidgetItem()
groupItem.setText(0, action.group)
groups[action.group] = groupItem
algItem = TreeActionItem(action)
groupItem.addChild(algItem)
groupItem.addChild(algItem)

self.setText(0, self.provider.getDescription()
+ ' [' + str(count) + ' geoalgorithms]')
self.setToolTip(0, self.text(0))
for groupItem in groups.values():
self.addChild(groupItem)



2 changes: 1 addition & 1 deletion python/plugins/processing/modeler/CreateNewModelAction.py
Expand Up @@ -43,5 +43,5 @@ def execute(self):
dlg = ModelerDialog()
dlg.show()
dlg.exec_()
if dlg.update:
if dlg.update:
self.toolbox.updateProvider('model')
Expand Up @@ -55,7 +55,7 @@ def execute(self):
fout.write(text)
fout.close()
if filename.replace('\\', '/').startswith(
ScriptUtils.scriptsFolder().replace('\\', '/')):
ScriptUtils.scriptsFolder().replace('\\', '/')):
self.toolbox.updateProvider('script')
except:
QMessageBox.warning(self, self.tr('I/O error'),
Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/otb/OTBAlgorithmProvider.py
Expand Up @@ -63,7 +63,7 @@ def createAlgsList(self):
if descriptionFile.endswith("xml"):
try:
alg = OTBAlgorithm(os.path.join(folder, descriptionFile))

if alg.name.strip() != "":
self.preloadedAlgs.append(alg)
else:
Expand Down
32 changes: 16 additions & 16 deletions python/plugins/processing/otb/OTBSpecific_XMLLoading.py
Expand Up @@ -8,7 +8,7 @@
Copyright : (C) 2013 by CS Systemes d'information (CS SI)
Email : otb at c-s dot fr (CS SI)
Contributors : Julien Malik (CS SI) - creation of otbspecific
Oscar Picas (CS SI) -
Oscar Picas (CS SI) -
Alexia Mondot (CS SI) - split otbspecific into 2 files
add functions
***************************************************************************
Expand Down Expand Up @@ -126,7 +126,7 @@ def adaptLSMSVectorization(commands_list):
if not "." in os.path.basename(commands_list[index + 1] ):
commands_list[index + 1] = commands_list[index + 1][:-1] + ".shp" + commands_list[index + 1][-1]
commands_list2.append(item)

return commands_list2

def adaptComputeImagesStatistics(commands_list):
Expand All @@ -143,7 +143,7 @@ def adaptComputeImagesStatistics(commands_list):
index = commands_list.index(item)
if not "." in os.path.basename(commands_list[index + 1] ):
commands_list[index + 1] = commands_list[index + 1][:-1] + ".xml" + commands_list[index + 1][-1]

return commands_list2


Expand All @@ -162,7 +162,7 @@ def adaptKmzExport(commands_list):
index = commands_list.index(item)
if not "." in os.path.basename(commands_list[index + 1] ):
commands_list[index + 1] = commands_list[index + 1][:-1] + ".kmz" + commands_list[index + 1][-1]

commands_list2.append(item)
return commands_list2

Expand Down Expand Up @@ -207,27 +207,27 @@ def adaptComputeConfusionMatrix(commands_list):
index = commands_list.index(item)
if not "." in os.path.basename(commands_list[index + 1] ):
commands_list[index + 1] = commands_list[index + 1][:-1] + ".csv" + commands_list[index + 1][-1]

commands_list2.append(item)
return commands_list2


def adaptRadiometricIndices(commands_list):
"""
Replace indice nickname by its corresponding entry in the following dictionnary :
indices = {"ndvi" : "Vegetation:NDVI", "tndvi" : "Vegetation:TNDVI", "rvi" : "Vegetation:RVI", "savi" : "Vegetation:SAVI",
"tsavi" : "Vegetation:TSAVI", "msavi" : "Vegetation:MSAVI", "msavi2" : "Vegetation:MSAVI2", "gemi" : "Vegetation:GEMI",
"ipvi" : "Vegetation:IPVI",
"ndwi" : "Water:NDWI", "ndwi2" : "Water:NDWI2", "mndwi" :"Water:MNDWI" , "ndpi" : "Water:NDPI",
"ndti" : "Water:NDTI",
indices = {"ndvi" : "Vegetation:NDVI", "tndvi" : "Vegetation:TNDVI", "rvi" : "Vegetation:RVI", "savi" : "Vegetation:SAVI",
"tsavi" : "Vegetation:TSAVI", "msavi" : "Vegetation:MSAVI", "msavi2" : "Vegetation:MSAVI2", "gemi" : "Vegetation:GEMI",
"ipvi" : "Vegetation:IPVI",
"ndwi" : "Water:NDWI", "ndwi2" : "Water:NDWI2", "mndwi" :"Water:MNDWI" , "ndpi" : "Water:NDPI",
"ndti" : "Water:NDTI",
"ri" : "Soil:RI", "ci" : "Soil:CI", "bi" : "Soil:BI", "bi2" : "Soil:BI2"}
"""
# "laindvilog" : , "lairefl" : , "laindviformo" : ,
indices = {"ndvi" : "Vegetation:NDVI", "tndvi" : "Vegetation:TNDVI", "rvi" : "Vegetation:RVI", "savi" : "Vegetation:SAVI",
"tsavi" : "Vegetation:TSAVI", "msavi" : "Vegetation:MSAVI", "msavi2" : "Vegetation:MSAVI2", "gemi" : "Vegetation:GEMI",
"ipvi" : "Vegetation:IPVI",
"ndwi" : "Water:NDWI", "ndwi2" : "Water:NDWI2", "mndwi" :"Water:MNDWI" , "ndpi" : "Water:NDPI",
"ndti" : "Water:NDTI",
# "laindvilog" : , "lairefl" : , "laindviformo" : ,
indices = {"ndvi" : "Vegetation:NDVI", "tndvi" : "Vegetation:TNDVI", "rvi" : "Vegetation:RVI", "savi" : "Vegetation:SAVI",
"tsavi" : "Vegetation:TSAVI", "msavi" : "Vegetation:MSAVI", "msavi2" : "Vegetation:MSAVI2", "gemi" : "Vegetation:GEMI",
"ipvi" : "Vegetation:IPVI",
"ndwi" : "Water:NDWI", "ndwi2" : "Water:NDWI2", "mndwi" :"Water:MNDWI" , "ndpi" : "Water:NDPI",
"ndti" : "Water:NDTI",
"ri" : "Soil:RI", "ci" : "Soil:CI", "bi" : "Soil:BI", "bi2" : "Soil:BI2"}
for item in commands_list:
if item in indices:
Expand Down

0 comments on commit a7b5a8a

Please sign in to comment.