Skip to content
Permalink
Browse files

Som fTools fixes for SIP API updates

  • Loading branch information
ccrook authored and m-kuhn committed Jun 15, 2013
1 parent e27fe3b commit d41655507994a65ac100423db6670969eb1b8033
@@ -85,13 +85,8 @@ def accept(self):
else:
inName = self.inShape.currentText()
outPath = self.outShape.text()
outName = ftools_utils.getShapefileName(outPath)

if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".shp"):
outName = outName.left(outName.length() - 4)
self.compute(inName, outPath, self.weightField.currentText(), self.sizeValue.value(), self.uniqueField.currentText())
self.progressBar.setValue(100)
self.outShape.clear()
@@ -128,12 +128,7 @@ def accept(self):
else: matType = "Summary"
if self.chkNearest.isChecked(): nearest = self.spnNearest.value()
else: nearest = 0
if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".csv"):
outName = outName.left(outName.length() - 4)
outName = ftools_utils.getShapefileName(outPath)
self.outFile.clear()
self.compute(point1, point2, field1, field2, outPath, matType, nearest, self.progressBar)
self.progressBar.setValue(100)
@@ -91,12 +91,7 @@ def accept(self):
self.progressBar.setValue(1)
outPath = self.outShape.text()
self.progressBar.setValue(2.5)
if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".shp"):
outName = outName.left(outName.length() - 4)
outName = ftools_utils.getShapefileName( outPath )
self.progressBar.setValue(5)
mLayer = ftools_utils.getMapLayerByName(unicode(inName))
if mLayer.type() == mLayer.VectorLayer:
@@ -69,12 +69,7 @@ def accept(self):
inName = self.inShape.currentText()
outPath = self.outShape.text()
self.outShape.clear()
if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".shp"):
outName = outName.left(outName.length() - 4)
outName = ftools_utils.getShapefileName( outPath )
if self.rdoSpacing.isChecked(): value = self.spnSpacing.value()
else: value = self.spnNumber.value()
if self.chkRandom.isChecked(): offset = True
@@ -95,12 +95,7 @@ def accept(self):
sumList = ["all"]
if self.rdoKeep.isChecked(): keep = True
else: keep = False
if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".shp"):
outName = outName.left(outName.length() - 4)
outName = ftools_utils.getShapefileName( outPath )
res = self.compute(inName, joinName, outPath, summary, sumList, keep, self.progressBar)
self.outShape.clear()
if res:
@@ -70,12 +70,7 @@ def accept(self):
inLns = self.inPoint.currentText()
inField = self.lnField.text()
outPath = self.outShape.text()
if outPath.contains("\\"):
outName = outPath.right((outPath.length() - outPath.lastIndexOf("\\")) - 1)
else:
outName = outPath.right((outPath.length() - outPath.lastIndexOf("/")) - 1)
if outName.endsWith(".shp"):
outName = outName.left(outName.length() - 4)
outName = ftools_utils.getShapefileName( outPath )
self.compute(inPoly, inLns, inField, outPath, self.progressBar)
self.outShape.clear()
addToTOC = QMessageBox.question(self, self.tr("Sum line lengths"), self.tr("Created output shapefile:\n%s\n\nWould you like to add the new layer to the TOC?") % (unicode(outPath)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
@@ -382,3 +382,13 @@ def getShapesByGeometryType( baseDir, inShapes, geomType ):
return None

return outShapes

def getShapefileName( outPath ):
import os.path
outName=os.path.basename(outPath)
if outName.endswith('.shp'):
outName=outName[:-4]
if outName.endswith('.csv'):
outName=outName[:-4]
return outName

0 comments on commit d416555

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