Skip to content

Commit b44ebde

Browse files
committed
fix #105 : links to documentation point to the version of larray used by the editor.
1 parent fdef123 commit b44ebde

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

larray_editor/editor.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from larray import LArray, Session, zeros, empty
77
from larray_editor.utils import (PY2, PYQT5, _, create_action, show_figure, ima, commonpath, dependencies,
8-
get_versions, urls)
8+
get_versions, get_documentation_url, urls)
99
from larray_editor.arraywidget import ArrayEditorWidget
1010
from qtpy.QtCore import Qt, QSettings, QUrl, Slot
1111
from qtpy.QtGui import QDesktopServices, QKeySequence
@@ -670,13 +670,13 @@ def load_example(self):
670670
self._open_file(filepath)
671671

672672
def open_documentation(self):
673-
QDesktopServices.openUrl(QUrl(urls['doc_stable']))
673+
QDesktopServices.openUrl(QUrl(get_documentation_url('doc_index')))
674674

675675
def open_tutorial(self):
676-
QDesktopServices.openUrl(QUrl(urls['doc_tutorial']))
676+
QDesktopServices.openUrl(QUrl(get_documentation_url('doc_tutorial')))
677677

678678
def open_api_documentation(self):
679-
QDesktopServices.openUrl(QUrl(urls['doc_api']))
679+
QDesktopServices.openUrl(QUrl(get_documentation_url('doc_api')))
680680

681681
def report_issue(self, package):
682682
def _report_issue(*args, **kwargs):

larray_editor/utils.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@
2525
dependencies = {'editor': editor_dependencies, 'larray': core_dependencies, 'larray_eurostat': eurostat_dependencies}
2626

2727

28+
doc = "http://larray.readthedocs.io/en/{version}"
2829
urls = {"fpb": "http://www.plan.be/index.php?lang=en",
2930
"GPL3": "https://www.gnu.org/licenses/gpl-3.0.html",
30-
"doc_stable": "http://larray.readthedocs.io/en/stable/",
31-
"doc_tutorial": "http://larray.readthedocs.io/en/stable/tutorial.html",
32-
"doc_api": "http://larray.readthedocs.io/en/stable/api.html",
31+
"doc_index": "{}/index.html".format(doc),
32+
"doc_tutorial": "{}/tutorial.html".format(doc),
33+
"doc_api": "{}/api.html".format(doc),
3334
"new_issue_editor": "https://github.com/larray-project/larray-editor/issues/new",
3435
"new_issue_larray": "https://github.com/liam2/larray/issues/new",
3536
"new_issue_larray_eurostat": "https://github.com/larray-project/larray_eurostat/issues/new",
@@ -81,6 +82,13 @@ def get_versions(package):
8182
return versions
8283

8384

85+
def get_documentation_url(key):
86+
version = get_module_version('larray')
87+
if version == 'N/A':
88+
version = 'stable'
89+
return urls[key].format(version=version)
90+
91+
8492
# Note: string and unicode data types will be formatted with '%s' (see below)
8593
SUPPORTED_FORMATS = {
8694
'object': '%s',

0 commit comments

Comments
 (0)