Skip to content

Commit

Permalink
Add link to documentation
Browse files Browse the repository at this point in the history
issue11697
review417971003
  • Loading branch information
cedk committed Sep 18, 2022
1 parent 764824c commit f3359a6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tryton/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
error, file_open, file_selection, file_write, filter_domain,
generateColorscheme, get_align, get_hostname, get_port,
get_sensible_widget, get_toplevel_window, hex2rgb, highlight_rgb, humanize,
idle_add, mailto, message, node_attributes, process_exception,
resize_pixbuf, selection, setup_window, slugify, sur, sur_3b,
timezoned_date, to_xml, untimezoned_date, url_open, userwarning, warning)
idle_add, mailto, message, node_attributes, open_documentation,
process_exception, resize_pixbuf, selection, setup_window, slugify, sur,
sur_3b, timezoned_date, to_xml, untimezoned_date, url_open, userwarning,
warning)
from .domain_inversion import (
concat, domain_inversion, eval_domain, extract_reference_models,
filter_leaf, inverse_leaf, localize_domain, merge,
Expand Down Expand Up @@ -68,6 +69,7 @@
merge,
message,
node_attributes,
open_documentation,
prepare_reference_domain,
process_exception,
resize_pixbuf,
Expand Down
12 changes: 12 additions & 0 deletions tryton/common/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,18 @@ def get_method(self):
return False


def open_documentation():
version = __version__.split('.')[:2]
if int(version[-1]) % 2:
version = 'latest'
else:
version = '.'.join([version])
webbrowser.open(CONFIG['doc.url'] % {
'lang': CONFIG['client.lang'],
'version': version,
})


def to_xml(string):
return string.replace('&', '&'
).replace('<', '&lt;').replace('>', '&gt;')
Expand Down
1 change: 1 addition & 0 deletions tryton/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __init__(self):
'graph.color': '#3465a4',
'image.max_size': 10 ** 6,
'image.cache_size': 1024,
'doc.url': 'https://docs.tryton.org/en/%(version)s',
'bug.url': 'https://bugs.tryton.org/',
'download.url': 'https://downloads-cdn.tryton.org/',
'download.frequency': 60 * 60 * 8,
Expand Down
5 changes: 5 additions & 0 deletions tryton/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ def on_change_action_boolean(action, value, key):
action.connect('activate', lambda *a: self.edit_limit())
self.add_action(action)

action = Gio.SimpleAction.new('documentation', None)
action.connect('activate', lambda *a: common.open_documentation())
self.add_action(action)

self._shortcuts = None
action = Gio.SimpleAction.new('shortcuts', None)
action.connect('activate', lambda *a: self.shortcuts())
Expand Down Expand Up @@ -306,6 +310,7 @@ def _get_primary_menu(self):
menu.append_section(_("Options"), section)

section = Gio.Menu.new()
section.append(_("Documentation..."), 'app.documentation')
section.append(_("Keyboard Shortcuts..."), 'app.shortcuts')
section.append(_("About..."), 'app.about')
menu.append_section(_("Help"), section)
Expand Down

0 comments on commit f3359a6

Please sign in to comment.