Change the help shortcut to open online documentation hosted at readthedocs.org,

as it is not clear how to package the documentation in a way that satisfies debian rules.
This commit is contained in:
Stephen Boddy 2016-10-27 06:25:20 +02:00
parent ba6eccc19d
commit e778c1423c
2 changed files with 8 additions and 14 deletions

View File

@ -1894,7 +1894,7 @@ class Terminal(gtk.VBox):
def key_help(self): def key_help(self):
manual_index_page = manual_lookup() manual_index_page = manual_lookup()
if manual_index_page: if manual_index_page:
self.open_url('file://%s' % (manual_index_page)) self.open_url(manual_index_page)
# End key events # End key events

View File

@ -86,23 +86,17 @@ def has_ancestor(widget, wtype):
def manual_lookup(): def manual_lookup():
'''Choose the manual to open based on LANGUAGE''' '''Choose the manual to open based on LANGUAGE'''
prefix = os.path.join(os.sep, 'usr', 'share', 'doc', 'terminator') available_languages = ['en']
base_url = 'http://terminator-gtk2.readthedocs.io/%s/latest/'
target = 'en' # default to English
if 'LANGUAGE' in os.environ: if 'LANGUAGE' in os.environ:
languages = os.environ['LANGUAGE'].split(':') languages = os.environ['LANGUAGE'].split(':')
for language in languages: for language in languages:
full_path = os.path.join(prefix, 'html_%s' % (language), 'index.html') if language in available_languages:
if os.path.isfile(full_path): target = language
dbg('Found %s manual' % (language)) break
return full_path
dbg('Couldn\'t find manual for %s language' % (language))
full_path = os.path.join(prefix, 'html', 'index.html') return base_url % target
if os.path.isfile(full_path):
dbg('Falling back to the default manual')
return full_path
else:
dbg('I can\'t find any suitable manual')
return None
def path_lookup(command): def path_lookup(command):
'''Find a command in our path''' '''Find a command in our path'''