[QGIS Commit] r14544 - in trunk/qgis/python/plugins/GdalTools: . tools

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Nov 11 10:33:29 EST 2010


Author: brushtyler
Date: 2010-11-11 07:33:29 -0800 (Thu, 11 Nov 2010)
New Revision: 14544

Modified:
   trunk/qgis/python/plugins/GdalTools/__init__.py
   trunk/qgis/python/plugins/GdalTools/tools/GdalTools_utils.py
   trunk/qgis/python/plugins/GdalTools/tools/dialogBase.py
   trunk/qgis/python/plugins/GdalTools/tools/doSettings.py
Log:
Allow users to open the local gdal documentation by clicking on the Help button, to fix #3040


Modified: trunk/qgis/python/plugins/GdalTools/__init__.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/__init__.py	2010-11-11 11:23:50 UTC (rev 14543)
+++ trunk/qgis/python/plugins/GdalTools/__init__.py	2010-11-11 15:33:29 UTC (rev 14544)
@@ -22,7 +22,7 @@
 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): 

Modified: trunk/qgis/python/plugins/GdalTools/tools/GdalTools_utils.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/tools/GdalTools_utils.py	2010-11-11 11:23:50 UTC (rev 14543)
+++ trunk/qgis/python/plugins/GdalTools/tools/GdalTools_utils.py	2010-11-11 15:33:29 UTC (rev 14544)
@@ -54,6 +54,16 @@
   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()

Modified: trunk/qgis/python/plugins/GdalTools/tools/dialogBase.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/tools/dialogBase.py	2010-11-11 11:23:50 UTC (rev 14543)
+++ trunk/qgis/python/plugins/GdalTools/tools/dialogBase.py	2010-11-11 15:33:29 UTC (rev 14544)
@@ -81,7 +81,11 @@
 
   # 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):

Modified: trunk/qgis/python/plugins/GdalTools/tools/doSettings.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/tools/doSettings.py	2010-11-11 11:23:50 UTC (rev 14543)
+++ trunk/qgis/python/plugins/GdalTools/tools/doSettings.py	2010-11-11 15:33:29 UTC (rev 14544)
@@ -15,8 +15,10 @@
     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 @@
 
     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 )



More information about the QGIS-commit mailing list