Skip to content

Commit 9798c92

Browse files
committed
MetaSearch: fix help link
1 parent 3fa6f91 commit 9798c92

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

python/plugins/MetaSearch/plugin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from PyQt4.QtGui import QAction, QIcon
3030

3131
from MetaSearch.dialogs.maindialog import MetaSearchDialog
32-
from MetaSearch.util import StaticContext, open_url
32+
from MetaSearch.util import get_help_url, open_url, StaticContext
3333

3434
LOGGER = logging.getLogger('MetaSearch')
3535

@@ -94,4 +94,4 @@ def run(self):
9494
def help(self):
9595
"""open help in user's default web browser"""
9696

97-
open_url(self.context.metadata.get('general', 'homepage'))
97+
open_url(get_help_url())

python/plugins/MetaSearch/util.py

+16
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@
3636
from pygments import highlight
3737
from pygments.lexers import XmlLexer
3838
from pygments.formatters import HtmlFormatter
39+
from PyQt4.QtCore import QSettings
3940
from PyQt4.QtGui import QMessageBox
4041
from PyQt4.uic import loadUiType
4142

43+
from qgis.core import QGis
44+
45+
4246
LOGGER = logging.getLogger('MetaSearch')
4347

4448

@@ -121,6 +125,18 @@ def highlight_xml(context, xml):
121125
return template.render(css=css, body=body)
122126

123127

128+
def get_help_url():
129+
"""return QGIS MetaSearch help documentation link"""
130+
131+
locale_name = QSettings().value('locale/userLocale')[0:2]
132+
version = QGis.QGIS_VERSION[:3]
133+
134+
path = '%s/%s/docs/user_manual/plugins/plugins_metasearch.html' % \
135+
(version, locale_name)
136+
137+
return '/'.join(['http://docs.qgis.org', path])
138+
139+
124140
def open_url(url):
125141
"""open URL in web browser"""
126142

0 commit comments

Comments
 (0)