Skip to content
Permalink
Browse files
GdalTools: use int to compare versions (fixes #8323)
  • Loading branch information
jef-n committed Jul 19, 2013
1 parent 51074d7 commit e9e1530b160cb7f6f8f4e12c2e110853fff97c8d
@@ -52,10 +52,10 @@ def __init__(self, iface):
(self.inSelector, SIGNAL("filenameChanged()")),
(self.outSelector, SIGNAL("filenameChanged()")),
(self.resolutionComboBox, SIGNAL("currentIndexChanged(int)"), self.resolutionCheck),
(self.srcNoDataSpin, SIGNAL("valueChanged(int)"), self.srcNoDataCheck, "1.7.0"),
(self.srcNoDataSpin, SIGNAL("valueChanged(int)"), self.srcNoDataCheck, 1700),
(self.inputDirCheck, SIGNAL("stateChanged(int)")),
(self.separateCheck, SIGNAL("stateChanged(int)"), None, "1.7.0"),
(self.allowProjDiffCheck, SIGNAL("stateChanged(int)"), None, "1.7.0"),
(self.separateCheck, SIGNAL("stateChanged(int)"), None, 1700),
(self.allowProjDiffCheck, SIGNAL("stateChanged(int)"), None, 1700),
(self.recurseCheck, SIGNAL("stateChanged(int)"), self.inputDirCheck),
(self.inputSelLayersCheck, SIGNAL("stateChanged(int)"))
]
@@ -50,8 +50,8 @@ def __init__(self, iface):
[
(self.inSelector, SIGNAL("filenameChanged()") ),
(self.outSelector, SIGNAL("filenameChanged()") ),
(self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck, "1.7.0"),
(self.maskSelector, SIGNAL("filenameChanged()"), self.maskModeRadio, "1.6.0"),
(self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck, 1700),
(self.maskSelector, SIGNAL("filenameChanged()"), self.maskModeRadio, 1600),
(self.alphaBandCheck, SIGNAL( "stateChanged( int )") ),
(self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentModeRadio),
(self.modeStackedWidget, SIGNAL("currentIndexChanged(int)"))
@@ -168,7 +168,7 @@ def getArgsModeMask(self):
arguments.append("-q")
arguments.append("-cutline")
arguments.append(mask)
if Utils.GdalConfig.version() >= "1.8.0":
if Utils.GdalConfig.versionNum() >= 1800:
arguments.append("-crop_to_cutline")
if self.alphaBandCheck.isChecked():
arguments.append("-dstalpha")
@@ -41,8 +41,8 @@ def __init__(self, iface):
self.setupUi(self)
BasePluginWidget.__init__(self, self.iface, "gdal_contour")

gdalVersion = Utils.GdalConfig.version()
self.useDirAsOutput = gdalVersion < "1.7.0"
gdalVersion = Utils.GdalConfig.versionNum()
self.useDirAsOutput = gdalVersion < 1700
if self.useDirAsOutput:
self.label_2.setText( QApplication.translate("GdalToolsWidget", "&Output directory for contour lines (shapefile)") )

@@ -93,8 +93,8 @@ def fillOutputFileEdit(self):
lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter()

# rasterize supports output file creation for GDAL 1.8
gdalVersion = Utils.GdalConfig.version()
if gdalVersion >= "1.8.0":
gdalVersion = Utils.GdalConfig.versionNum()
if gdalVersion >= 1800:
fileDialogFunc = Utils.FileDialog.getSaveFileName
else:
fileDialogFunc = Utils.FileDialog.getOpenFileName
@@ -107,7 +107,7 @@ def fillOutputFileEdit(self):
self.outSelector.setFilename(outputFile)

# required either -ts or -tr to create the output file
if gdalVersion >= "1.8.0":
if gdalVersion >= 1800:
if not QFileInfo(outputFile).exists():
QMessageBox.information( self, self.tr( "Output size or resolution required" ), self.tr( "The output file doesn't exist. You must set up the output size or resolution to create it." ) )
self.radioSetSize.setChecked(True)
@@ -52,8 +52,8 @@ def __init__( self, iface ):
#( self.recurseCheck, SIGNAL( "stateChanged( int )" ),
( self.outSelector, SIGNAL( "filenameChanged()" ) ),
( self.indexFieldEdit, SIGNAL( "textChanged( const QString & )" ), self.indexFieldCheck),
( self.absolutePathCheck, SIGNAL( "stateChanged( int )" ), None, "1.5.0" ),
( self.skipDifferentProjCheck, SIGNAL( "stateChanged( int )" ), None, "1.5.0" )
( self.absolutePathCheck, SIGNAL( "stateChanged( int )" ), None, 1500 ),
( self.skipDifferentProjCheck, SIGNAL( "stateChanged( int )" ), None, 1500 )
]
)

@@ -56,7 +56,7 @@ def __init__(self, iface):
self.formatLabel.hide()
self.formatCombo.hide()

if Utils.Version( Utils.GdalConfig.version() ) < "1.7":
if Utils.GdalConfig.versionNum() < 1700:
index = self.expandCombo.findText('gray', Qt.MatchFixedString)
if index >= 0:
self.expandCombo.removeItem(index)
@@ -67,7 +67,7 @@ def __init__(self, iface):
( [self.widthSpin, self.heightSpin], SIGNAL( "valueChanged(int)" ), self.resizeGroupBox ),
(self.multithreadCheck, SIGNAL("stateChanged(int)")),
(self.noDataEdit, SIGNAL( "textChanged( const QString & )" ), self.noDataCheck),
(self.maskSelector, SIGNAL("filenameChanged()"), self.maskCheck, "1.6.0"),
(self.maskSelector, SIGNAL("filenameChanged()"), self.maskCheck, 1600),
]
)

0 comments on commit e9e1530

Please sign in to comment.