Back to index

system-config-printer  1.3.9+20120706
QueueRejectingJobs.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 base import *
00024 class QueueRejectingJobs(Question):
00025     def __init__ (self, troubleshooter):
00026         Question.__init__ (self, troubleshooter, "Queue rejecting jobs?")
00027         solution = gtk.VBox ()
00028         solution.set_border_width (12)
00029         solution.set_spacing (12)
00030         label = gtk.Label ('<span weight="bold" size="larger">' +
00031                            _("Queue Rejecting Jobs") + '</span>')
00032         label.set_alignment (0, 0)
00033         label.set_use_markup (True)
00034         solution.pack_start (label, False, False, 0)
00035         self.label = gtk.Label ()
00036         self.label.set_alignment (0, 0)
00037         self.label.set_line_wrap (True)
00038         solution.pack_start (self.label, False, False, 0)
00039         solution.set_border_width (12)
00040 
00041         troubleshooter.new_page (solution, self)
00042 
00043     def display (self):
00044         answers = self.troubleshooter.answers
00045         if not answers['cups_queue_listed']:
00046             return False
00047 
00048         if answers['is_cups_class']:
00049             queue = answers['cups_class_dict']
00050         else:
00051             queue = answers['cups_printer_dict']
00052 
00053         rejecting = queue['printer-type'] & cups.CUPS_PRINTER_REJECTING
00054         if not rejecting:
00055             return False
00056 
00057         if answers['cups_printer_remote']:
00058             attrs = answers['remote_cups_queue_attributes']
00059             reason = attrs['printer-state-message']
00060         else:
00061             reason = queue['printer-state-message']
00062 
00063         text = (_("The queue '%s' is rejecting jobs.") % answers['cups_queue'])
00064 
00065         if reason:
00066             text += ' ' + _("The reason given is: '%s'.") % reason
00067 
00068         if not answers['cups_printer_remote']:
00069             text += "\n\n"
00070             text += _("To make the queue accept jobs, select the "
00071                       "'Accepting Jobs' checkbox in the 'Policies' "
00072                       "tab for the printer in the printer administration "
00073                       "tool.") + ' ' + _(TEXT_start_print_admin_tool)
00074 
00075         self.label.set_text (text)
00076         return True
00077 
00078     def can_click_forward (self):
00079         return False