Skip to content
Permalink
Browse files

new utils.showPluginHelp() method - patch #2562 by ccrook applied

git-svn-id: http://svn.osgeo.org/qgis/trunk@13097 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty
borysiasty committed Mar 20, 2010
1 parent 8a64f99 commit 515393ea812ab68df40932f58301ec3dd2fcc7a1
Showing with 26 additions and 2 deletions.
  1. +26 −2 python/utils.py
@@ -4,7 +4,7 @@
"""

from PyQt4.QtCore import QCoreApplication
from PyQt4.QtCore import QCoreApplication,QLocale
from qgis.core import QGis
import sys
import traceback
@@ -176,7 +176,9 @@ def canUninstallPlugin(packageName):
return True
return bool(metadata.canBeUninstalled())
except:
return False
msg = "Error calling "+packageName+".canBeUninstalled"
showException(sys.exc_type, sys.exc_value, sys.exc_traceback, msg)
return True


def unloadPlugin(packageName):
@@ -240,6 +242,28 @@ def reloadPlugin(packageName):
startPlugin(packageName)


def showPluginHelp(packageName=None,filename="index",section=""):
try:
source = ""
if packageName is None:
import inspect
source = inspect.currentframe().f_back.f_code.co_filename
else:
source = sys.modules[packageName].__file__
except:
return
path = os.path.dirname(source)
locale = str(QLocale().name()).split("_")[0]
helpfile = os.path.join(path,filename+"-"+locale+".html")
if not os.path.exists(helpfile):
helpfile = os.path.join(path,filename+".html")
if os.path.exists(helpfile):
url = "file://"+helpfile
if section != "":
url = url + "#" + section
iface.openURL(url,False)


#######################
# IMPORT wrapper

0 comments on commit 515393e

Please sign in to comment.
You can’t perform that action at this time.