Back to index

system-config-printer  1.3.9+20120706
SchedulerNotRunning.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 
00003 ## Printing troubleshooter
00004 
00005 ## Copyright (C) 2008, 2009 Red Hat, Inc.
00006 ## Copyright (C) 2008, 2009 Tim Waugh <twaugh@redhat.com>
00007 
00008 ## This program is free software; you can redistribute it and/or modify
00009 ## it under the terms of the GNU General Public License as published by
00010 ## the Free Software Foundation; either version 2 of the License, or
00011 ## (at your option) any later version.
00012 
00013 ## This program is distributed in the hope that it will be useful,
00014 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 ## GNU General Public License for more details.
00017 
00018 ## You should have received a copy of the GNU General Public License
00019 ## along with this program; if not, write to the Free Software
00020 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021 
00022 import cups
00023 from timedops import TimedOperation
00024 from base import *
00025 class SchedulerNotRunning(Question):
00026     def __init__ (self, troubleshooter):
00027         Question.__init__ (self, troubleshooter, "Scheduler not running?")
00028         page = self.initial_vbox (_("CUPS Service Stopped"),
00029                                   _("The CUPS print spooler does not appear "
00030                                     "to be running.  To correct this, choose "
00031                                     "System->Administration->Services from "
00032                                     "the main menu and look for the 'cups' "
00033                                     "service."))
00034         troubleshooter.new_page (page, self)
00035 
00036     def display (self):
00037         self.answers = {}
00038         if self.troubleshooter.answers.get ('cups_queue_listed', False):
00039             return False
00040 
00041         parent = self.troubleshooter.get_window ()
00042 
00043         # Find out if CUPS is running.
00044         failure = False
00045         try:
00046             self.op = TimedOperation (cups.Connection,
00047                                       parent=parent)
00048             c = self.op.run ()
00049         except RuntimeError:
00050             failure = True
00051 
00052         self.answers['cups_connection_failure'] = failure
00053         return failure
00054 
00055     def can_click_forward (self):
00056         return False
00057 
00058     def collect_answer (self):
00059         return self.answers
00060 
00061     def cancel_operation (self):
00062         self.op.cancel ()