| 1 |
#!/usr/bin/python3 |
| 2 |
|
| 3 |
## Printing troubleshooter |
| 4 |
|
| 5 |
## Copyright (C) 2008 Red Hat, Inc. |
| 6 |
## Copyright (C) 2008 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 |
from gi.repository import Gtk |
| 23 |
|
| 24 |
from .base import * |
| 25 |
class RemoteAddress(Question): |
| 26 |
def __init__ (self, troubleshooter): |
| 27 |
Question.__init__ (self, troubleshooter, "Remote address") |
| 28 |
page = self.initial_vbox (_("Remote Address"), |
| 29 |
_("Please enter as many details as you " |
| 30 |
"can about the network address of this " |
| 31 |
"printer.")) |
| 32 |
grid = Gtk.Grid() |
| 33 |
grid.set_row_spacing (6) |
| 34 |
grid.set_column_spacing (6) |
| 35 |
page.pack_start (grid, False, False, 0) |
| 36 |
|
| 37 |
label = Gtk.Label(label=_("Server name:")) |
| 38 |
label.set_alignment (0, 0) |
| 39 |
grid.attach (label, 0, 0, 1, 1) |
| 40 |
self.server_name = Gtk.Entry () |
| 41 |
self.server_name.set_activates_default (True) |
| 42 |
grid.attach (self.server_name, 1, 0, 1, 1) |
| 43 |
|
| 44 |
label = Gtk.Label(label=_("Server IP address:")) |
| 45 |
label.set_alignment (0, 0) |
| 46 |
grid.attach (label, 0, 1, 1, 1) |
| 47 |
self.server_ipaddr = Gtk.Entry () |
| 48 |
self.server_ipaddr.set_activates_default (True) |
| 49 |
grid.attach (self.server_ipaddr, 1, 1, 1, 1) |
| 50 |
|
| 51 |
troubleshooter.new_page (page, self) |
| 52 |
|
| 53 |
def display (self): |
| 54 |
answers = self.troubleshooter.answers |
| 55 |
if answers['cups_queue_listed']: |
| 56 |
return False |
| 57 |
|
| 58 |
return answers['printer_is_remote'] |
| 59 |
|
| 60 |
def collect_answer (self): |
| 61 |
if not self.displayed: |
| 62 |
return {} |
| 63 |
|
| 64 |
return { 'remote_server_name': self.server_name.get_text (), |
| 65 |
'remote_server_ip_address': self.server_ipaddr.get_text () } |