Skip to content
Permalink
Browse files

Merge pull request #1230 from dakcarto/issue_9704_gdal-qsettings

Fix #9704, GdalTools file dialogs return QPyNullVariant due to QSettings undefined return type
  • Loading branch information
dakcarto committed Mar 10, 2014
2 parents 60e1a9b + 073dbf1 commit 9c139c28fe7d167b16db441a72bcab3c2bc05501
Showing with 10 additions and 10 deletions.
  1. +1 −1 python/plugins/GdalTools/GdalTools.py
  2. +9 −9 python/plugins/GdalTools/tools/GdalTools_utils.py
@@ -76,7 +76,7 @@ def __init__( self, iface ):
if not overrideLocale:
localeFullName = QLocale.system().name()
else:
localeFullName = QSettings().value( "locale/userLocale", "" )
localeFullName = QSettings().value( "locale/userLocale", "", type=str )

if QFileInfo( userPluginPath ).exists():
translationPath = userPluginPath + "/i18n/GdalTools_" + localeFullName + ".qm"
@@ -59,8 +59,8 @@ def escapeAndJoin(strList):
# Retrieves last used dir from persistent settings
def getLastUsedDir():
settings = QSettings()
lastProjectDir = settings.value( "/UI/lastProjectDir", ".", type=str )
return settings.value( "/GdalTools/lastUsedDir", lastProjectDir, type=str )
lastProjectDir = settings.value( "/UI/lastProjectDir", u".", type=unicode )
return settings.value( "/GdalTools/lastUsedDir", lastProjectDir, type=unicode )

# Stores last used dir in persistent settings
def setLastUsedDir(filePath):
@@ -75,7 +75,7 @@ def setLastUsedDir(filePath):
# Retrieves GDAL binaries location
def getGdalBinPath():
settings = QSettings()
return settings.value( "/GdalTools/gdalPath", u"" )
return settings.value( "/GdalTools/gdalPath", u"", type=unicode )

# Stores GDAL binaries location
def setGdalBinPath( path ):
@@ -85,7 +85,7 @@ def setGdalBinPath( path ):
# Retrieves GDAL python modules location
def getGdalPymodPath():
settings = QSettings()
return settings.value( "/GdalTools/gdalPymodPath", u"" )
return settings.value( "/GdalTools/gdalPymodPath", u"", type=unicode )

# Stores GDAL python modules location
def setGdalPymodPath( path ):
@@ -95,7 +95,7 @@ def setGdalPymodPath( path ):
# Retrieves GDAL help files location
def getHelpPath():
settings = QSettings()
return settings.value( "/GdalTools/helpPath", u"" )
return settings.value( "/GdalTools/helpPath", u"", type=unicode )

# Stores GDAL help files location
def setHelpPath( path ):
@@ -105,7 +105,7 @@ def setHelpPath( path ):
# Retrieves last used encoding from persistent settings
def getLastUsedEncoding():
settings = QSettings()
return settings.value( "/UI/encoding", u"System" )
return settings.value( "/UI/encoding", u"System", type=unicode )

# Stores last used encoding in persistent settings
def setLastUsedEncoding(encoding):
@@ -347,7 +347,7 @@ def getDialog(self, parent = None, caption = '', acceptMode = QFileDialog.Accept
dialog.setFileMode(fileMode)
dialog.setAcceptMode(acceptMode)

if selectedFilter != None:
if selectedFilter is not None:
dialog.selectNameFilter(selectedFilter[0])

if not dialog.exec_():
@@ -356,7 +356,7 @@ def getDialog(self, parent = None, caption = '', acceptMode = QFileDialog.Accept
return ''

# change the selected filter value
if selectedFilter != None:
if selectedFilter is not None:
selectedFilter[0] = dialog.selectedNameFilter()

# save the last used dir and return the selected files
@@ -409,7 +409,7 @@ class FileFilter:
@classmethod
def getFilter(self, typeName):
settings = QSettings()
return settings.value( "/GdalTools/" + typeName + "FileFilter", u"" )
return settings.value( "/GdalTools/" + typeName + "FileFilter", u"", type=unicode )

@classmethod
def setFilter(self, typeName, aFilter):

0 comments on commit 9c139c2

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