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

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import cups
  5. from timedops import TimedOperation
  6. from base import *
  7.  
  8. class NetworkCUPSPrinterShared(Question):
  9.     
  10.     def __init__(self, troubleshooter):
  11.         Question.__init__(self, troubleshooter, 'Queue not shared?')
  12.         page = self.initial_vbox(_('Queue Not Shared'), _('The CUPS printer on the server is not shared.'))
  13.         troubleshooter.new_page(page, self)
  14.  
  15.     
  16.     def display(self):
  17.         self.answers = { }
  18.         answers = self.troubleshooter.answers
  19.         if answers.has_key('remote_cups_queue_listed') and answers['remote_cups_queue_listed'] == False:
  20.             return False
  21.         parent = self.troubleshooter.get_window()
  22.         if not answers.has_key('remote_cups_queue_attributes'):
  23.             if not answers.has_key('remote_server_try_connect') and answers.has_key('remote_cups_queue'):
  24.                 return False
  25.             
  26.             try:
  27.                 cups.setServer(answers['remote_server_try_connect'])
  28.                 self.op = TimedOperation(cups.Connection, parent = parent)
  29.                 c = self.op.run()
  30.                 self.op = TimedOperation(c.getPrinterAttributes, args = (answers['remote_cups_queue'],), parent = parent)
  31.                 attr = self.op.run()
  32.             except RuntimeError:
  33.                 answers.has_key('remote_cups_queue')
  34.                 answers.has_key('remote_cups_queue')
  35.                 answers['remote_cups_queue_listed'] == False
  36.                 return False
  37.                 except cups.IPPError:
  38.                     return False
  39.                 else:
  40.                     self.answers['remote_cups_queue_attributes'] = attr
  41.             except:
  42.                 None<EXCEPTION MATCH>cups.IPPError
  43.                 attr = answers['remote_cups_queue_attributes']
  44.                 if attr.has_key('printer-is-shared'):
  45.                     if not attr['printer-is-shared']:
  46.                         return True
  47.                 
  48.  
  49.         return False
  50.  
  51.     
  52.     def can_click_forward(self):
  53.         return False
  54.  
  55.     
  56.     def collect_answer(self):
  57.         return self.answers
  58.  
  59.     
  60.     def cancel_operation(self):
  61.         self.op.cancel()
  62.  
  63.  
  64.