home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.4)
-
- import os
- import subprocess
- KNOWN_VIEWERS = [
- '/usr/bin/yelp']
-
- class HelpViewer:
-
- def __init__(self, docu):
- self.command = []
- self.docu = docu
- for viewer in KNOWN_VIEWERS:
- if os.path.exists(viewer):
- self.command = [
- viewer,
- 'ghelp:%s' % docu]
- break
- continue
-
-
-
- def check(self):
- '''check if a viewer is available'''
- if self.command == []:
- return False
- else:
- return True
-
-
- def run(self):
- '''open the documentation in the viewer'''
- if os.getuid() == 0 and os.environ.has_key('SUDO_USER'):
- self.command = [
- 'sudo',
- '-u',
- os.environ['SUDO_USER']] + self.command
-
- subprocess.Popen(self.command)
-
-
-