Преглед изворни кода

g.manual: enable to display also manual pages of addons modules

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48551 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 13 година
родитељ
комит
2f1a556577
1 измењених фајлова са 10 додато и 3 уклоњено
  1. 10 3
      scripts/g.manual/g.manual.py

+ 10 - 3
scripts/g.manual/g.manual.py

@@ -15,7 +15,7 @@
 #############################################################################
 
 #%module
-#% description: Display the HTML man pages of GRASS GIS
+#% description: Display the HTML manual pages of GRASS modules
 #% keywords: general
 #% keywords: manual
 #% keywords: help
@@ -45,15 +45,22 @@ def start_browser(entry):
         grass.fatal(_("Browser <%s> not found") % browser)
     
     path = os.path.join(gisbase, 'docs', 'html', entry + '.html')
+    if not os.path.exists(path) and os.getenv('GRASS_ADDON_PATH'):
+        path = os.path.join(os.getenv('GRASS_ADDON_PATH'), 'docs', 'html', entry + '.html')
+    
     if not os.path.exists(path):
-	grass.fatal(_("No HTML manual page entry for <%s>") % entry)
+        grass.fatal(_("No HTML manual page entry for <%s>") % entry)
+    
     grass.verbose(_("Starting browser <%s> for module %s...") % (browser_name, entry))
     
-    os.execlp(browser, browser_name, "file://%s/docs/html/%s.html" % (gisbase, entry))
+    os.execlp(browser, browser_name, "file://%s" % (path))
     grass.fatal(_("Error starting browser <%s> for HTML file <%s>") % (browser, entry))
     
 def start_man(entry):
     path = os.path.join(gisbase, 'man', 'man1', entry + '.1')
+    if not os.path.exists(path) and os.getenv('GRASS_ADDON_PATH'):
+        path = os.path.join(os.getenv('GRASS_ADDON_PATH'), 'man', 'man1', entry + '.1')
+    
     for ext in ['', '.gz', '.bz2']:
 	if os.path.exists(path + ext):
 	    os.execlp('man', 'man', path + ext)