Avoid traceback in most recent change (bug #878527).

Resolves: rhbz#878527
This commit is contained in:
Tim Waugh 2012-11-20 17:40:26 +00:00
parent 88d0c48097
commit 587aba260b
2 changed files with 224 additions and 211 deletions

View File

@ -1,5 +1,6 @@
--- system-config-printer-1.3.11/firewallsettings.py.FirewallD 2012-09-21 13:34:29.070164405 +0200 diff -up system-config-printer-1.3.12/firewallsettings.py.FirewallD system-config-printer-1.3.12/firewallsettings.py
+++ system-config-printer-1.3.11/firewallsettings.py 2012-09-21 13:34:29.070164405 +0200 --- system-config-printer-1.3.12/firewallsettings.py.FirewallD 2012-11-20 17:36:44.148167348 +0000
+++ system-config-printer-1.3.12/firewallsettings.py 2012-11-20 17:36:44.148167348 +0000
@@ -0,0 +1,279 @@ @@ -0,0 +1,279 @@
+#!/usr/bin/python +#!/usr/bin/python
+ +
@ -280,9 +281,10 @@
+ return self._check_any_allowed (set(["--port=%s:%s" % + return self._check_any_allowed (set(["--port=%s:%s" %
+ (MDNS_PORT, MDNS_PROTOCOL), + (MDNS_PORT, MDNS_PROTOCOL),
+ "--service=" + MDNS_SERVICE])) + "--service=" + MDNS_SERVICE]))
--- system-config-printer-1.3.11/Makefile.in.FirewallD 2012-08-03 12:04:49.000000000 +0200 diff -up system-config-printer-1.3.12/Makefile.in.FirewallD system-config-printer-1.3.12/Makefile.in
+++ system-config-printer-1.3.11/Makefile.in 2012-09-21 13:38:04.787202523 +0200 --- system-config-printer-1.3.12/Makefile.in.FirewallD 2012-10-05 17:01:02.000000000 +0100
@@ -358,7 +358,7 @@ nobase_pkgdata_DATA = \ +++ system-config-printer-1.3.12/Makefile.in 2012-11-20 17:36:44.149167352 +0000
@@ -384,7 +384,7 @@ nobase_pkgdata_DATA = \
dnssdresolve.py \ dnssdresolve.py \
errordialogs.py \ errordialogs.py \
HIG.py \ HIG.py \
@ -291,8 +293,9 @@
gui.py \ gui.py \
gtkinklevel.py \ gtkinklevel.py \
gtkspinner.py \ gtkspinner.py \
--- system-config-printer-1.3.11/newprinter.py.FirewallD 2012-05-24 14:03:21.000000000 +0200 diff -up system-config-printer-1.3.12/newprinter.py.FirewallD system-config-printer-1.3.12/newprinter.py
+++ system-config-printer-1.3.11/newprinter.py 2012-09-21 13:34:29.071164392 +0200 --- system-config-printer-1.3.12/newprinter.py.FirewallD 2012-09-17 11:08:52.000000000 +0100
+++ system-config-printer-1.3.12/newprinter.py 2012-11-20 17:36:44.149167352 +0000
@@ -63,7 +63,7 @@ from smburi import SMBURI @@ -63,7 +63,7 @@ from smburi import SMBURI
from errordialogs import * from errordialogs import *
from PhysicalDevice import PhysicalDevice from PhysicalDevice import PhysicalDevice
@ -362,203 +365,9 @@
f.write () f.write ()
except (dbus.DBusException, Exception): except (dbus.DBusException, Exception):
nonfatalException () nonfatalException ()
--- system-config-printer-1.3.11/serversettings.py.FirewallD 2012-05-24 14:03:22.000000000 +0200 diff -up system-config-printer-1.3.12/printerproperties.py.FirewallD system-config-printer-1.3.12/printerproperties.py
+++ system-config-printer-1.3.11/serversettings.py 2012-09-21 13:34:29.072164379 +0200 --- system-config-printer-1.3.12/printerproperties.py.FirewallD 2012-09-17 11:08:52.000000000 +0100
@@ -34,7 +34,7 @@ import time +++ system-config-printer-1.3.12/printerproperties.py 2012-11-20 17:37:00.853222088 +0000
import authconn
from debug import *
from errordialogs import *
-import firewall
+import firewallsettings
from gui import GtkGUI
try:
@@ -526,7 +526,10 @@ class ServerSettings(GtkGUI):
try:
if (self._host == 'localhost' or
self._host[0] == '/'):
- f = firewall.Firewall ()
+ f = firewallsettings.FirewallD ()
+ if not f.running():
+ f = firewallsettings.SystemConfigFirewall ()
+
allowed = f.check_ipp_server_allowed ()
else:
# This is a remote server. Nothing we can do
@@ -549,7 +552,7 @@ class ServerSettings(GtkGUI):
dialog.destroy ()
if response == gtk.RESPONSE_YES:
- f.add_rule (f.ALLOW_IPP_SERVER)
+ f.add_service (firewallsettings.IPP_SERVER_SERVICE)
f.write ()
except (dbus.DBusException, Exception):
nonfatalException ()
--- system-config-printer-1.3.11/system-config-printer.py 2012-09-21 13:34:29.073164365 +0200
+++ system-config-printer-1.3.12/system-config-printer.py 2012-11-19 16:24:49.505775460 +0000
@@ -2,7 +2,7 @@
## system-config-printer
-## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
+## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## Florian Festi <ffesti@redhat.com>
@@ -309,9 +309,9 @@
self.btnNew.connect ('clicked', self.on_new_printer_activate)
self.toolbar.add (self.btnNew)
self.toolbar.add (gtk.SeparatorToolItem ())
- refreshbutton = gtk.ToolButton (gtk.STOCK_REFRESH)
- refreshbutton.connect ('clicked', self.on_btnRefresh_clicked)
- self.toolbar.add (refreshbutton)
+ self.refreshbutton = gtk.ToolButton (gtk.STOCK_REFRESH)
+ self.refreshbutton.connect ('clicked', self.on_btnRefresh_clicked)
+ self.toolbar.add (self.refreshbutton)
self.toolbar.show_all ()
server_context_menu = gtk.Menu ()
@@ -370,6 +370,7 @@
self.newPrinterGUI = np = newprinter.NewPrinterGUI()
np.connect ("printer-added", self.on_new_printer_added)
np.connect ("printer-modified", self.on_printer_modified)
+ np.connect ("dialog-canceled", self.on_new_printer_not_added)
# Set up "About" dialog
self.AboutDialog.set_program_name(config.PACKAGE)
@@ -446,6 +447,8 @@
# Printer Properties dialog
self.propertiesDlg = printerproperties.PrinterPropertiesDialog ()
+ self.propertiesDlg.connect ("dialog-closed",
+ self.on_properties_dialog_closed)
try:
self.populateList()
@@ -506,11 +509,13 @@
name = unicode (model.get_value (iter, 2))
object = model.get_value (iter, 0)
+ self.desensitise_main_window_widgets ()
try:
self.propertiesDlg.show (name, host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow)
except cups.IPPError, (e, m):
+ self.sensitise_main_window_widgets ()
show_IPP_Error (e, m, self.PrintersWindow)
if e == cups.IPP_SERVICE_UNAVAILABLE:
self.cups = None
@@ -518,12 +523,16 @@
self.populateList ()
return
except RuntimeError:
+ self.sensitise_main_window_widgets ()
# Perhaps cupsGetPPD2 failed for a browsed printer.
# Check that we're still connected.
self.monitor.update ()
return
+ def on_properties_dialog_closed (self, obj):
+ self.sensitise_main_window_widgets ()
+
def dests_iconview_selection_changed (self, iconview):
self.updating_widgets = True
paths = iconview.get_selected_items ()
@@ -1708,6 +1717,34 @@
def on_troubleshoot_quit(self, troubleshooter):
del self.troubleshooter
+ def sensitise_main_window_widgets (self, sensitive=True):
+ self.dests_iconview.set_sensitive (sensitive)
+ self.btnNew.set_sensitive (sensitive)
+ self.btnAddFirstPrinter.set_sensitive (sensitive)
+ self.refreshbutton.set_sensitive (sensitive)
+ self.view_discovered_printers.set_sensitive (sensitive)
+ self.search_entry.set_sensitive (sensitive)
+ for action in ["/connect-to-server",
+ "/server-settings",
+ "/new-printer",
+ "/new-class",
+ "/rename-printer",
+ "/duplicate-printer",
+ "/delete-printer",
+ "/set-default-printer",
+ "/edit-printer",
+ "/create-class",
+ "/enable-printer",
+ "/share-printer",
+ "/filter-name",
+ "/filter-description",
+ "/filter-location",
+ "/filter-manufacturer"]:
+ self.ui_manager.get_action (action).set_sensitive (sensitive)
+
+ def desensitise_main_window_widgets (self):
+ self.sensitise_main_window_widgets (False)
+
# About dialog
def on_about_activate(self, widget):
self.AboutDialog.set_transient_for (self.PrintersWindow)
@@ -1728,26 +1765,44 @@
# == New Printer Dialog ==============================================
# ====================================================================
+ def sensitise_new_printer_widgets(self, sensitive=True):
+ self.btnNew.set_sensitive (sensitive)
+ self.btnAddFirstPrinter.set_sensitive (sensitive)
+ self.ui_manager.get_action ("/new-printer").set_sensitive (sensitive)
+ self.ui_manager.get_action ("/new-class").set_sensitive (sensitive)
+
+ def desensitise_new_printer_widgets(self):
+ self.sensitise_new_printer_widgets (False)
+
# new printer
def on_new_printer_activate(self, widget):
busy (self.PrintersWindow)
+ self.desensitise_new_printer_widgets ()
if not self.newPrinterGUI.init("printer",
host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow):
+ self.sensitise_new_printer_widgets ()
self.monitor.update ()
ready (self.PrintersWindow)
# new class
def on_new_class_activate(self, widget):
+ self.desensitise_new_printer_widgets ()
if not self.newPrinterGUI.init("class",
host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow):
+ self.sensitise_new_printer_widgets ()
self.monitor.update ()
+ def on_new_printer_not_added (self, obj):
+ self.sensitise_new_printer_widgets ()
+
def on_new_printer_added (self, obj, name):
debugprint ("New printer added: %s" % name)
+
+ self.sensitise_new_printer_widgets ()
self.populateList ()
if not self.printers.has_key (name):
--- system-config-printer-1.3.11/ui/NewPrinterWindow.ui.FirewallD 2012-05-24 14:03:22.000000000 +0200
+++ system-config-printer-1.3.11/ui/NewPrinterWindow.ui 2012-09-21 13:34:29.075164337 +0200
@@ -4,7 +4,7 @@
<object class="GtkWindow" id="NewPrinterWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Printer</property>
- <property name="modal">True</property>
+ <property name="modal">False</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">600</property>
<property name="default_height">420</property>
--- system-config-printer-1.3.12/printerproperties.py.modality 2012-09-17 11:08:52.000000000 +0100
+++ system-config-printer-1.3.12/printerproperties.py 2012-11-19 16:24:49.505775460 +0000
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
## system-config-printer ## system-config-printer
@ -577,13 +386,15 @@
if parent: if parent:
self.dialog.set_transient_for (parent) self.dialog.set_transient_for (parent)
@@ -1820,30 +1822,47 @@ class PrinterPropertiesDialog(GtkGUI): @@ -1820,30 +1822,49 @@ class PrinterPropertiesDialog(GtkGUI):
self.changed.discard(self.tvClassMembers) self.changed.discard(self.tvClassMembers)
self.setDataButtonState() self.setDataButtonState()
+ def sensitise_new_printer_widgets (self, sensitive=True): + def sensitise_new_printer_widgets (self, sensitive=True):
+ sensitive = sensitive and not (self.printer.discovered or + sensitive = (sensitive and
+ bool (self.changed)) + self.printer and
+ not (self.printer.discovered or
+ bool (self.changed)))
+ for button in [self.btnChangePPD, + for button in [self.btnChangePPD,
+ self.btnSelectDevice]: + self.btnSelectDevice]:
+ button.set_sensitive (sensitive) + button.set_sensitive (sensitive)
@ -636,7 +447,7 @@
if self.dialog.get_property ('visible') and self.printer: if self.dialog.get_property ('visible') and self.printer:
try: try:
self.printer.getAttributes () self.printer.getAttributes ()
@@ -1855,6 +1874,9 @@ class PrinterPropertiesDialog(GtkGUI): @@ -1855,6 +1876,9 @@ class PrinterPropertiesDialog(GtkGUI):
except cups.IPPError: except cups.IPPError:
pass pass
@ -646,8 +457,207 @@
# Monitor signal handlers # Monitor signal handlers
def on_printer_event (self, mon, printer, eventname, event): def on_printer_event (self, mon, printer, eventname, event):
self.on_printer_modified (None, printer, False) self.on_printer_modified (None, printer, False)
--- system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui.modality 2012-08-08 13:05:21.000000000 +0100 diff -up system-config-printer-1.3.12/serversettings.py.FirewallD system-config-printer-1.3.12/serversettings.py
+++ system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui 2012-11-19 16:24:49.506775465 +0000 --- system-config-printer-1.3.12/serversettings.py.FirewallD 2012-09-17 11:08:52.000000000 +0100
+++ system-config-printer-1.3.12/serversettings.py 2012-11-20 17:36:44.150167356 +0000
@@ -34,7 +34,7 @@ import time
import authconn
from debug import *
from errordialogs import *
-import firewall
+import firewallsettings
from gui import GtkGUI
try:
@@ -526,7 +526,10 @@ class ServerSettings(GtkGUI):
try:
if (self._host == 'localhost' or
self._host[0] == '/'):
- f = firewall.Firewall ()
+ f = firewallsettings.FirewallD ()
+ if not f.running():
+ f = firewallsettings.SystemConfigFirewall ()
+
allowed = f.check_ipp_server_allowed ()
else:
# This is a remote server. Nothing we can do
@@ -549,7 +552,7 @@ class ServerSettings(GtkGUI):
dialog.destroy ()
if response == gtk.RESPONSE_YES:
- f.add_rule (f.ALLOW_IPP_SERVER)
+ f.add_service (firewallsettings.IPP_SERVER_SERVICE)
f.write ()
except (dbus.DBusException, Exception):
nonfatalException ()
diff -up system-config-printer-1.3.12/system-config-printer.py.FirewallD system-config-printer-1.3.12/system-config-printer.py
--- system-config-printer-1.3.12/system-config-printer.py.FirewallD 2012-09-18 17:00:14.000000000 +0100
+++ system-config-printer-1.3.12/system-config-printer.py 2012-11-20 17:36:44.150167356 +0000
@@ -2,7 +2,7 @@
## system-config-printer
-## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
+## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Red Hat, Inc.
## Authors:
## Tim Waugh <twaugh@redhat.com>
## Florian Festi <ffesti@redhat.com>
@@ -309,9 +309,9 @@ class GUI(GtkGUI):
self.btnNew.connect ('clicked', self.on_new_printer_activate)
self.toolbar.add (self.btnNew)
self.toolbar.add (gtk.SeparatorToolItem ())
- refreshbutton = gtk.ToolButton (gtk.STOCK_REFRESH)
- refreshbutton.connect ('clicked', self.on_btnRefresh_clicked)
- self.toolbar.add (refreshbutton)
+ self.refreshbutton = gtk.ToolButton (gtk.STOCK_REFRESH)
+ self.refreshbutton.connect ('clicked', self.on_btnRefresh_clicked)
+ self.toolbar.add (self.refreshbutton)
self.toolbar.show_all ()
server_context_menu = gtk.Menu ()
@@ -370,6 +370,7 @@ class GUI(GtkGUI):
self.newPrinterGUI = np = newprinter.NewPrinterGUI()
np.connect ("printer-added", self.on_new_printer_added)
np.connect ("printer-modified", self.on_printer_modified)
+ np.connect ("dialog-canceled", self.on_new_printer_not_added)
# Set up "About" dialog
self.AboutDialog.set_program_name(config.PACKAGE)
@@ -446,6 +447,8 @@ class GUI(GtkGUI):
# Printer Properties dialog
self.propertiesDlg = printerproperties.PrinterPropertiesDialog ()
+ self.propertiesDlg.connect ("dialog-closed",
+ self.on_properties_dialog_closed)
try:
self.populateList()
@@ -506,11 +509,13 @@ class GUI(GtkGUI):
name = unicode (model.get_value (iter, 2))
object = model.get_value (iter, 0)
+ self.desensitise_main_window_widgets ()
try:
self.propertiesDlg.show (name, host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow)
except cups.IPPError, (e, m):
+ self.sensitise_main_window_widgets ()
show_IPP_Error (e, m, self.PrintersWindow)
if e == cups.IPP_SERVICE_UNAVAILABLE:
self.cups = None
@@ -518,12 +523,16 @@ class GUI(GtkGUI):
self.populateList ()
return
except RuntimeError:
+ self.sensitise_main_window_widgets ()
# Perhaps cupsGetPPD2 failed for a browsed printer.
# Check that we're still connected.
self.monitor.update ()
return
+ def on_properties_dialog_closed (self, obj):
+ self.sensitise_main_window_widgets ()
+
def dests_iconview_selection_changed (self, iconview):
self.updating_widgets = True
paths = iconview.get_selected_items ()
@@ -1708,6 +1717,34 @@ class GUI(GtkGUI):
def on_troubleshoot_quit(self, troubleshooter):
del self.troubleshooter
+ def sensitise_main_window_widgets (self, sensitive=True):
+ self.dests_iconview.set_sensitive (sensitive)
+ self.btnNew.set_sensitive (sensitive)
+ self.btnAddFirstPrinter.set_sensitive (sensitive)
+ self.refreshbutton.set_sensitive (sensitive)
+ self.view_discovered_printers.set_sensitive (sensitive)
+ self.search_entry.set_sensitive (sensitive)
+ for action in ["/connect-to-server",
+ "/server-settings",
+ "/new-printer",
+ "/new-class",
+ "/rename-printer",
+ "/duplicate-printer",
+ "/delete-printer",
+ "/set-default-printer",
+ "/edit-printer",
+ "/create-class",
+ "/enable-printer",
+ "/share-printer",
+ "/filter-name",
+ "/filter-description",
+ "/filter-location",
+ "/filter-manufacturer"]:
+ self.ui_manager.get_action (action).set_sensitive (sensitive)
+
+ def desensitise_main_window_widgets (self):
+ self.sensitise_main_window_widgets (False)
+
# About dialog
def on_about_activate(self, widget):
self.AboutDialog.set_transient_for (self.PrintersWindow)
@@ -1728,26 +1765,44 @@ class GUI(GtkGUI):
# == New Printer Dialog ==============================================
# ====================================================================
+ def sensitise_new_printer_widgets(self, sensitive=True):
+ self.btnNew.set_sensitive (sensitive)
+ self.btnAddFirstPrinter.set_sensitive (sensitive)
+ self.ui_manager.get_action ("/new-printer").set_sensitive (sensitive)
+ self.ui_manager.get_action ("/new-class").set_sensitive (sensitive)
+
+ def desensitise_new_printer_widgets(self):
+ self.sensitise_new_printer_widgets (False)
+
# new printer
def on_new_printer_activate(self, widget):
busy (self.PrintersWindow)
+ self.desensitise_new_printer_widgets ()
if not self.newPrinterGUI.init("printer",
host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow):
+ self.sensitise_new_printer_widgets ()
self.monitor.update ()
ready (self.PrintersWindow)
# new class
def on_new_class_activate(self, widget):
+ self.desensitise_new_printer_widgets ()
if not self.newPrinterGUI.init("class",
host=self.connect_server,
encryption=self.connect_encrypt,
parent=self.PrintersWindow):
+ self.sensitise_new_printer_widgets ()
self.monitor.update ()
+ def on_new_printer_not_added (self, obj):
+ self.sensitise_new_printer_widgets ()
+
def on_new_printer_added (self, obj, name):
debugprint ("New printer added: %s" % name)
+
+ self.sensitise_new_printer_widgets ()
self.populateList ()
if not self.printers.has_key (name):
diff -up system-config-printer-1.3.12/ui/NewPrinterWindow.ui.FirewallD system-config-printer-1.3.12/ui/NewPrinterWindow.ui
--- system-config-printer-1.3.12/ui/NewPrinterWindow.ui.FirewallD 2012-09-17 11:08:52.000000000 +0100
+++ system-config-printer-1.3.12/ui/NewPrinterWindow.ui 2012-11-20 17:36:44.151167360 +0000
@@ -4,7 +4,7 @@
<object class="GtkWindow" id="NewPrinterWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">New Printer</property>
- <property name="modal">True</property>
+ <property name="modal">False</property>
<property name="window_position">center-on-parent</property>
<property name="default_width">600</property>
<property name="default_height">420</property>
diff -up system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui.FirewallD system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui
--- system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui.FirewallD 2012-08-08 13:05:21.000000000 +0100
+++ system-config-printer-1.3.12/ui/PrinterPropertiesDialog.ui 2012-11-20 17:36:44.152167364 +0000
@@ -89,7 +89,7 @@ @@ -89,7 +89,7 @@
</object> </object>
<object class="GtkDialog" id="PrinterPropertiesDialog"> <object class="GtkDialog" id="PrinterPropertiesDialog">

View File

@ -1,7 +1,7 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.3.12 Version: 1.3.12
Release: 4%{?dist} Release: 5%{?dist}
License: GPLv2+ License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/ URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base Group: System Environment/Base
@ -175,6 +175,9 @@ touch %buildroot%{_localstatedir}/run/udev-configure-printer/usb-uris
exit 0 exit 0
%changelog %changelog
* Tue Nov 20 2012 Tim Waugh <twaugh@redhat.com> 1.3.12-5
- Avoid traceback in most recent change (bug #878527).
* Mon Nov 19 2012 Tim Waugh <twaugh@redhat.com> 1.3.12-4 * Mon Nov 19 2012 Tim Waugh <twaugh@redhat.com> 1.3.12-4
- Fixed dialog modality problem which prevented e.g. changing drivers. - Fixed dialog modality problem which prevented e.g. changing drivers.