- 1.1.13:

- Translation updates (bug #522451).
This commit is contained in:
Tim Waugh 2009-09-14 15:07:15 +00:00
parent 52914f1058
commit 5f2f72f65f
13 changed files with 8 additions and 1111 deletions

View File

@ -204,3 +204,4 @@ system-config-printer-1.1.8.tar.bz2
system-config-printer-1.1.10.tar.bz2
system-config-printer-1.1.11.tar.xz
system-config-printer-1.1.12.tar.xz
system-config-printer-1.1.13.tar.xz

View File

@ -1,3 +1,3 @@
ac8f98a40b0fc4b6ab4470f10489887a pysmbc-1.0.6.tar.bz2
895d4170542ec80c74d41746a9474409 pycups-1.9.46.tar.bz2
588d53af2750aa4e3418b61262012880 system-config-printer-1.1.12.tar.xz
15fec6e2bb9543aa42bf86814855f25c system-config-printer-1.1.13.tar.xz

Binary file not shown.

View File

@ -1,502 +0,0 @@
diff -up system-config-printer-1.1.12/cupshelpers/cupshelpers.py.get-devices system-config-printer-1.1.12/cupshelpers/cupshelpers.py
--- system-config-printer-1.1.12/cupshelpers/cupshelpers.py.get-devices 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/cupshelpers/cupshelpers.py 2009-09-04 10:40:45.092512574 +0100
@@ -541,7 +541,7 @@ class Device:
return result
-def getDevices(connection):
+def getDevices(connection, **kw):
"""
Obtain a list of available CUPS devices.
@@ -550,7 +550,7 @@ def getDevices(connection):
@returns: a list of L{Device} objects
@raise cups.IPPError: IPP Error
"""
- devices = connection.getDevices()
+ devices = connection.getDevices(**kw)
for uri, data in devices.iteritems():
device = Device(uri, **data)
devices[uri] = device
diff -up system-config-printer-1.1.12/cupspk.py.get-devices system-config-printer-1.1.12/cupspk.py
--- system-config-printer-1.1.12/cupspk.py.get-devices 2009-09-04 10:40:45.010390541 +0100
+++ system-config-printer-1.1.12/cupspk.py 2009-09-04 10:40:45.095512451 +0100
@@ -311,12 +311,13 @@ class Connection:
def getDevices(self, *args, **kwds):
use_pycups = False
- timeout = 0
+ limit = 0
include_schemes = ''
exclude_schemes = ''
+ timeout = 0
- if len(args) == 3:
- (use_pycups, timeout, include_schemes, exclude_schemes) = self._args_to_tuple([int, str, str], *args)
+ if len(args) == 4:
+ (use_pycups, limit, include_schemes, exclude_schemes, timeout) = self._args_to_tuple([int, str, str, int], *args)
else:
if kwds.has_key('timeout'):
timeout = kwds['timeout']
@@ -327,6 +328,17 @@ class Connection:
if kwds.has_key('exclude_schemes'):
exclude_schemes = kwds['exclude_schemes']
+ # Convert from list to string
+ if len (include_schemes) > 0:
+ include_schemes = reduce (lambda x, y: x + "," + y, include_schemes)
+ else:
+ include_schemes = ""
+
+ if len (exclude_schemes) > 0:
+ exclude_schemes = reduce (lambda x, y: x + "," + y, exclude_schemes)
+ else:
+ exclude_schemes = ""
+
pk_args = (timeout, include_schemes, exclude_schemes)
result = self._call_with_pk_and_fallback(use_pycups,
diff -up system-config-printer-1.1.12/gtkspinner.py.get-devices system-config-printer-1.1.12/gtkspinner.py
--- system-config-printer-1.1.12/gtkspinner.py.get-devices 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/gtkspinner.py 2009-09-04 10:40:45.096512525 +0100
@@ -65,7 +65,7 @@ class Spinner:
def _next_frame (self):
n = self._current_frame + 1
if n >= self.n_frames:
- n = 0
+ n = 1
self._set_frame (n)
return True
diff -up system-config-printer-1.1.12/system-config-printer.py.get-devices system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.get-devices 2009-09-04 10:40:45.074388881 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-09-04 10:40:54.528387635 +0100
@@ -3681,6 +3681,7 @@ class NewPrinterGUI(GtkGUI):
self.ntbkNPDownloadableDriverProperties.set_show_tabs(False)
self.spinner = gtkspinner.Spinner (self.imgProcessWorking)
+ self.spinner_count = 0
# Set up OpenPrinting widgets.
self.openprinting = cupshelpers.openprinting.OpenPrinting ()
@@ -3765,6 +3766,19 @@ class NewPrinterGUI(GtkGUI):
ppd_filter.add_pattern("*")
self.filechooserPPD.add_filter(ppd_filter)
+ def inc_spinner_task (self):
+ if self.spinner_count == 0:
+ self.imgProcessWorking.show ()
+ self.spinner.start ()
+
+ self.spinner_count += 1
+
+ def dec_spinner_task (self):
+ self.spinner_count -= 1
+ if self.spinner_count == 0:
+ self.imgProcessWorking.hide ()
+ self.spinner.stop ()
+
def show_IPP_Error (self, exception, message):
return show_IPP_Error (exception, message, parent=self.NewPrinterWindow)
@@ -4172,6 +4186,10 @@ class NewPrinterGUI(GtkGUI):
# Navigation buttons
def on_NPCancel(self, widget, event=None):
+ if self.fetchDevices_op:
+ self.fetchDevices_op.cancel ()
+ self.dec_spinner_task ()
+
self.NewPrinterWindow.hide()
if self.openprinting_query_handle != None:
self.openprinting.cancelOperation (self.openprinting_query_handle)
@@ -4611,45 +4629,48 @@ class NewPrinterGUI(GtkGUI):
self.btnNPForward.set_sensitive(
self.mainapp.checkNPName(new_text))
- def fetchDevices(self, parent=None):
+ def fetchDevices(self, parent=None, network=False):
debugprint ("fetchDevices")
- self.lblWait.set_markup ('<span weight="bold" size="larger">' +
- _('Searching') + '</span>\n\n' +
- _('Searching for printers'))
- if parent == None:
- parent = self.mainapp.PrintersWindow
- self.WaitWindow.set_transient_for (parent)
- self.WaitWindow.show_now ()
- self.busy (self.WaitWindow)
- if self.mainapp.cups._use_pk and config.WITH_POLKIT_1:
- def get_devices():
- c = authconn.Connection (host=self.mainapp.connect_server,
- parent=parent, lock=True)
- c._begin_operation (_("fetching device list"))
- ret = cupshelpers.getDevices (c)
- c._end_operation ()
- return ret
+ have_polkit_1 = self.mainapp.cups._use_pk and config.WITH_POLKIT_1
+ if not have_polkit_1:
+ if network:
+ return {}
- op = TimedOperation (get_devices)
- try:
- devices = op.run ()
- except (OperationCanceled, RuntimeError, cups.IPPError):
- self.WaitWindow.hide ()
- raise
- else:
- self.mainapp.cups._begin_operation (_("fetching device list"))
- try:
- devices = cupshelpers.getDevices (self.mainapp.cups)
- self.mainapp.cups._end_operation ()
- except cups.IPPError:
- self.mainapp.cups._end_operation ()
- self.WaitWindow.hide ()
- raise
+ network = True
- self.WaitWindow.hide ()
+ network_schemes = ["dnssd", "snmp"]
+ try:
+ c = authconn.Connection (host=self.mainapp.connect_server,
+ parent=parent, lock=True)
+ debugprint ("in get_devices: connected")
+ c._begin_operation (_("fetching device list"))
+ try:
+ if network:
+ debugprint ("Fetching network devices")
+ ret = cupshelpers.getDevices (c,
+ include_schemes=network_schemes)
+ else:
+ debugprint ("Fetching local devices")
+ ret = cupshelpers.getDevices (c,
+ exclude_schemes=network_schemes)
+ except TypeError:
+ # include_schemes/exclude_schemes requires pycups >= 1.9.46
+ if network:
+ ret = {}
+ else:
+ debugprint ("Fetching all devices")
+ debugprint ("in get_devices: getDevices")
+ ret = cupshelpers.getDevices (c)
+ except RuntimeError:
+ raise
+ except cups.IPPError:
+ c._end_operation ()
+ raise
+
+ c._end_operation ()
debugprint ("Got devices")
- return devices
+ return ret
def install_hplip_plugin(self, uri):
"""
@@ -4962,23 +4983,66 @@ class NewPrinterGUI(GtkGUI):
return (host, uri)
def fillDeviceTab(self, current_uri=None):
- try:
- devices = self.fetchDevices()
- except cups.IPPError, (e, msg):
- self.show_IPP_Error(e, msg)
- devices = {}
- except:
- nonfatalException()
- devices = {}
+ self.device_selected = -1
+ model = gtk.TreeStore (gobject.TYPE_STRING, # device-info
+ gobject.TYPE_PYOBJECT, # PhysicalDevice obj
+ gobject.TYPE_BOOLEAN) # Separator?
+ other = cupshelpers.Device('', **{'device-info' :_("Other")})
+ physother = PhysicalDevice (other)
+ self.devices = [physother]
+ model.append (None, row=[physother.get_info (), physother, False])
+ network_iter = model.append (None, row=[_("Network Printer"),
+ None,
+ False])
+ network_dict = { 'device-class': 'network',
+ 'device-info': _("Find Network Printer") }
+ network = cupshelpers.Device ('network', **network_dict)
+ find_nw_iter = model.append (network_iter,
+ row=[network_dict['device-info'],
+ PhysicalDevice (network), False])
+ model.insert_after (network_iter, find_nw_iter, row=['', None, True])
+ self.devices_find_nw_iter = find_nw_iter
+ self.devices_network_iter = network_iter
+ self.devices_network_fetched = False
+ self.tvNPDevices.set_model (model)
+ self.entNPTDevice.set_text ('')
+ self.expNPDeviceURIs.hide ()
+ self.inc_spinner_task ()
+
+ self.fetchDevices_op = TimedOperation (self.fetchDevices,
+ kwargs={"network": False},
+ callback=self.got_devices,
+ context=(current_uri, False))
+
+ def got_devices (self, result, exception, context):
+ self.dec_spinner_task ()
+ (current_uri, network) = context
+ if exception:
+ try:
+ raise exception
+ except:
+ nonfatalException()
+ return
+
+ if network:
+ self.fetchDevices_op = None
+ else:
+ # Now we've got the local devices, start a request for the
+ # network devices.
+ context = (current_uri, True)
+ self.inc_spinner_task ()
+ self.fetchDevices_op = TimedOperation (self.fetchDevices,
+ kwargs={"network": True},
+ callback=self.got_devices,
+ context=context)
+ devices = result
if current_uri:
if devices.has_key (current_uri):
current = devices.pop(current_uri)
- current.info += _(" (Current)")
elif devices.has_key (current_uri.replace (":9100", "")):
current_uri = current_uri.replace (":9100", "")
current = devices.pop(current_uri)
- current.info += _(" (Current)")
else:
current = cupshelpers.Device (current_uri)
current.info = "Current device"
@@ -5021,7 +5085,7 @@ class NewPrinterGUI(GtkGUI):
"hal", "beh",
"scsi", "http", "delete"),
devices)
- self.devices = []
+ newdevices = []
for device in devices:
physicaldevice = PhysicalDevice (device)
try:
@@ -5029,43 +5093,32 @@ class NewPrinterGUI(GtkGUI):
self.devices[i].add_device (device)
except ValueError:
self.devices.append (physicaldevice)
+ newdevices.append (physicaldevice)
self.devices.sort()
- other = cupshelpers.Device('', **{'device-info' :_("Other")})
- self.devices.append (PhysicalDevice (other))
- device_select_index = 0
if current_uri:
current_device = PhysicalDevice (current)
try:
i = self.devices.index (current_device)
self.devices[i].add_device (current)
- device_select_index = i
- devs = self.devices[i].get_devices ()
+ current_device = self.devices[i]
except ValueError:
- self.devices.insert(0, current_device)
+ self.devices.append (current_device)
+ newdevices.append (current_device)
+ else:
+ current_device = None
- model = gtk.TreeStore (gobject.TYPE_STRING, # device-info
- gobject.TYPE_PYOBJECT, # PhysicalDevice obj
- gobject.TYPE_BOOLEAN) # Separator?
- network_iter = model.append (None, row=[_("Network Printer"),
- None,
- False])
- network_dict = { 'device-class': 'network',
- 'device-info': _("Find Network Printer") }
- network = cupshelpers.Device ('network', **network_dict)
- find_nw_iter = model.append (network_iter,
- row=[network_dict['device-info'],
- PhysicalDevice (network), False])
- model.insert_after (network_iter, find_nw_iter, row=['', None, True])
- self.devices_find_nw_iter = find_nw_iter
- self.tvNPDevices.set_model (model)
+ model = self.tvNPDevices.get_model ()
- i = 0
- device_select_path = None
- for device in self.devices:
+ network_iter = self.devices_network_iter
+ find_nw_iter = self.devices_find_nw_iter
+ for device in newdevices:
devs = device.get_devices ()
network = devs[0].device_class == 'network'
- row=[device.get_info (), device, False]
+ info = device.get_info ()
+ if device == current_device:
+ info += _(" (Current)")
+ row=[info, device, False]
if network:
if devs[0].uri != devs[0].type:
# An actual network printer device. Put this at the top.
@@ -5075,24 +5128,31 @@ class NewPrinterGUI(GtkGUI):
# If this is the currently selected device we need
# to expand the "Network Printer" row so that it
# is visible.
- if device_select_index == i:
+ if device == current_device:
network_path = model.get_path (network_iter)
self.tvNPDevices.expand_row (network_path, False)
else:
# Just a method of finding one.
iter = model.append (network_iter, row=row)
else:
- iter = model.insert_before(None, network_iter, row=row)
+ # Insert this local device in order.
+ iter = model.get_iter_first ()
+ while iter != network_iter:
+ physdev = model.get_value (iter, 1)
+ if physdev > device:
+ break
+
+ iter = model.iter_next (iter)
- if device_select_index == i:
+ iter = model.insert_before (None, iter, row=row)
+
+ if device == current_device:
device_select_path = model.get_path (iter)
self.tvNPDevices.scroll_to_cell (device_select_path,
row_align=0.5)
column = self.tvNPDevices.get_column (0)
self.tvNPDevices.set_cursor (device_select_path, column)
- i += 1
-
connection_select_path = 0
if current_uri:
model = self.tvNPDeviceURIs.get_model ()
@@ -5106,6 +5166,9 @@ class NewPrinterGUI(GtkGUI):
iter = model.iter_next (iter)
i += 1
+ elif not self.device_selected:
+ column = self.tvNPDevices.get_column (0)
+ self.tvNPDevices.set_cursor ((0,), column)
column = self.tvNPDeviceURIs.get_column (0)
self.tvNPDeviceURIs.set_cursor (connection_select_path, column)
@@ -5565,6 +5628,7 @@ class NewPrinterGUI(GtkGUI):
return False
def on_tvNPDevices_cursor_changed(self, widget):
+ self.device_selected += 1
path, column = widget.get_cursor ()
if path == None:
return
@@ -5868,8 +5932,7 @@ class NewPrinterGUI(GtkGUI):
self.network_found = 0
self.lblNetworkFindSearching.show_all ()
finder = probe_printer.PrinterFinder ()
- self.imgProcessWorking.show ()
- self.spinner.start ()
+ self.inc_spinner_task ()
finder.find (host, found_callback)
def found_network_printer_callback (self, new_device):
@@ -5898,8 +5961,7 @@ class NewPrinterGUI(GtkGUI):
path = model.get_path (iter)
self.tvNPDevices.set_cursor (path)
else:
- self.imgProcessWorking.hide ()
- self.spinner.stop ()
+ self.dec_spinner_task ()
self.lblNetworkFindSearching.hide ()
self.entNPTNetworkHostname.set_sensitive (True)
self.btnNetworkFind.set_sensitive (True)
diff -up system-config-printer-1.1.12/timedops.py.get-devices system-config-printer-1.1.12/timedops.py
--- system-config-printer-1.1.12/timedops.py.get-devices 2009-08-25 15:01:41.000000000 +0100
+++ system-config-printer-1.1.12/timedops.py 2009-09-04 10:40:54.530391539 +0100
@@ -152,16 +152,25 @@ class OperationThread(threading.Thread):
class TimedOperation(Timed):
def __init__ (self, target, args=(), kwargs={}, parent=None,
- show_dialog=False):
+ show_dialog=False, callback=None, context=None):
self.wait_window = None
self.parent = parent
self.show_dialog = show_dialog
+ self.callback = callback
+ self.context = context
self.thread = OperationThread (target=target,
args=args,
kwargs=kwargs)
self.thread.start ()
+ self.use_callback = callback != None
+ if self.use_callback:
+ self.timeout_source = gobject.timeout_add (50, self._check_thread)
+
def run (self):
+ if self.use_callback:
+ raise RuntimeError
+
if self.show_dialog:
wait = gtk.MessageDialog (self.parent,
gtk.DIALOG_MODAL |
@@ -170,7 +179,7 @@ class TimedOperation(Timed):
gtk.BUTTONS_CANCEL,
_("Please wait"))
wait.connect ("delete_event", lambda *args: False)
- wait.connect ("response", self.wait_window_response)
+ wait.connect ("response", self._wait_window_response)
if self.parent:
wait.set_transient_for (self.parent)
@@ -178,7 +187,7 @@ class TimedOperation(Timed):
wait.format_secondary_text (_("Gathering information"))
wait.show_all ()
- self.timeout_source = gobject.timeout_add (50, self.check_thread)
+ self.timeout_source = gobject.timeout_add (50, self._check_thread)
gtk.main ()
gobject.source_remove (self.timeout_source)
if self.show_dialog:
@@ -186,20 +195,33 @@ class TimedOperation(Timed):
return self.thread.collect_result ()
- def check_thread (self):
+ def _check_thread (self):
if self.thread.isAlive ():
# Thread still running.
return True
- # Thread has finished. Stop the sub-loop.
- gtk.main_quit ()
+ # Thread has finished. Stop the sub-loop or trigger callback.
+ if self.use_callback:
+ if self.callback != None:
+ if self.context != None:
+ self.callback (self.thread.result, self.thread.exception,
+ self.context)
+ else:
+ self.callback (self.thread.result, self.thread.exception)
+ else:
+ gtk.main_quit ()
+
return False
- def wait_window_response (self, dialog, response):
+ def _wait_window_response (self, dialog, response):
if response == gtk.RESPONSE_CANCEL:
self.cancel ()
def cancel (self):
debugprint ("Command canceled")
- gtk.main_quit ()
+ if self.use_callback:
+ self.callback = None
+ else:
+ gtk.main_quit ()
+
return False

View File

@ -1,17 +0,0 @@
diff -up system-config-printer-1.1.12/system-config-printer.py.get_cursor system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.get_cursor 2009-08-25 17:01:28.000000000 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-08-26 12:32:02.757680412 +0100
@@ -5655,7 +5655,12 @@ class NewPrinterGUI(GtkGUI):
self.expNPDeviceURIs.hide ()
def on_tvNPDeviceURIs_cursor_changed(self, widget):
- model, iter = widget.get_selection().get_selected()
+ path, column = widget.get_cursor ()
+ if path == None:
+ return
+
+ model = widget.get_model ()
+ iter = model.get_iter (path)
device = model.get_value(iter, 1)
self.device = device
self.lblNPDeviceDescription.set_text ('')

View File

@ -1,93 +0,0 @@
diff -up system-config-printer-1.1.12/jobviewer.py.icon-load-traceback system-config-printer-1.1.12/jobviewer.py
--- system-config-printer-1.1.12/jobviewer.py.icon-load-traceback 2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/jobviewer.py 2009-08-26 17:46:06.744314174 +0100
@@ -1033,18 +1033,20 @@ class JobViewer (GtkGUI, monitor.Watcher
# Add an emblem to the icon.
icon = StateReason.LEVEL_ICON[level]
pixbuf = pixbuf.copy ()
- theme = gtk.icon_theme_get_default ()
-
- emblem = theme.load_icon (icon, 22, 0)
- emblem.composite (pixbuf,
- pixbuf.get_width () / 2,
- pixbuf.get_height () / 2,
- emblem.get_width () / 2,
- emblem.get_height () / 2,
- pixbuf.get_width () / 2,
- pixbuf.get_height () / 2,
- 0.5, 0.5,
- gtk.gdk.INTERP_BILINEAR, 255)
+ try:
+ theme = gtk.icon_theme_get_default ()
+ emblem = theme.load_icon (icon, 22, 0)
+ emblem.composite (pixbuf,
+ pixbuf.get_width () / 2,
+ pixbuf.get_height () / 2,
+ emblem.get_width () / 2,
+ emblem.get_height () / 2,
+ pixbuf.get_width () / 2,
+ pixbuf.get_height () / 2,
+ 0.5, 0.5,
+ gtk.gdk.INTERP_BILINEAR, 255)
+ except gobject.GError:
+ debugprint ("No %s icon available" % icon)
return pixbuf
diff -up system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.icon-load-traceback 2009-08-26 17:45:45.471190754 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-08-26 17:46:06.753314108 +0100
@@ -1469,28 +1469,34 @@ class GUI(GtkGUI, monitor.Watcher):
if def_emblem:
(w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
- default_emblem = theme.load_icon (def_emblem, w/2, 0)
- copy = pixbuf.copy ()
- default_emblem.composite (copy, 0, 0,
- copy.get_width (),
- copy.get_height (),
- 0, 0,
- 1.0, 1.0,
- gtk.gdk.INTERP_NEAREST, 255)
- pixbuf = copy
+ try:
+ default_emblem = theme.load_icon (def_emblem, w/2, 0)
+ copy = pixbuf.copy ()
+ default_emblem.composite (copy, 0, 0,
+ copy.get_width (),
+ copy.get_height (),
+ 0, 0,
+ 1.0, 1.0,
+ gtk.gdk.INTERP_NEAREST, 255)
+ pixbuf = copy
+ except gobject.GError:
+ debugprint ("No %s icon available" % def_emblem)
if emblem:
(w, h) = gtk.icon_size_lookup (gtk.ICON_SIZE_DIALOG)
- other_emblem = theme.load_icon (emblem, w/2, 0)
- copy = pixbuf.copy ()
- other_emblem.composite (copy, 0, 0,
- copy.get_width (),
- copy.get_height (),
- copy.get_width () / 2,
- copy.get_height () / 2,
- 1.0, 1.0,
- gtk.gdk.INTERP_NEAREST, 255)
- pixbuf = copy
+ try:
+ other_emblem = theme.load_icon (emblem, w/2, 0)
+ copy = pixbuf.copy ()
+ other_emblem.composite (copy, 0, 0,
+ copy.get_width (),
+ copy.get_height (),
+ copy.get_width () / 2,
+ copy.get_height () / 2,
+ 1.0, 1.0,
+ gtk.gdk.INTERP_NEAREST, 255)
+ pixbuf = copy
+ except gobject.GError:
+ debugprint ("No %s icon available" % emblem)
self.mainlist.append (row=[object, pixbuf, name, tip])

View File

@ -1,149 +0,0 @@
diff -up system-config-printer-1.1.12/authconn.py.polkit-1 system-config-printer-1.1.12/authconn.py
--- system-config-printer-1.1.12/authconn.py.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/authconn.py 2009-08-27 14:01:24.553275754 +0100
@@ -24,6 +24,7 @@ import gobject
import gtk
import os
from errordialogs import *
+import config
from debug import *
_ = lambda x: x
@@ -156,8 +157,11 @@ class Connection:
cups.setUser (self._use_user)
self._use_pk = ((self._server[0] == '/' or self._server == 'localhost')
- and not self._lock
and os.getuid () != 0)
+
+ if not config.WITH_POLKIT_1 and self._lock:
+ self._use_pk = False
+
if self._use_pk:
create_object = cupspk.Connection
else:
@@ -208,10 +212,6 @@ class Connection:
break
except cups.IPPError, (e, m):
if self._use_pk and m == 'pkcancel':
- title = _('Unauthorized request (%s)') % fname
- text = _("You are not authorized to carry out the "
- "requested action.")
- show_error_dialog (title, text, None)
raise cups.IPPError (0, _("Operation canceled"))
if not self._cancel and (e == cups.IPP_NOT_AUTHORIZED or
e == cups.IPP_FORBIDDEN):
diff -up system-config-printer-1.1.12/config.py.in.polkit-1 system-config-printer-1.1.12/config.py.in
--- system-config-printer-1.1.12/config.py.in.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/config.py.in 2009-08-27 14:01:24.555275419 +0100
@@ -24,3 +24,4 @@ localedir="@localedir@"
pkgdatadir="@datadir@/@PACKAGE@"
VERSION="@VERSION@"
PACKAGE="@PACKAGE@"
+WITH_POLKIT_1=@WITH_POLKIT_1@
diff -up system-config-printer-1.1.12/configure.in.polkit-1 system-config-printer-1.1.12/configure.in
--- system-config-printer-1.1.12/configure.in.polkit-1 2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/configure.in 2009-08-27 14:01:24.556275177 +0100
@@ -43,6 +43,17 @@ if test x$with_udev_rules != xno; then
AM_PROG_CC_C_O
fi
+AC_ARG_WITH(polkit-1,
+ [AC_HELP_STRING([--with-polkit-1],
+ [Enable support for polkit-1 @<:@default=no@:>@])],
+ [],
+ [with_polkit_1=no])
+WITH_POLKIT_1=False
+if test x$with_polkit_1 != xno; then
+ WITH_POLKIT_1=True
+fi
+AC_SUBST(WITH_POLKIT_1)
+
ALL_LINGUAS="ar as bg bn_IN bn bs ca cs cy da de el en_GB es et fa fi fr gu he hi hr hu hy id is it ja ka kn ko lo lv mai mk ml mr ms my nb nl nn or pa pl pt_BR pt ro ru si sk sl sr@latin sr sv ta te th tr uk vi zh_CN zh_TW"
AC_CONFIG_FILES([
Makefile
diff -up system-config-printer-1.1.12/cupspk.py.polkit-1 system-config-printer-1.1.12/cupspk.py
--- system-config-printer-1.1.12/cupspk.py.polkit-1 2009-08-25 15:01:40.000000000 +0100
+++ system-config-printer-1.1.12/cupspk.py 2009-08-27 14:01:24.558275639 +0100
@@ -34,6 +34,7 @@ import tempfile
import cups
import dbus
import gtk
+import config
from debug import debugprint
from dbus.mainloop.glib import DBusGMainLoop
@@ -221,8 +222,14 @@ class Connection:
return retval
break
except dbus.exceptions.DBusException, e:
- if not self._handle_exception_with_auth(e):
+ if config.WITH_POLKIT_1:
+ if e.get_dbus_name() == CUPS_PK_NEED_AUTH:
+ raise cups.IPPError(cups.IPP_NOT_AUTHORIZED, 'pkcancel')
+
break
+ else:
+ if not self._handle_exception_with_auth(e):
+ break
# The PolicyKit call did not work (either a PK-error and we got a dbus
# exception that wasn't handled, or an error in the mechanism itself)
diff -up system-config-printer-1.1.12/Makefile.am.polkit-1 system-config-printer-1.1.12/Makefile.am
--- system-config-printer-1.1.12/Makefile.am.polkit-1 2009-08-25 17:01:27.000000000 +0100
+++ system-config-printer-1.1.12/Makefile.am 2009-08-27 14:01:24.551276420 +0100
@@ -39,6 +39,7 @@ config.py: config.py.in Makefile
-e "s|\@localedir\@|$(localedir)|" \
-e "s|\@VERSION\@|$(VERSION)|" \
-e "s|\@PACKAGE\@|$(PACKAGE)|" \
+ -e "s|\@WITH_POLKIT_1\@|$(WITH_POLKIT_1)|" \
$< > $@
# Use distutils to build the module.
diff -up system-config-printer-1.1.12/system-config-printer.py.polkit-1 system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.polkit-1 2009-08-27 14:01:17.554275306 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-08-27 14:01:24.564275576 +0100
@@ -4620,19 +4620,32 @@ class NewPrinterGUI(GtkGUI):
self.WaitWindow.set_transient_for (parent)
self.WaitWindow.show_now ()
self.busy (self.WaitWindow)
- while gtk.events_pending ():
- gtk.main_iteration ()
- debugprint ("Fetching devices")
- self.mainapp.cups._begin_operation (_("fetching device list"))
- try:
- devices = cupshelpers.getDevices(self.mainapp.cups)
- except:
- self.mainapp.cups._end_operation ()
- self.WaitWindow.hide ()
- raise
+ if self.mainapp.cups._use_pk and config.WITH_POLKIT_1:
+ def get_devices():
+ c = authconn.Connection (host=self.mainapp.connect_server,
+ parent=parent, lock=True)
+ c._begin_operation (_("fetching device list"))
+ ret = cupshelpers.getDevices (c)
+ c._end_operation ()
+ return ret
+
+ op = TimedOperation (get_devices)
+ try:
+ devices = op.run ()
+ except (OperationCanceled, RuntimeError, cups.IPPError):
+ self.WaitWindow.hide ()
+ raise
+ else:
+ self.mainapp.cups._begin_operation (_("fetching device list"))
+ try:
+ devices = cupshelpers.getDevices (self.mainapp.cups)
+ self.mainapp.cups._end_operation ()
+ except cups.IPPError:
+ self.mainapp.cups._end_operation ()
+ self.WaitWindow.hide ()
+ raise
- self.mainapp.cups._end_operation ()
self.WaitWindow.hide ()
debugprint ("Got devices")
return devices

View File

@ -1,237 +0,0 @@
diff -up system-config-printer-1.1.12/ppdippstr.py.ppdippstr system-config-printer-1.1.12/ppdippstr.py
--- system-config-printer-1.1.12/ppdippstr.py.ppdippstr 2009-08-25 15:01:41.000000000 +0100
+++ system-config-printer-1.1.12/ppdippstr.py 2009-08-28 16:47:05.964949870 +0100
@@ -21,6 +21,11 @@
from gettext import gettext as _
+printer_error_policy = dict()
+printer_op_policy = dict()
+job_sheets = dict()
+ppd = dict()
+
class TranslationDict:
STR = {}
@@ -30,104 +35,111 @@ class TranslationDict:
def get (self, str):
return self.STR.get (str, str)
-## IPP strings
+def init ():
+ ## IPP strings
-# Names of printer error policies
-printer_error_policy = TranslationDict ({
- "abort-job": _("Abort job"),
- "retry-job": _("Retry job"),
- "stop-printer": _("Stop printer")
- })
+ # Names of printer error policies
+ global printer_error_policy
+ printer_error_policy = TranslationDict ({
+ "abort-job": _("Abort job"),
+ "retry-job": _("Retry job"),
+ "stop-printer": _("Stop printer")
+ })
-# Names of printer operation policies
-printer_op_policy = TranslationDict ({
- "default": _("Default behavior"),
- "authenticated": _("Authenticated")
- })
-
-# Names of banner pages.
-job_sheets = TranslationDict ({
- "none": _("None"),
- "classified": _("Classified"),
- "confidential": _("Confidential"),
- "secret": _("Secret"),
- "standard": _("Standard"),
- "topsecret": _("Top secret"),
- "unclassified": _("Unclassified")
- })
-
-## Common PPD strings
-
-# Foomatic strings
-
-# These are PPD option and group names and values.
-ppd = TranslationDict ({
- "General": _("General"),
-
- # HPIJS options
- "Printout Mode": _("Printout mode"),
- "Draft (auto-detect paper type)": _("Draft (auto-detect-paper type)"),
- "Draft Grayscale (auto-detect paper type)":
- _("Draft grayscale (auto-detect-paper type)"),
- "Normal (auto-detect paper type)": _("Normal (auto-detect-paper type)"),
- "Normal Grayscale (auto-detect paper type)":
- _("Normal grayscale (auto-detect-paper type)"),
- "High Quality (auto-detect paper type)":
- _("High quality (auto-detect-paper type)"),
- "High Quality Grayscale (auto-detect paper type)":
- _("High quality grayscale (auto-detect-paper type)"),
- "Photo (on photo paper)": _("Photo (on photo paper)"),
- "Best Quality (color on photo paper)":
- _("Best quality (color on photo paper)"),
- "Normal Quality (color on photo paper)":
- _("Normal quality (color on photo paper)"),
-
- "Media Source": _("Media source"),
- "Printer default": _("Printer default"),
- "Photo Tray": _("Photo tray"),
- "Upper Tray": _("Upper tray"),
- "Lower Tray": _("Lower tray"),
- "CD or DVD Tray": _("CD or DVD tray"),
- "Envelope Feeder": _("Envelope feeder"),
- "Large Capacity Tray": _("Large capacity tray"),
- "Manual Feeder": _("Manual feeder"),
- "Multi Purpose Tray": _("Multi-purpose tray"),
-
- "Page Size": _("Page size"),
- "Custom": _("Custom"),
- "Photo or 4x6 inch index card": _("Photo or 4x6 inch index card"),
- "Photo or 5x7 inch index card": _("Photo or 5x7 inch index card"),
- "Photo with tear-off tab": _("Photo with tear-off tab"),
- "3x5 inch index card": _("3x5 inch index card"),
- "5x8 inch index card": _("5x8 inch index card"),
- "A6 with tear-off tab": _("A6 with tear-off tab"),
- "CD or DVD 80 mm": _("CD or DVD 80mm"),
- "CD or DVD 120 mm": _("CD or DVD 120mm"),
-
- "Double-Sided Printing": _("Double-sided printing"),
- "Long Edge (Standard)": _("Long edge (standard)"),
- "Short Edge (Flip)": _("Short edge (flip)"),
- "Off": _("Off"),
-
- "Resolution, Quality, Ink Type, Media Type":
- _("Resolution, quality, ink type, media type"),
- "Controlled by 'Printout Mode'": _("Controlled by 'Printout mode'"),
- "300 dpi, Color, Black + Color Cartr.":
- _("300 dpi, color, black + color cartridge"),
- "300 dpi, Draft, Color, Black + Color Cartr.":
- _("300 dpi, draft, color, black + color cartridge"),
- "300 dpi, Draft, Grayscale, Black + Color Cartr.":
- _("300 dpi, draft, grayscale, black + color cartridge"),
- "300 dpi, Grayscale, Black + Color Cartr.":
- _("300 dpi, grayscale, black + color cartridge"),
- "600 dpi, Color, Black + Color Cartr.":
- _("600 dpi, color, black + color cartridge"),
- "600 dpi, Grayscale, Black + Color Cartr.":
- _("600 dpi, grayscale, black + color cartridge"),
- "600 dpi, Photo, Black + Color Cartr., Photo Paper":
- _("600 dpi, photo, black + color cartridge, photo paper"),
- "600 dpi, Color, Black + Color Cartr., Photo Paper, Normal":
- _("600 dpi, color, black + color cartridge, photo paper, normal"),
- "1200 dpi, Photo, Black + Color Cartr., Photo Paper":
- _("1200 dpi, photo, black + color cartridge, photo paper"),
- })
+ # Names of printer operation policies
+ global printer_op_policy
+ printer_op_policy = TranslationDict ({
+ "default": _("Default behavior"),
+ "authenticated": _("Authenticated")
+ })
+
+ # Names of banner pages.
+ global job_sheets
+ job_sheets = TranslationDict ({
+ "none": _("None"),
+ "classified": _("Classified"),
+ "confidential": _("Confidential"),
+ "secret": _("Secret"),
+ "standard": _("Standard"),
+ "topsecret": _("Top secret"),
+ "unclassified": _("Unclassified")
+ })
+
+ ## Common PPD strings
+
+ # Foomatic strings
+
+ # These are PPD option and group names and values.
+ global ppd
+ ppd = TranslationDict ({
+ "General": _("General"),
+
+ # HPIJS options
+ "Printout Mode": _("Printout mode"),
+ "Draft (auto-detect paper type)":
+ _("Draft (auto-detect-paper type)"),
+ "Draft Grayscale (auto-detect paper type)":
+ _("Draft grayscale (auto-detect-paper type)"),
+ "Normal (auto-detect paper type)":
+ _("Normal (auto-detect-paper type)"),
+ "Normal Grayscale (auto-detect paper type)":
+ _("Normal grayscale (auto-detect-paper type)"),
+ "High Quality (auto-detect paper type)":
+ _("High quality (auto-detect-paper type)"),
+ "High Quality Grayscale (auto-detect paper type)":
+ _("High quality grayscale (auto-detect-paper type)"),
+ "Photo (on photo paper)": _("Photo (on photo paper)"),
+ "Best Quality (color on photo paper)":
+ _("Best quality (color on photo paper)"),
+ "Normal Quality (color on photo paper)":
+ _("Normal quality (color on photo paper)"),
+
+ "Media Source": _("Media source"),
+ "Printer default": _("Printer default"),
+ "Photo Tray": _("Photo tray"),
+ "Upper Tray": _("Upper tray"),
+ "Lower Tray": _("Lower tray"),
+ "CD or DVD Tray": _("CD or DVD tray"),
+ "Envelope Feeder": _("Envelope feeder"),
+ "Large Capacity Tray": _("Large capacity tray"),
+ "Manual Feeder": _("Manual feeder"),
+ "Multi Purpose Tray": _("Multi-purpose tray"),
+
+ "Page Size": _("Page size"),
+ "Custom": _("Custom"),
+ "Photo or 4x6 inch index card": _("Photo or 4x6 inch index card"),
+ "Photo or 5x7 inch index card": _("Photo or 5x7 inch index card"),
+ "Photo with tear-off tab": _("Photo with tear-off tab"),
+ "3x5 inch index card": _("3x5 inch index card"),
+ "5x8 inch index card": _("5x8 inch index card"),
+ "A6 with tear-off tab": _("A6 with tear-off tab"),
+ "CD or DVD 80 mm": _("CD or DVD 80mm"),
+ "CD or DVD 120 mm": _("CD or DVD 120mm"),
+
+ "Double-Sided Printing": _("Double-sided printing"),
+ "Long Edge (Standard)": _("Long edge (standard)"),
+ "Short Edge (Flip)": _("Short edge (flip)"),
+ "Off": _("Off"),
+
+ "Resolution, Quality, Ink Type, Media Type":
+ _("Resolution, quality, ink type, media type"),
+ "Controlled by 'Printout Mode'": _("Controlled by 'Printout mode'"),
+ "300 dpi, Color, Black + Color Cartr.":
+ _("300 dpi, color, black + color cartridge"),
+ "300 dpi, Draft, Color, Black + Color Cartr.":
+ _("300 dpi, draft, color, black + color cartridge"),
+ "300 dpi, Draft, Grayscale, Black + Color Cartr.":
+ _("300 dpi, draft, grayscale, black + color cartridge"),
+ "300 dpi, Grayscale, Black + Color Cartr.":
+ _("300 dpi, grayscale, black + color cartridge"),
+ "600 dpi, Color, Black + Color Cartr.":
+ _("600 dpi, color, black + color cartridge"),
+ "600 dpi, Grayscale, Black + Color Cartr.":
+ _("600 dpi, grayscale, black + color cartridge"),
+ "600 dpi, Photo, Black + Color Cartr., Photo Paper":
+ _("600 dpi, photo, black + color cartridge, photo paper"),
+ "600 dpi, Color, Black + Color Cartr., Photo Paper, Normal":
+ _("600 dpi, color, black + color cartridge, photo paper, normal"),
+ "1200 dpi, Photo, Black + Color Cartr., Photo Paper":
+ _("1200 dpi, photo, black + color cartridge, photo paper"),
+ })
diff -up system-config-printer-1.1.12/system-config-printer.py.ppdippstr system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.ppdippstr 2009-08-28 16:46:47.922947897 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-08-28 16:47:06.032823573 +0100
@@ -129,6 +129,7 @@ gettext.bindtextdomain (domain, config.l
gtk.glade.textdomain (domain)
gtk.glade.bindtextdomain (domain, config.localedir)
import ppdippstr
+ppdippstr.init ()
pkgdata = config.pkgdatadir
iconpath = os.path.join (pkgdata, 'icons/')
sys.path.append (pkgdata)

View File

@ -1,50 +0,0 @@
diff -up system-config-printer-1.1.12/jobviewer.py.proxy-auth system-config-printer-1.1.12/jobviewer.py
--- system-config-printer-1.1.12/jobviewer.py.proxy-auth 2009-08-28 16:40:54.624947867 +0100
+++ system-config-printer-1.1.12/jobviewer.py 2009-08-28 16:42:01.430823181 +0100
@@ -604,10 +604,8 @@ class JobViewer (GtkGUI, monitor.Watcher
else:
(serverport, rest) = urllib.splithost (rest)
(server, port) = urllib.splitnport (serverport)
- username = pwd.getpwuid (os.getuid ())[0]
keyring_attrs.update ({ "server": str (server.lower ()),
- "protocol": str (scheme),
- "user": str (username)})
+ "protocol": str (scheme)})
if job in self.authenticated_jobs:
# We've already tried to authenticate this job before.
@@ -656,19 +654,9 @@ class JobViewer (GtkGUI, monitor.Watcher
c._end_operation ()
nonfatalException ()
- self.display_auth_info_dialog (job)
-
- def on_auth_notification_closed (self, notification, reason=None):
- job = notification.get_data ('job-id')
- debugprint ("auth notification closed for job %s" % job)
- self.auth_notifications[job].set_data ('closed', True)
- del self.auth_notifications[job]
-
- def on_auth_notification_authenticate (self, notification, action):
- job = notification.get_data ('job-id')
- keyring_attrs = notification.get_data ('keyring-attrs')
- debugprint ("auth notification authenticate for job %s" % job)
- self.display_auth_info_dialog (job, keyring_attrs)
+ username = pwd.getpwuid (os.getuid ())[0]
+ keyring_attrs["user"] = str (username)
+ self.display_auth_info_dialog (job, keyring_attrs)
def display_auth_info_dialog (self, job, keyring_attrs=None):
data = self.jobs[job]
@@ -759,8 +747,9 @@ class JobViewer (GtkGUI, monitor.Watcher
attrs.get ("protocol"))
ind = auth_info_required.index ('password')
secret = auth_info[ind]
- gnomekeyring.item_create_sync (keyring, type, name,
- attrs, secret, True)
+ id = gnomekeyring.item_create_sync (keyring, type, name,
+ attrs, secret, True)
+ debugprint ("keyring: created id %d for %s" % (id, name))
except:
nonfatalException ()

View File

@ -1,24 +0,0 @@
diff -up system-config-printer-1.1.12/system-config-printer.py.raw-device-change system-config-printer-1.1.12/system-config-printer.py
--- system-config-printer-1.1.12/system-config-printer.py.raw-device-change 2009-09-03 17:30:31.792304116 +0100
+++ system-config-printer-1.1.12/system-config-printer.py 2009-09-03 17:30:33.364303189 +0100
@@ -1906,16 +1906,16 @@ class GUI(GtkGUI, monitor.Watcher):
# set buttons sensitivity
def setDataButtonState(self):
- try: # Might not be a printer selected
+ try:
possible = (self.ppd and
not bool (self.changed) and
self.printer.enabled and
not self.printer.rejecting)
- for button in [self.btnPrintTestPage,
- self.btnChangePPD,
+ self.btnPrintTestPage.set_sensitive (possible)
+ for button in [self.btnChangePPD,
self.btnSelectDevice]:
- button.set_sensitive (possible)
+ button.set_sensitive (not bool (self.changed))
commands = (self.printer.type & cups.CUPS_PRINTER_COMMANDS) != 0
self.btnSelfTest.set_sensitive (commands and possible)

View File

@ -1,16 +0,0 @@
diff -up system-config-printer-1.1.12/statereason.py.statereason-icons system-config-printer-1.1.12/statereason.py
--- system-config-printer-1.1.12/statereason.py.statereason-icons 2009-08-25 17:01:28.000000000 +0100
+++ system-config-printer-1.1.12/statereason.py 2009-08-26 17:43:19.368314303 +0100
@@ -28,9 +28,9 @@ class StateReason:
ERROR=3
LEVEL_ICON={
- REPORT: "info",
- WARNING: "important",
- ERROR: "error"
+ REPORT: "dialog-info",
+ WARNING: "dialog-warning",
+ ERROR: "dialog-error"
}
def __init__(self, printer, reason):

View File

@ -6,22 +6,14 @@
Summary: A printer administration tool
Name: system-config-printer
Version: 1.1.12
Release: 8%{?dist}
Version: 1.1.13
Release: 1%{?dist}
License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base
Source0: http://cyberelk.net/tim/data/system-config-printer/1.1/system-config-printer-%{version}.tar.xz
Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
Patch1: system-config-printer-get_cursor.patch
Patch2: system-config-printer-statereason-icons.patch
Patch3: system-config-printer-icon-load-traceback.patch
Patch4: system-config-printer-polkit-1.patch
Patch5: system-config-printer-proxy-auth.patch
Patch6: system-config-printer-ppdippstr.patch
Patch7: system-config-printer-raw-device-change.patch
Patch8: system-config-printer-get-devices.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4
@ -32,7 +24,6 @@ BuildRequires: intltool
BuildRequires: libusb-devel, libudev-devel
BuildRequires: xmlto
BuildRequires: epydoc
BuildRequires: automake, autoconf
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -83,19 +74,8 @@ printers.
%prep
%setup -q -a 1 -a 2
%patch1 -p1 -b .get_cursor
%patch2 -p1 -b .statereason-icons
%patch3 -p1 -b .icon-load-traceback
%patch4 -p1 -b .polkit-1
%patch5 -p1 -b .proxy-auth
%patch6 -p1 -b .ppdippstr
%patch7 -p1 -b .raw-device-change
%patch8 -p1 -b .get-devices
%build
aclocal
automake --copy --add-missing
autoconf
%configure --with-udev-rules --with-polkit-1
pushd pycups-%{pycups_version}
@ -205,6 +185,10 @@ rm -rf %buildroot
exit 0
%changelog
* Mon Sep 14 2009 Tim Waugh <twaugh@redhat.com> 1.1.13-1
- 1.1.13:
- Translation updates (bug #522451).
* Fri Sep 4 2009 Tim Waugh <twaugh@redhat.com> 1.1.12-8
- Further speed improvement when fetching devices.