home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / python2.4 / site-packages / UpdateManager / Common / HelpViewer.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2006-08-31  |  1.2 KB  |  43 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.4)
  3.  
  4. import os
  5. import subprocess
  6. KNOWN_VIEWERS = [
  7.     '/usr/bin/yelp']
  8.  
  9. class HelpViewer:
  10.     
  11.     def __init__(self, docu):
  12.         self.command = []
  13.         self.docu = docu
  14.         for viewer in KNOWN_VIEWERS:
  15.             if os.path.exists(viewer):
  16.                 self.command = [
  17.                     viewer,
  18.                     'ghelp:%s' % docu]
  19.                 break
  20.                 continue
  21.         
  22.  
  23.     
  24.     def check(self):
  25.         '''check if a viewer is available'''
  26.         if self.command == []:
  27.             return False
  28.         else:
  29.             return True
  30.  
  31.     
  32.     def run(self):
  33.         '''open the documentation in the viewer'''
  34.         if os.getuid() == 0 and os.environ.has_key('SUDO_USER'):
  35.             self.command = [
  36.                 'sudo',
  37.                 '-u',
  38.                 os.environ['SUDO_USER']] + self.command
  39.         
  40.         subprocess.Popen(self.command)
  41.  
  42.  
  43.