rpms/system-config-printer/F-9 system-config-printer-0.7.82.x.patch, 1.3, 1.4 system-config-printer.spec, 1.177, 1.178

Tim Waugh (twaugh) fedora-extras-commits at redhat.com
Tue Apr 15 11:09:14 UTC 2008


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv24548

Modified Files:
	system-config-printer.spec 
Added Files:
	system-config-printer-0.7.82.x.patch 
Log Message:
* Thu Apr 15 2008 Tim Waugh <twaugh at redhat.com> 0.7.82.2-2
- Some fixes from upstream:
  - Mark bad pt translation fuzzy.
  - applet: prevent duplicate error notifications (bug #442491).
  - applet: don't check for errors when starting.
  - my-default-printer: Prevent traceback (Ubuntu #214579).
  - main app: make the About dialog appear in the right place.


system-config-printer-0.7.82.x.patch:

Index: system-config-printer-0.7.82.x.patch
===================================================================
RCS file: system-config-printer-0.7.82.x.patch
diff -N system-config-printer-0.7.82.x.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ system-config-printer-0.7.82.x.patch	15 Apr 2008 11:09:05 -0000	1.4
@@ -0,0 +1,344 @@
+diff -up system-config-printer-0.7.82.2/po/pt.po.0.7.82.x system-config-printer-0.7.82.2/po/pt.po
+--- system-config-printer-0.7.82.2/po/pt.po.0.7.82.x	2008-04-03 13:22:58.000000000 +0100
++++ system-config-printer-0.7.82.2/po/pt.po	2008-04-15 11:41:40.000000000 +0100
+@@ -1659,7 +1659,7 @@ msgid "Ink low"
+ msgstr "Tinteiro insuficiente"
+ 
+ #: ../statereason.py:86
+-#, python-format
++#, fuzzy, python-format
+ msgid "Printer '%s' is low on ink."
+ msgstr "A impressora está com níveis insuficientes de tinteiros."
+ 
+diff -U0 system-config-printer-0.7.82.2/ChangeLog.0.7.82.x system-config-printer-0.7.82.2/ChangeLog
+--- system-config-printer-0.7.82.2/ChangeLog.0.7.82.x	2008-04-03 13:22:04.000000000 +0100
++++ system-config-printer-0.7.82.2/ChangeLog	2008-04-15 11:41:40.000000000 +0100
+@@ -0,0 +1,37 @@
++2008-04-15  Tim Waugh  <twaugh at redhat.com>
++
++	* po/pt.po: Mark bad translation fuzzy.
++
++	* applet.py (cached_printer_state_reasons): New global.
++	(collect_printer_state_reasons): Use cached state reason objects
++	for better notification behaviour.
++	(JobManager.get_notifications): Likewise.
++	(JobManager.check_state_reasons): Check user_notified attribute
++	(bug #442491).
++	(JobManager.check_state_reasons): Fix timer period.
++
++2008-04-13  Tim Waugh  <twaugh at redhat.com>
++
++	* statereason.py (StateReason.get_description): Don't crash on
++	incorrect translations (Ubuntu #214732).
++
++2008-04-11  Tim Waugh  <twaugh at redhat.com>
++
++	* applet.py (NewPrinterNotification.any_jobs): Don't check for
++	errors.
++	(WaitForJobs.handle_dbus_signal): New method.
++	(WaitForJobs): Better deferral.
++
++2008-04-09  Tim Waugh  <twaugh at redhat.com>
++
++	* my-default-printer.py (Dialog.selection_changed): New method.
++	Prevent selected item being de-selected.
++	(Dialog.__init__): Connect TreeSelection changed signal to
++	selection_changed method.
++	This fixes Ubuntu #214579.
++
++2008-04-08  Tim Waugh  <twaugh at redhat.com>
++
++	* system-config-printer.py (GUI.on_about_activate): Make the About
++	dialog appear in the right place.
++
+diff -up system-config-printer-0.7.82.2/applet.py.0.7.82.x system-config-printer-0.7.82.2/applet.py
+--- system-config-printer-0.7.82.2/applet.py.0.7.82.x	2008-04-03 13:22:04.000000000 +0100
++++ system-config-printer-0.7.82.2/applet.py	2008-04-15 11:41:40.000000000 +0100
+@@ -48,6 +48,9 @@ def state_reason_is_harmless (reason):
+         return True
+     return False
+ 
++global cached_printer_state_reasons
++cached_printer_state_reasons = {} # indexed by printer, then by reason
++
+ def collect_printer_state_reasons (connection):
+     result = {}
+     printers = connection.getPrinters ()
+@@ -63,7 +66,21 @@ def collect_printer_state_reasons (conne
+                 continue
+             if not result.has_key (name):
+                 result[name] = []
+-            result[name].append (StateReason (name, reason))
++
++            try:
++                r = cached_printer_state_reasons[name][reason]
++            except KeyError:
++                r = StateReason (name, reason)
++                r.user_notified = False
++
++            result[name].append (r)
++
++        try:
++            cached_printer_state_reasons[name] = {}
++            for r in result[name]:
++                cached_printer_state_reasons[name][r.get_reason ()] = r
++        except KeyError:
++            pass
+     return result
+ 
+ def worst_printer_state_reason (printer_reasons=None, connection=None):
+@@ -329,6 +346,7 @@ class JobManager:
+ 
+     def check_still_connecting(self):
+         """Timer callback to check on connecting-to-device reasons."""
++        debugprint ("still-connecting timer fired")
+         if self.update_connecting_devices ():
+             self.get_notifications ()
+ 
+@@ -373,7 +391,6 @@ class JobManager:
+ 
+     def check_state_reasons(self, my_printers=set(), printer_jobs={}):
+         # Look for any new reasons since we last checked.
+-        old_reasons_seen_keys = self.reasons_seen.keys ()
+         reasons_now = set()
+         need_recheck = False
+         for printer, reasons in self.printer_state_reasons.iteritems ():
+@@ -398,7 +415,8 @@ class JobManager:
+ 
+         if need_recheck:
+             # Check on them again in a minute's time.
+-            gobject.timeout_add (CONNECTING_TIMEOUT * 1000,
++            debugprint ("still-connecting timer started")
++            gobject.timeout_add ((1 + CONNECTING_TIMEOUT) * 1000,
+                                  self.check_still_connecting)
+ 
+         self.update_connecting_devices ()
+@@ -476,45 +494,42 @@ class JobManager:
+                         break
+ 
+                 if have_processing_job:
+-                    # This will be in our list of reasons we've already seen,
+-                    # which ordinarily stops us notifying the user.  In this
+-                    # case, pretend we haven't seen it before.
+                     self.still_connecting.add (printer)
+-                    old_reasons_seen_keys.remove (reason.get_tuple ())
+-                    reason = StateReason (printer,
+-                                          reason.get_reason () + "-error")
+ 
+         if (self.trayicon and reason != None and
+-            reason.get_level () >= StateReason.WARNING):
+-            if not reason.get_tuple () in old_reasons_seen_keys:
+-                level = reason.get_level ()
+-                if level == StateReason.WARNING:
+-                    notify_urgency = pynotify.URGENCY_LOW
+-                    timeout = pynotify.EXPIRES_DEFAULT
+-                else:
+-                    notify_urgency = pynotify.URGENCY_NORMAL
+-                    timeout = pynotify.EXPIRES_NEVER
++            (not reason.user_notified) and
++            (reason.get_level () >= StateReason.WARNING or
++             (reason.get_reason () == 'connecting-to-device' and
++              reason.get_printer () in self.still_connecting))):
++            reason.user_notified = True
++            level = reason.get_level ()
++            if level == StateReason.WARNING:
++                notify_urgency = pynotify.URGENCY_LOW
++                timeout = pynotify.EXPIRES_DEFAULT
++            else:
++                notify_urgency = pynotify.URGENCY_NORMAL
++                timeout = pynotify.EXPIRES_NEVER
+ 
+-                (title, text) = reason.get_description ()
++            (title, text) = reason.get_description ()
+ 
+-                if self.notify:
+-                    self.notify.close ()
+-                self.notify = pynotify.Notification (title, text, 'printer')
+-                self.set_statusicon_visibility ()
+-                # Let the icon show itself, ready for the notification
+-                while gtk.events_pending ():
+-                    gtk.main_iteration ()
+-
+-                self.notify.attach_to_status_icon (self.statusicon)
+-
+-                while gtk.events_pending ():
+-                    gtk.main_iteration ()
+-
+-                self.notify.set_urgency (notify_urgency)
+-                self.notify.set_timeout (timeout)
+-                self.notify.connect ('closed', self.on_notification_closed)
+-                self.notify.show ()
+-                self.notified_reason = reason
++            if self.notify:
++                self.notify.close ()
++            self.notify = pynotify.Notification (title, text, 'printer')
++            self.set_statusicon_visibility ()
++            # Let the icon show itself, ready for the notification
++            while gtk.events_pending ():
++                gtk.main_iteration ()
++
++            self.notify.attach_to_status_icon (self.statusicon)
++
++            while gtk.events_pending ():
++                gtk.main_iteration ()
++
++            self.notify.set_urgency (notify_urgency)
++            self.notify.set_timeout (timeout)
++            self.notify.connect ('closed', self.on_notification_closed)
++            self.notify.show ()
++            self.notified_reason = reason
+ 
+     def on_notification_closed(self, notify):
+         self.notify = None
+@@ -647,7 +662,17 @@ class JobManager:
+                             break
+                         if state_reason_is_harmless (reason):
+                             continue
+-                        reasons.append (StateReason (name, reason))
++                        try:
++                            r = cached_printer_state_reasons[name][reason]
++                        except KeyError:
++                            r = StateReason (name, reason)
++                            r.user_notified = False
++
++                        reasons.append (r)
++
++                    cached_printer_state_reasons[name] = {}
++                    for r in reasons:
++                        cached_printer_state_reasons[name][r.get_reason ()] = r
+                     self.printer_state_reasons[name] = reasons
+                 continue
+ 
+@@ -752,6 +777,8 @@ class JobManager:
+ 
+         self.update (jobs)
+         self.jobs = jobs
++
++        debugprint (cached_printer_state_reasons)
+         return False
+ 
+     def refresh(self):
+@@ -1255,56 +1282,45 @@ if trayicon:
+               PROGRAM_NAME
+ 
+ if trayicon:
+-    # Start off just waiting for print jobs or printer errors.
+-    def any_jobs_or_errors ():
++    # Start off just waiting for print jobs.
++    def any_jobs ():
+         try:
+             c = cups.Connection ()
+             if len (c.getJobs (my_jobs=True)):
+                 return True
+-            reason = worst_printer_state_reason (connection=c)
+-            if reason != None and reason.get_level () >= StateReason.WARNING:
+-                return True
+         except:
+             pass
+ 
+         return False
+ 
+-    if not any_jobs_or_errors ():
++    if not any_jobs ():
+ 
+         ###
+         class WaitForJobs:
+-            MIN_CHECK_INTERVAL=5 # seconds
+-
+             def __init__ (self):
+-                self.last_check = time.time()
+                 self.timer = None
+ 
+-            def check_for_jobs (self, *args):
+-                now = time.time ()
+-                since_last_check = now - self.last_check
+-                if since_last_check < self.MIN_CHECK_INTERVAL:
+-                    if self.timer != None:
+-                        return
+-
+-                    self.timer = gobject.timeout_add (self.MIN_CHECK_INTERVAL *
+-                                                      1000,
+-                                                      self.check_for_jobs)
+-                    return
++            def handle_dbus_signal (self, *args):
++                if self.timer:
++                    gobject.source_remove (self.timer)
++                self.timer = gobject.timeout_add (200, self.check_for_jobs)
+ 
+-                self.timer = None
+-                self.last_check = now
+-                if any_jobs_or_errors ():
++            def check_for_jobs (self, *args):
++                if any_jobs ():
+                     waitloop.quit ()
++
++                # Don't run this timer again.
++                return False
+         ###
+ 
+         jobwaiter = WaitForJobs()
+-        bus.add_signal_receiver (jobwaiter.check_for_jobs,
++        bus.add_signal_receiver (jobwaiter.handle_dbus_signal,
+                                  path="/com/redhat/PrinterSpooler",
+                                  dbus_interface="com.redhat.PrinterSpooler")
+         waitloop = gobject.MainLoop ()
+         waitloop.run()
+         waitloop = None
+-        bus.remove_signal_receiver (jobwaiter.check_for_jobs,
++        bus.remove_signal_receiver (jobwaiter.handle_dbus_signal,
+                                     path="/com/redhat/PrinterSpooler",
+                                     dbus_interface="com.redhat.PrinterSpooler")
+ 
+diff -up system-config-printer-0.7.82.2/my-default-printer.py.0.7.82.x system-config-printer-0.7.82.2/my-default-printer.py
+--- system-config-printer-0.7.82.2/my-default-printer.py.0.7.82.x	2008-04-03 13:22:04.000000000 +0100
++++ system-config-printer-0.7.82.2/my-default-printer.py	2008-04-15 11:41:40.000000000 +0100
+@@ -160,6 +160,8 @@ class Dialog:
+         view.append_column (col)
+         self.view = view
+ 
++        view.get_selection ().connect ('changed', self.selection_changed)
++
+         scrollwin = gtk.ScrolledWindow ()
+         scrollwin.set_shadow_type (gtk.SHADOW_IN)
+         scrollwin.set_policy (gtk.POLICY_AUTOMATIC,
+@@ -176,6 +178,13 @@ class Dialog:
+             elif button.get_label () == _("_Set Default"):
+                 self.set_default_button = button
+ 
++    def selection_changed (self, selection):
++        (model, iter) = selection.get_selected ()
++        if iter:
++            self.last_iter_selected = iter
++        else:
++            selection.select_iter (self.last_iter_selected)
++
+     def run (self):
+         c = cups.Connection ()
+         printers = c.getPrinters ()
+diff -up system-config-printer-0.7.82.2/system-config-printer.py.0.7.82.x system-config-printer-0.7.82.2/system-config-printer.py
+--- system-config-printer-0.7.82.2/system-config-printer.py.0.7.82.x	2008-04-03 13:22:04.000000000 +0100
++++ system-config-printer-0.7.82.2/system-config-printer.py	2008-04-15 11:41:40.000000000 +0100
+@@ -2127,6 +2127,7 @@ class GUI(GtkGUI):
+ 
+     # About dialog
+     def on_about_activate(self, widget):
++        self.AboutDialog.set_transient_for (self.MainWindow)
+         self.AboutDialog.run()
+         self.AboutDialog.hide()
+ 
+diff -up system-config-printer-0.7.82.2/statereason.py.0.7.82.x system-config-printer-0.7.82.2/statereason.py
+--- system-config-printer-0.7.82.2/statereason.py.0.7.82.x	2008-04-03 13:22:04.000000000 +0100
++++ system-config-printer-0.7.82.2/statereason.py	2008-04-15 11:41:40.000000000 +0100
+@@ -95,7 +95,11 @@ class StateReason:
+             }
+         try:
+             (title, text) = messages[self.get_reason ()]
+-            text = text % self.get_printer ()
++            try:
++                text = text % self.get_printer ()
++            except TypeError:
++                # Probably an incorrect translation, missing a '%s'.
++                pass
+         except KeyError:
+             if self.get_level () == self.REPORT:
+                 title = _("Printer report")


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-9/system-config-printer.spec,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -r1.177 -r1.178
--- system-config-printer.spec	3 Apr 2008 13:46:34 -0000	1.177
+++ system-config-printer.spec	15 Apr 2008 11:09:05 -0000	1.178
@@ -5,7 +5,7 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 0.7.82.2
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
@@ -13,6 +13,7 @@
 Source1: pycups-%{pycups_version}.tar.bz2
 Source2: system-config-printer.pam
 Source3: system-config-printer.console
+Patch1: system-config-printer-0.7.82.x.patch
 
 BuildRequires: cups-devel >= 1.2
 BuildRequires: python-devel >= 2.4
@@ -57,6 +58,7 @@
 
 %prep
 %setup -q -a 1
+%patch1 -p1 -b .0.7.82.x
 
 %build
 %configure
@@ -131,6 +133,14 @@
 exit 0
 
 %changelog
+* Thu Apr 15 2008 Tim Waugh <twaugh at redhat.com> 0.7.82.2-2
+- Some fixes from upstream:
+  - Mark bad pt translation fuzzy.
+  - applet: prevent duplicate error notifications (bug #442491).
+  - applet: don't check for errors when starting.
+  - my-default-printer: Prevent traceback (Ubuntu #214579).
+  - main app: make the About dialog appear in the right place.
+
 * Thu Apr  3 2008 Tim Waugh <twaugh at redhat.com> 0.7.82.2-1
 - 0.7.82.2:
   - Various bug fixes.




More information about the fedora-extras-commits mailing list