Skip to content


Browse files Browse the repository at this point in the history
[Processing] Use local GRASS7 help files if they exist. Fixes #7745
  • Loading branch information
Médéric RIBREUX committed Mar 6, 2016
1 parent 2eb8243 commit ce69d21
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion python/plugins/processing/algs/grass7/
Expand Up @@ -30,7 +30,7 @@
import uuid
import importlib

from PyQt4.QtCore import QCoreApplication
from PyQt4.QtCore import QCoreApplication, QUrl
from PyQt4.QtGui import QIcon

from qgis.core import QgsRasterLayer
Expand Down Expand Up @@ -101,6 +101,33 @@ def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def help(self):
localDoc = None
html = self.grass7Name + '.html'
if system.isWindows():
# For MS-Windows, use the configured GRASS7 path
localPath = os.path.join(Grass7Utils.grassPath(), 'docs/html', html)
if os.path.exists(localPath):
localDoc = os.path.abspath(localPath)
elif system.isMac():
# For MacOSX official package
localPath = os.path.join('/Applications/', html)
if os.path.exists(localPath):
localDoc = os.path.abspath(localPath)
# For GNU/Linux distributions
searchPaths = ['/usr/share/doc/grass-doc/html', '/opt/grass/docs/html',
for path in searchPaths:
localPath = os.path.join(path, html)
if os.path.exists(localPath):
localDoc = os.path.abspath(localPath)

# Found the local documentation
if localDoc:
localDoc = QUrl.fromLocalFile(localDoc).toString()
return False, localDoc

# Return the URL if local doc is not found
return False, '' + self.grass7Name + '.html'

def getParameterDescriptions(self):
Expand Down

0 comments on commit ce69d21

Please sign in to comment.