Allow users to open the local gdal documentation by clicking on the Help button, to fix #3040

git-svn-id: http://svn.osgeo.org/qgis/trunk@14544 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
brushtyler 2010-11-11 15:33:29 +00:00
parent 360674442e
commit 404d0aee46
4 changed files with 27 additions and 2 deletions

View File

@ -22,7 +22,7 @@ def name():
def description():
return "Integrate gdal tools into qgis"
def version():
return "Version 1.2.16"
return "Version 1.2.17"
def qgisMinimumVersion():
return "1.0"
def classFactory(iface):

View File

@ -54,6 +54,16 @@ def setGdalPath( path ):
settings = QSettings()
settings.setValue( "/GdalTools/gdalPath", QVariant( path ) )
# Retrieves GDAL help files location
def getHelpPath():
settings = QSettings()
return settings.value( "/GdalTools/helpPath", QVariant( "" ) ).toString()
# Stores GDAL help files location
def setHelpPath( path ):
settings = QSettings()
settings.setValue( "/GdalTools/helpPath", QVariant( path ) )
# Retrieves last used encoding from persistent settings
def getLastUsedEncoding():
settings = QSettings()

View File

@ -81,7 +81,11 @@ class GdalToolsBaseDialog(QDialog, Ui_Dialog):
# show the online tool documentation in the default browser
def onHelp(self):
url = QUrl("http://www.gdal.org/" + self.helpFileName)
helpPath = Utils.getHelpPath()
if helpPath.isEmpty():
url = QUrl("http://www.gdal.org/" + self.helpFileName)
else:
url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName)
QDesktopServices.openUrl(url)
def setCommandViewerEnabled(self, enable):

View File

@ -15,8 +15,10 @@ class GdalToolsSettingsDialog( QDialog, Ui_Dialog ):
self.setupUi( self )
self.leGdalBinPath.setText( Utils.getGdalPath() )
self.leGdalHelpPath.setText( Utils.getHelpPath() )
QObject.connect( self.btnSetBinPath, SIGNAL( "clicked()" ), self.setBinPath )
QObject.connect( self.btnSetHelpPath, SIGNAL( "clicked()" ), self.setHelpPath )
def setBinPath( self ):
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select directory with GDAL executables" ) )
@ -25,6 +27,15 @@ class GdalToolsSettingsDialog( QDialog, Ui_Dialog ):
self.leGdalBinPath.setText( inputDir )
def setHelpPath( self ):
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select directory with the GDAL documentation" ) )
if inputDir.isEmpty():
return
self.leGdalHelpPath.setText( inputDir )
def accept( self ):
Utils.setGdalPath( self.leGdalBinPath.text() )
Utils.setHelpPath( self.leGdalHelpPath.text() )
QDialog.accept( self )