utils_fixes.diff

Chris Crook, 2010-03-17 03:29 PM

Download (1.41 KB)

View differences:

utils.py (working copy)
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 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):
......
239 241
  loadPlugin(packageName)
240 242
  startPlugin(packageName)
241 243

  
244
def showPluginHelp(packageName=None,filename="index",section=""):
245
  try:
246
    source = ""
247
    if packageName is None:
248
       import inspect
249
       source = inspect.currentframe().f_back.f_code.co_filename
250
    else:
251
       source = sys.modules[packageName].__file__
252
  except:
253
    return
254
  path = os.path.dirname(source)
255
  locale = str(QLocale().name()).split("_")[0]
256
  helpfile = os.path.join(path,filename+"-"+locale+".html")
257
  if not os.path.exists(helpfile):
258
    helpfile = os.path.join(path,filename+".html")
259
  print helpfile
260
  if os.path.exists(helpfile):
261
    url = "file://"+helpfile
262
    if section != "":
263
        url = url + "#" + section
264
    iface.openURL(url,False)
242 265

  
243 266
#######################
244 267
# IMPORT wrapper