@@ -106,34 +106,14 @@ def getIcon(self):
106106 return self ._icon
107107
108108 def help (self ):
109- localDoc = None
110- html = self .grass7Name + '.html'
111- if system .isWindows ():
112- # For MS-Windows, use the configured GRASS7 path
113- localPath = os .path .join (Grass7Utils .grassPath (), 'docs/html' , html )
114- if os .path .exists (localPath ):
115- localDoc = os .path .abspath (localPath )
116- elif system .isMac ():
117- # For MacOSX official package
118- localPath = os .path .join ('/Applications/GRASS-7.0.app/Contents/MacOS/docs/html' , html )
119- if os .path .exists (localPath ):
120- localDoc = os .path .abspath (localPath )
109+ helpPath = Grass7Utils .grassHelpPath ()
110+ if helpPath == '' :
111+ return False , None
112+
113+ if os .path .exists (helpPath ):
114+ return False , QUrl .fromLocalFile (os .path .join (helpPath , '{}.html' .format (self .grass7Name ))).toString ()
121115 else :
122- # For GNU/Linux distributions
123- searchPaths = ['/usr/share/doc/grass-doc/html' , '/opt/grass/docs/html' ,
124- '/usr/share/doc/grass/docs/html' ]
125- for path in searchPaths :
126- localPath = os .path .join (path , html )
127- if os .path .exists (localPath ):
128- localDoc = os .path .abspath (localPath )
129-
130- # Found the local documentation
131- if localDoc :
132- localDoc = QUrl .fromLocalFile (localDoc ).toString ()
133- return False , localDoc
134-
135- # Return the URL if local doc is not found
136- return False , 'http://grass.osgeo.org/grass70/manuals/' + self .grass7Name + '.html'
116+ return False , helpPath + '{}.html' .format (self .grass7Name )
137117
138118 def getParameterDescriptions (self ):
139119 descs = {}
0 commit comments