2
# -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*-
7
# Hardcoded list of available help viewers
8
# FIXME: khelpcenter support would be nice
9
#KNOWN_VIEWERS = ["/usr/bin/yelp", "/usr/bin/khelpcenter"]
10
KNOWN_VIEWERS = ["/usr/bin/yelp"]
14
def __init__(self, docu):
17
for viewer in KNOWN_VIEWERS:
18
if os.path.exists(viewer):
19
self.command = [viewer, "help:%s" % docu]
23
"""check if a viewer is available"""
24
if self.command == []:
30
"""open the documentation in the viewer"""
31
# avoid running the help viewer as root
32
if os.getuid() == 0 and 'SUDO_USER' in os.environ:
33
self.command = ['sudo', '-u', os.environ['SUDO_USER']] +\
35
subprocess.Popen(self.command)