Skip to content
Permalink
Browse files

[Gdaltools] SIP API update (Fix #8074)

  • Loading branch information
m-kuhn committed Jun 16, 2013
1 parent b96f67b commit f6ae6c48b35a1f858a78f890c050f10b4ef481cf
@@ -146,7 +146,7 @@ def onHelp(self):

# called when a value in the plugin widget interface changed
def refreshArgs(self, args):
self.arguments = args
self.arguments = [unicode(a) for a in args]

if not self.commandIsEnabled():
self.textEditCommand.setPlainText(self.command)
@@ -92,21 +92,21 @@ def fillMaskFileEdit(self):
self.maskSelector.setFilename(maskFile)

def getArguments(self):
arguments = QStringList()
arguments << self.getInputFileName()
arguments = []
arguments.append( self.getInputFileName() )
outputFn = self.getOutputFileName()
maskFn = self.getMaskFileName()
if self.maskCheck.isChecked() and not maskFn.isEmpty():
arguments << "-mask"
arguments << maskFn
arguments.append( "-mask" )
arguments.append( maskFn )
if not outputFn.isEmpty():
arguments << "-f"
arguments << self.outputFormat
arguments << outputFn
arguments.append( "-f" )
arguments.append( self.outputFormat )
arguments.append( outputFn )
if not outputFn.isEmpty():
arguments << QFileInfo( outputFn ).baseName()
arguments.append( QFileInfo( outputFn ).baseName() )
if self.fieldCheck.isChecked() and not self.fieldEdit.text().isEmpty():
arguments << self.fieldEdit.text()
arguments.append( self.fieldEdit.text() )
return arguments

def getOutputFileName(self):
@@ -80,7 +80,7 @@ def fillFieldsCombo(self):
def fillInputFileEdit(self):
lastUsedFilter = Utils.FileFilter.lastUsedVectorFilter()
inputFile, encoding = Utils.FileDialog.getOpenFileName(self, self.tr( "Select the input file for Rasterize" ), Utils.FileFilter.allVectorsFilter(), lastUsedFilter, True)
if inputFile.isEmpty():
if not inputFile:
return
Utils.FileFilter.setLastUsedVectorFilter(lastUsedFilter)

@@ -100,7 +100,7 @@ def fillOutputFileEdit(self):
fileDialogFunc = Utils.FileDialog.getOpenFileName

outputFile = fileDialogFunc(self, self.tr( "Select the raster file to save the results to" ), Utils.FileFilter.allRastersFilter(), lastUsedFilter)
if outputFile.isEmpty():
if not outputFile:
return
Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter)

@@ -113,24 +113,24 @@ def fillOutputFileEdit(self):
self.radioSetSize.setChecked(True)

def getArguments(self):
arguments = QStringList()
arguments = []
if self.attributeComboBox.currentIndex() >= 0:
arguments << "-a"
arguments << self.attributeComboBox.currentText()
arguments.append( "-a" )
arguments.append( self.attributeComboBox.currentText() )
if self.radioSetSize.isChecked():
arguments << "-ts"
arguments << str( self.widthSpin.value() )
arguments << str( self.heightSpin.value() )
arguments.append( "-ts" )
arguments.append( self.widthSpin.value() )
arguments.append( self.heightSpin.value() )
if self.radioSetResolution.isChecked():
arguments << "-tr"
arguments << str( self.horizresSpin.value() )
arguments << str( self.vertresSpin.value() )
arguments.append( "-tr" )
arguments.append( self.horizresSpin.value() )
arguments.append( self.vertresSpin.value() )
inputFn = self.getInputFileName()
if not inputFn.isEmpty():
arguments << "-l"
arguments << QFileInfo( inputFn ).baseName()
arguments << inputFn
arguments << self.getOutputFileName()
if inputFn:
arguments.append( "-l" )
arguments.append( QFileInfo( inputFn ).baseName() )
arguments.append( inputFn )
arguments.append( self.getOutputFileName() )
return arguments

def getInputFileName(self):
@@ -145,7 +145,7 @@ def addLayerIntoCanvas(self, fileInfo):
def loadFields(self, vectorFile):
self.attributeComboBox.clear()

if vectorFile.isEmpty():
if not vectorFile:
return

try:

0 comments on commit f6ae6c4

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