Back to index

system-config-printer  1.3.9+20120706
QueueNotEnabled.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 QueueNotEnabled(Question):
00025     def __init__ (self, troubleshooter):
00026         Question.__init__ (self, troubleshooter, "Queue not enabled?")
00027         self.label = gtk.Label ()
00028         solution = gtk.VBox ()
00029         self.label.set_line_wrap (True)
00030         self.label.set_alignment (0, 0)
00031         solution.pack_start (self.label, False, False, 0)
00032         solution.set_border_width (12)
00033         troubleshooter.new_page (solution, self)
00034 
00035     def display (self):
00036         answers =  self.troubleshooter.answers
00037         if not answers['cups_queue_listed']:
00038             return False
00039 
00040         if answers['is_cups_class']:
00041             queue = answers['cups_class_dict']
00042         else:
00043             queue = answers['cups_printer_dict']
00044 
00045         enabled = queue['printer-state'] != cups.IPP_PRINTER_STOPPED
00046         if enabled:
00047             return False
00048 
00049         if answers['cups_printer_remote']:
00050             attrs = answers['remote_cups_queue_attributes']
00051             reason = attrs['printer-state-message']
00052         else:
00053             reason = queue['printer-state-message']
00054 
00055         if reason:
00056             reason = _("The reason given is: '%s'.") % reason
00057         else:
00058             reason = _("This may be due to the printer being disconnected or "
00059                        "switched off.")
00060 
00061         text = ('<span weight="bold" size="larger">' +
00062                 _("Queue Not Enabled") + '</span>\n\n' +
00063                 _("The queue '%s' is not enabled.") %
00064                 answers['cups_queue'])
00065 
00066         if reason:
00067             text += ' ' + reason
00068 
00069         if not answers['cups_printer_remote']:
00070             text += '\n\n'
00071             text += _("To enable it, select the 'Enabled' checkbox in the "
00072                       "'Policies' tab for the printer in the printer "
00073                       "administration tool.")
00074             text += ' ' + _(TEXT_start_print_admin_tool)
00075 
00076         self.label.set_markup (text)
00077         return True
00078 
00079     def can_click_forward (self):
00080         return False