|
4 | 4 |
|
5 | 5 | """
|
6 | 6 |
|
7 |
| -from PyQt4.QtCore import QCoreApplication |
| 7 | +from PyQt4.QtCore import QCoreApplication,QLocale |
8 | 8 | from qgis.core import QGis
|
9 | 9 | import sys
|
10 | 10 | import traceback
|
@@ -176,7 +176,9 @@ def canUninstallPlugin(packageName):
|
176 | 176 | return True
|
177 | 177 | return bool(metadata.canBeUninstalled())
|
178 | 178 | except:
|
179 |
| - return False |
| 179 | + msg = "Error calling "+packageName+".canBeUninstalled" |
| 180 | + showException(sys.exc_type, sys.exc_value, sys.exc_traceback, msg) |
| 181 | + return True |
180 | 182 |
|
181 | 183 |
|
182 | 184 | def unloadPlugin(packageName):
|
@@ -240,6 +242,28 @@ def reloadPlugin(packageName):
|
240 | 242 | startPlugin(packageName)
|
241 | 243 |
|
242 | 244 |
|
| 245 | +def showPluginHelp(packageName=None,filename="index",section=""): |
| 246 | + try: |
| 247 | + source = "" |
| 248 | + if packageName is None: |
| 249 | + import inspect |
| 250 | + source = inspect.currentframe().f_back.f_code.co_filename |
| 251 | + else: |
| 252 | + source = sys.modules[packageName].__file__ |
| 253 | + except: |
| 254 | + return |
| 255 | + path = os.path.dirname(source) |
| 256 | + locale = str(QLocale().name()).split("_")[0] |
| 257 | + helpfile = os.path.join(path,filename+"-"+locale+".html") |
| 258 | + if not os.path.exists(helpfile): |
| 259 | + helpfile = os.path.join(path,filename+".html") |
| 260 | + if os.path.exists(helpfile): |
| 261 | + url = "file://"+helpfile |
| 262 | + if section != "": |
| 263 | + url = url + "#" + section |
| 264 | + iface.openURL(url,False) |
| 265 | + |
| 266 | + |
243 | 267 | #######################
|
244 | 268 | # IMPORT wrapper
|
245 | 269 |
|
|
0 commit comments