MetaSearch: fix help link

This commit is contained in:
Tom Kralidis 2015-02-24 18:49:22 -05:00
parent 3fa6f91e1a
commit 9798c92e49
2 changed files with 18 additions and 2 deletions

View File

@ -29,7 +29,7 @@ from PyQt4.QtCore import QCoreApplication
from PyQt4.QtGui import QAction, QIcon
from MetaSearch.dialogs.maindialog import MetaSearchDialog
from MetaSearch.util import StaticContext, open_url
from MetaSearch.util import get_help_url, open_url, StaticContext
LOGGER = logging.getLogger('MetaSearch')
@ -94,4 +94,4 @@ class MetaSearchPlugin(object):
def help(self):
"""open help in user's default web browser"""
open_url(self.context.metadata.get('general', 'homepage'))
open_url(get_help_url())

View File

@ -36,9 +36,13 @@ from jinja2 import Environment, FileSystemLoader
from pygments import highlight
from pygments.lexers import XmlLexer
from pygments.formatters import HtmlFormatter
from PyQt4.QtCore import QSettings
from PyQt4.QtGui import QMessageBox
from PyQt4.uic import loadUiType
from qgis.core import QGis
LOGGER = logging.getLogger('MetaSearch')
@ -121,6 +125,18 @@ def highlight_xml(context, xml):
return template.render(css=css, body=body)
def get_help_url():
"""return QGIS MetaSearch help documentation link"""
locale_name = QSettings().value('locale/userLocale')[0:2]
version = QGis.QGIS_VERSION[:3]
path = '%s/%s/docs/user_manual/plugins/plugins_metasearch.html' % \
(version, locale_name)
return '/'.join(['http://docs.qgis.org', path])
def open_url(url):
"""open URL in web browser"""