rpms/system-config-printer/F-11 system-config-printer-get-devices.patch, 1.1, 1.2 system-config-printer.spec, 1.282, 1.283

Tim Waugh twaugh at fedoraproject.org
Fri Sep 4 10:12:44 UTC 2009


Author: twaugh

Update of /cvs/pkgs/rpms/system-config-printer/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv10943

Modified Files:
	system-config-printer-get-devices.patch 
	system-config-printer.spec 
Log Message:
* Fri Sep  4 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-8
- Further speed improvement when fetching devices.


system-config-printer-get-devices.patch:
 cupshelpers/cupshelpers.py |    4 
 cupspk.py                  |   18 +++
 gtkspinner.py              |    2 
 system-config-printer.py   |  205 ++++++++++++++++++++++++++++++---------------
 timedops.py                |   38 ++++++--
 5 files changed, 188 insertions(+), 79 deletions(-)

Index: system-config-printer-get-devices.patch
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-11/system-config-printer-get-devices.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -r1.1 -r1.2
--- system-config-printer-get-devices.patch	3 Sep 2009 16:48:08 -0000	1.1
+++ system-config-printer-get-devices.patch	4 Sep 2009 10:12:44 -0000	1.2
@@ -1,6 +1,6 @@
 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-03 17:40:01.312306795 +0100
++++ system-config-printer-1.1.12/cupshelpers/cupshelpers.py	2009-09-04 10:41:43.122388349 +0100
 @@ -541,7 +541,7 @@ class Device:
          
          return result
@@ -21,7 +21,7 @@ diff -up system-config-printer-1.1.12/cu
          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-08-25 15:01:40.000000000 +0100
-+++ system-config-printer-1.1.12/cupspk.py	2009-09-03 17:39:54.649306311 +0100
++++ system-config-printer-1.1.12/cupspk.py	2009-09-04 10:41:43.125389269 +0100
 @@ -304,12 +304,13 @@ class Connection:
      def getDevices(self, *args, **kwds):
          use_pycups = False
@@ -59,7 +59,7 @@ diff -up system-config-printer-1.1.12/cu
          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-03 17:40:15.558428680 +0100
++++ system-config-printer-1.1.12/gtkspinner.py	2009-09-04 10:41:43.126388753 +0100
 @@ -65,7 +65,7 @@ class Spinner:
      def _next_frame (self):
          n = self._current_frame + 1
@@ -70,8 +70,8 @@ diff -up system-config-printer-1.1.12/gt
          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-03 17:39:28.893432444 +0100
-+++ system-config-printer-1.1.12/system-config-printer.py	2009-09-03 17:42:09.536304232 +0100
+--- system-config-printer-1.1.12/system-config-printer.py.get-devices	2009-09-04 10:41:43.112387975 +0100
++++ system-config-printer-1.1.12/system-config-printer.py	2009-09-04 10:41:50.189513008 +0100
 @@ -3681,6 +3681,7 @@ class NewPrinterGUI(GtkGUI):
          self.ntbkNPDownloadableDriverProperties.set_show_tabs(False)
  
@@ -80,15 +80,7 @@ diff -up system-config-printer-1.1.12/sy
  
          # Set up OpenPrinting widgets.
          self.openprinting = cupshelpers.openprinting.OpenPrinting ()
-@@ -3716,6 +3717,7 @@ class NewPrinterGUI(GtkGUI):
-         slct.set_select_function (self.device_select_function)
-         self.tvNPDevices.set_row_separator_func (self.device_row_separator_fn)
-         self.tvNPDevices.connect ("row-activated", self.device_row_activated)
-+        self.tvNPDevices.connect ("row-expanded", self.device_row_expanded)
- 
-         # Devices expander
-         self.expNPDeviceURIs.connect ("notify::expanded",
-@@ -3765,6 +3767,19 @@ class NewPrinterGUI(GtkGUI):
+@@ -3765,6 +3766,19 @@ class NewPrinterGUI(GtkGUI):
          ppd_filter.add_pattern("*")
          self.filechooserPPD.add_filter(ppd_filter)
  
@@ -108,7 +100,18 @@ diff -up system-config-printer-1.1.12/sy
      def show_IPP_Error (self, exception, message):
          return show_IPP_Error (exception, message, parent=self.NewPrinterWindow)
  
-@@ -4611,32 +4626,48 @@ class NewPrinterGUI(GtkGUI):
+@@ -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,32 +4629,48 @@ class NewPrinterGUI(GtkGUI):
              self.btnNPForward.set_sensitive(
                  self.mainapp.checkNPName(new_text))
  
@@ -177,7 +180,7 @@ diff -up system-config-printer-1.1.12/sy
  
      def install_hplip_plugin(self, uri):
          """
-@@ -4949,23 +4980,53 @@ class NewPrinterGUI(GtkGUI):
+@@ -4949,23 +4983,66 @@ class NewPrinterGUI(GtkGUI):
          return (host, uri)
  
      def fillDeviceTab(self, current_uri=None):
@@ -215,13 +218,14 @@ diff -up system-config-printer-1.1.12/sy
 +        self.expNPDeviceURIs.hide ()
 +        self.inc_spinner_task ()
 +
-+        TimedOperation (self.fetchDevices,
-+                        kwargs={"network": False},
-+                        callback=self.got_devices,
-+                        context=current_uri)
++        self.fetchDevices_op = TimedOperation (self.fetchDevices,
++                                               kwargs={"network": False},
++                                               callback=self.got_devices,
++                                               context=(current_uri, False))
 +
-+    def got_devices (self, result, exception, current_uri=None):
++    def got_devices (self, result, exception, context):
 +        self.dec_spinner_task ()
++        (current_uri, network) = context
 +        if exception:
 +            try:
 +                raise exception
@@ -229,6 +233,18 @@ diff -up system-config-printer-1.1.12/sy
 +                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):
@@ -241,7 +257,7 @@ diff -up system-config-printer-1.1.12/sy
              else:
                  current = cupshelpers.Device (current_uri)
                  current.info = "Current device"
-@@ -5008,7 +5069,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5008,7 +5085,7 @@ class NewPrinterGUI(GtkGUI):
                                                   "hal", "beh",
                                                   "scsi", "http", "delete"),
                           devices)
@@ -250,7 +266,7 @@ diff -up system-config-printer-1.1.12/sy
          for device in devices:
              physicaldevice = PhysicalDevice (device)
              try:
-@@ -5016,43 +5077,32 @@ class NewPrinterGUI(GtkGUI):
+@@ -5016,43 +5093,32 @@ class NewPrinterGUI(GtkGUI):
                  self.devices[i].add_device (device)
              except ValueError:
                  self.devices.append (physicaldevice)
@@ -308,7 +324,7 @@ diff -up system-config-printer-1.1.12/sy
              if network:
                  if devs[0].uri != devs[0].type:
                      # An actual network printer device.  Put this at the top.
-@@ -5062,24 +5112,31 @@ class NewPrinterGUI(GtkGUI):
+@@ -5062,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.
@@ -329,10 +345,10 @@ diff -up system-config-printer-1.1.12/sy
 +                        break
 +
 +                    iter = model.iter_next (iter)
-+
-+                iter = model.insert_before (None, iter, row=row)
  
 -            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,
@@ -345,7 +361,7 @@ diff -up system-config-printer-1.1.12/sy
          connection_select_path = 0
          if current_uri:
              model = self.tvNPDeviceURIs.get_model ()
-@@ -5093,6 +5150,9 @@ class NewPrinterGUI(GtkGUI):
+@@ -5093,6 +5166,9 @@ class NewPrinterGUI(GtkGUI):
  
                  iter = model.iter_next (iter)
                  i += 1
@@ -355,21 +371,7 @@ diff -up system-config-printer-1.1.12/sy
  
          column = self.tvNPDeviceURIs.get_column (0)
          self.tvNPDeviceURIs.set_cursor (connection_select_path, column)
-@@ -5538,6 +5598,13 @@ class NewPrinterGUI(GtkGUI):
-         else:
-             view.expand_row (path, False)
- 
-+    def device_row_expanded (self, view, iter, path):
-+        if not self.devices_network_fetched:
-+            self.devices_network_fetched = True
-+            self.inc_spinner_task ()
-+            TimedOperation (self.fetchDevices, kwargs={'network': True},
-+                            callback=self.got_devices)
-+
-     def device_select_function (self, path):
-         """
-         Allow this path to be selected as long as there
-@@ -5552,6 +5619,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5552,6 +5628,7 @@ class NewPrinterGUI(GtkGUI):
          return False
  
      def on_tvNPDevices_cursor_changed(self, widget):
@@ -377,7 +379,7 @@ diff -up system-config-printer-1.1.12/sy
          path, column = widget.get_cursor ()
          if path == None:
              return
-@@ -5855,8 +5923,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5855,8 +5932,7 @@ class NewPrinterGUI(GtkGUI):
          self.network_found = 0
          self.lblNetworkFindSearching.show_all ()
          finder = probe_printer.PrinterFinder ()
@@ -387,7 +389,7 @@ diff -up system-config-printer-1.1.12/sy
          finder.find (host, found_callback)
  
      def found_network_printer_callback (self, new_device):
-@@ -5885,8 +5952,7 @@ class NewPrinterGUI(GtkGUI):
+@@ -5885,8 +5961,7 @@ class NewPrinterGUI(GtkGUI):
                  path = model.get_path (iter)
                  self.tvNPDevices.set_cursor (path)
          else:
@@ -399,8 +401,8 @@ diff -up system-config-printer-1.1.12/sy
              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-03 17:39:48.935433815 +0100
-@@ -152,16 +152,24 @@ class OperationThread(threading.Thread):
++++ system-config-printer-1.1.12/timedops.py	2009-09-04 10:41:50.191513591 +0100
+@@ -152,16 +152,25 @@ class OperationThread(threading.Thread):
  
  class TimedOperation(Timed):
      def __init__ (self, target, args=(), kwargs={}, parent=None,
@@ -416,17 +418,18 @@ diff -up system-config-printer-1.1.12/ti
                                         kwargs=kwargs)
          self.thread.start ()
  
-+        if self.callback:
++        self.use_callback = callback != None
++        if self.use_callback:
 +            self.timeout_source = gobject.timeout_add (50, self._check_thread)
 +
      def run (self):
-+        if self.callback:
++        if self.use_callback:
 +            raise RuntimeError
 +
          if self.show_dialog:
              wait = gtk.MessageDialog (self.parent,
                                        gtk.DIALOG_MODAL |
-@@ -170,7 +178,7 @@ class TimedOperation(Timed):
+@@ -170,7 +179,7 @@ class TimedOperation(Timed):
                                        gtk.BUTTONS_CANCEL,
                                        _("Please wait"))
              wait.connect ("delete_event", lambda *args: False)
@@ -435,7 +438,7 @@ diff -up system-config-printer-1.1.12/ti
              if self.parent:
                  wait.set_transient_for (self.parent)
  
-@@ -178,7 +186,7 @@ class TimedOperation(Timed):
+@@ -178,7 +187,7 @@ class TimedOperation(Timed):
              wait.format_secondary_text (_("Gathering information"))
              wait.show_all ()
  
@@ -444,7 +447,7 @@ diff -up system-config-printer-1.1.12/ti
          gtk.main ()
          gobject.source_remove (self.timeout_source)
          if self.show_dialog:
-@@ -186,20 +194,32 @@ class TimedOperation(Timed):
+@@ -186,20 +195,33 @@ class TimedOperation(Timed):
  
          return self.thread.collect_result ()
  
@@ -457,12 +460,13 @@ diff -up system-config-printer-1.1.12/ti
 -        # Thread has finished.  Stop the sub-loop.
 -        gtk.main_quit ()
 +        # Thread has finished.  Stop the sub-loop or trigger callback.
-+        if self.callback:
-+            if self.context != None:
-+                self.callback (self.thread.result, self.thread.exception,
-+                               self.context)
-+            else:
-+                self.callback (self.thread.result, self.thread.exception)
++        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 ()
 +
@@ -476,7 +480,7 @@ diff -up system-config-printer-1.1.12/ti
      def cancel (self):
          debugprint ("Command canceled")
 -        gtk.main_quit ()
-+        if self.callback:
++        if self.use_callback:
 +            self.callback = None
 +        else:
 +            gtk.main_quit ()


Index: system-config-printer.spec
===================================================================
RCS file: /cvs/pkgs/rpms/system-config-printer/F-11/system-config-printer.spec,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -p -r1.282 -r1.283
--- system-config-printer.spec	3 Sep 2009 16:48:08 -0000	1.282
+++ system-config-printer.spec	4 Sep 2009 10:12:44 -0000	1.283
@@ -7,7 +7,7 @@
 Summary: A printer administration tool
 Name: system-config-printer
 Version: 1.1.12
-Release: 7%{?dist}
+Release: 8%{?dist}
 License: GPLv2+
 URL: http://cyberelk.net/tim/software/system-config-printer/
 Group: System Environment/Base
@@ -177,6 +177,9 @@ rm -rf %buildroot
 exit 0
 
 %changelog
+* Fri Sep  4 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-8
+- Further speed improvement when fetching devices.
+
 * Thu Sep  3 2009 Tim Waugh <twaugh at redhat.com> 1.1.12-7
 - Speed improvement when fetching devices.
 - Allow raw devices to be changed.




More information about the fedora-extras-commits mailing list