Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
new utils.showPluginHelp() method - patch #2562 by ccrook applied
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13097 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
borysiasty committed Mar 20, 2010
1 parent 1874c21 commit 4f327f1
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions python/utils.py
Expand Up @@ -4,7 +4,7 @@
"""

from PyQt4.QtCore import QCoreApplication
from PyQt4.QtCore import QCoreApplication,QLocale
from qgis.core import QGis
import sys
import traceback
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 4f327f1

Please sign in to comment.