home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / system-config-printer / troubleshoot / ErrorLogParse.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  1.6 KB  |  41 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. from base import *
  5.  
  6. class ErrorLogParse(Question):
  7.     
  8.     def __init__(self, troubleshooter):
  9.         Question.__init__(self, troubleshooter, 'Error log parse')
  10.         page = self.initial_vbox(_('Error log messages'), _('There are messages in the error log.'))
  11.         sw = gtk.ScrolledWindow()
  12.         textview = gtk.TextView()
  13.         textview.set_editable(False)
  14.         sw.add(textview)
  15.         page.pack_start(sw)
  16.         self.buffer = textview.get_buffer()
  17.         troubleshooter.new_page(page, self)
  18.  
  19.     
  20.     def display(self):
  21.         answers = self.troubleshooter.answers
  22.         
  23.         try:
  24.             error_log = answers['error_log']
  25.         except KeyError:
  26.             return False
  27.  
  28.         display = False
  29.         for line in error_log:
  30.             if line[0] == 'E':
  31.                 display = True
  32.                 break
  33.                 continue
  34.         
  35.         if display:
  36.             self.buffer.set_text(reduce((lambda x, y: x + '\n' + y), error_log))
  37.         
  38.         return display
  39.  
  40.  
  41.