| 1 |
#!/usr/bin/python3 |
| 2 |
|
| 3 |
## Printing troubleshooter |
| 4 |
|
| 5 |
## Copyright (C) 2008, 2009 Red Hat, Inc. |
| 6 |
## Copyright (C) 2008, 2009 Tim Waugh <[email protected]> |
| 7 |
|
| 8 |
## This program is free software; you can redistribute it and/or modify |
| 9 |
## it under the terms of the GNU General Public License as published by |
| 10 |
## the Free Software Foundation; either version 2 of the License, or |
| 11 |
## (at your option) any later version. |
| 12 |
|
| 13 |
## This program is distributed in the hope that it will be useful, |
| 14 |
## but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
## GNU General Public License for more details. |
| 17 |
|
| 18 |
## You should have received a copy of the GNU General Public License |
| 19 |
## along with this program; if not, write to the Free Software |
| 20 |
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 21 |
|
| 22 |
import cups |
| 23 |
from timedops import TimedOperation |
| 24 |
from .base import * |
| 25 |
class SchedulerNotRunning(Question): |
| 26 |
def __init__ (self, troubleshooter): |
| 27 |
Question.__init__ (self, troubleshooter, "Scheduler not running?") |
| 28 |
page = self.initial_vbox (_("CUPS Service Stopped"), |
| 29 |
_("The CUPS print spooler does not appear " |
| 30 |
"to be running. To correct this, choose " |
| 31 |
"System->Administration->Services from " |
| 32 |
"the main menu and look for the 'cups' " |
| 33 |
"service.")) |
| 34 |
troubleshooter.new_page (page, self) |
| 35 |
|
| 36 |
def display (self): |
| 37 |
self.answers = {} |
| 38 |
if self.troubleshooter.answers.get ('cups_queue_listed', False): |
| 39 |
return False |
| 40 |
|
| 41 |
parent = self.troubleshooter.get_window () |
| 42 |
|
| 43 |
# Find out if CUPS is running. |
| 44 |
failure = False |
| 45 |
try: |
| 46 |
self.op = TimedOperation (cups.Connection, |
| 47 |
parent=parent) |
| 48 |
c = self.op.run () |
| 49 |
except RuntimeError: |
| 50 |
failure = True |
| 51 |
|
| 52 |
self.answers['cups_connection_failure'] = failure |
| 53 |
return failure |
| 54 |
|
| 55 |
def can_click_forward (self): |
| 56 |
return False |
| 57 |
|
| 58 |
def collect_answer (self): |
| 59 |
return self.answers |
| 60 |
|
| 61 |
def cancel_operation (self): |
| 62 |
self.op.cancel () |