Back to index

system-config-printer  1.3.9+20120706
RemoteAddress.py
Go to the documentation of this file.
00001 #!/usr/bin/python
00002 
00003 ## Printing troubleshooter
00004 
00005 ## Copyright (C) 2008 Red Hat, Inc.
00006 ## Copyright (C) 2008 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 from base import *
00023 class RemoteAddress(Question):
00024     def __init__ (self, troubleshooter):
00025         Question.__init__ (self, troubleshooter, "Remote address")
00026         page = self.initial_vbox (_("Remote Address"),
00027                                   _("Please enter as many details as you "
00028                                     "can about the network address of this "
00029                                     "printer."))
00030         table = gtk.Table (2, 2)
00031         table.set_row_spacings (6)
00032         table.set_col_spacings (6)
00033         page.pack_start (table, False, False, 0)
00034 
00035         label = gtk.Label (_("Server name:"))
00036         label.set_alignment (0, 0)
00037         table.attach (label, 0, 1, 0, 1)
00038         self.server_name = gtk.Entry ()
00039         self.server_name.set_activates_default (True)
00040         table.attach (self.server_name, 1, 2, 0, 1)
00041 
00042         label = gtk.Label (_("Server IP address:"))
00043         label.set_alignment (0, 0)
00044         table.attach (label, 0, 1, 1, 2)
00045         self.server_ipaddr = gtk.Entry ()
00046         self.server_ipaddr.set_activates_default (True)
00047         table.attach (self.server_ipaddr, 1, 2, 1, 2)
00048 
00049         troubleshooter.new_page (page, self)
00050 
00051     def display (self):
00052         answers = self.troubleshooter.answers
00053         if answers['cups_queue_listed']:
00054             return False
00055 
00056         return answers['printer_is_remote']
00057 
00058     def collect_answer (self):
00059         if not self.displayed:
00060             return {}
00061 
00062         return { 'remote_server_name': self.server_name.get_text (),
00063                  'remote_server_ip_address': self.server_ipaddr.get_text () }