|
30 | 30 | import uuid
|
31 | 31 | import importlib
|
32 | 32 |
|
33 |
| -from PyQt4.QtCore import QCoreApplication |
| 33 | +from PyQt4.QtCore import QCoreApplication, QUrl |
34 | 34 | from PyQt4.QtGui import QIcon
|
35 | 35 |
|
36 | 36 | from qgis.core import QgsRasterLayer
|
@@ -87,6 +87,33 @@ def getIcon(self):
|
87 | 87 | return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))
|
88 | 88 |
|
89 | 89 | def help(self):
|
| 90 | + localDoc = None |
| 91 | + html = self.grass7Name + '.html' |
| 92 | + if system.isWindows(): |
| 93 | + # For MS-Windows, use the configured GRASS7 path |
| 94 | + localPath = os.path.join(Grass7Utils.grassPath(), 'docs/html', html) |
| 95 | + if os.path.exists(localPath): |
| 96 | + localDoc = os.path.abspath(localPath) |
| 97 | + elif system.isMac(): |
| 98 | + # For MacOSX official package |
| 99 | + localPath = os.path.join('/Applications/GRASS-7.0.app/Contents/MacOS/docs/html', html) |
| 100 | + if os.path.exists(localPath): |
| 101 | + localDoc = os.path.abspath(localPath) |
| 102 | + else: |
| 103 | + # For GNU/Linux distributions |
| 104 | + searchPaths = ['/usr/share/doc/grass-doc/html', '/opt/grass/docs/html', |
| 105 | + '/usr/share/doc/grass/docs/html'] |
| 106 | + for path in searchPaths: |
| 107 | + localPath = os.path.join(path, html) |
| 108 | + if os.path.exists(localPath): |
| 109 | + localDoc = os.path.abspath(localPath) |
| 110 | + |
| 111 | + # Found the local documentation |
| 112 | + if localDoc: |
| 113 | + localDoc = QUrl.fromLocalFile(localDoc).toString() |
| 114 | + return False, localDoc |
| 115 | + |
| 116 | + # Return the URL if local doc is not found |
90 | 117 | return False, 'http://grass.osgeo.org/grass70/manuals/' + self.grass7Name + '.html'
|
91 | 118 |
|
92 | 119 | def getParameterDescriptions(self):
|
|
0 commit comments