- Updated cupspk DevicesGet call for accepted API.

This commit is contained in:
Tim Waugh 2009-08-13 16:40:49 +00:00
parent b35ea25ec2
commit f5f3846376
2 changed files with 29 additions and 5 deletions

View File

@ -1,7 +1,7 @@
diff -up system-config-printer-1.1.11/cupspk.py.getdevices system-config-printer-1.1.11/cupspk.py diff -up system-config-printer-1.1.11/cupspk.py.getdevices system-config-printer-1.1.11/cupspk.py
--- system-config-printer-1.1.11/cupspk.py.getdevices 2009-08-05 11:33:24.000000000 +0100 --- system-config-printer-1.1.11/cupspk.py.getdevices 2009-08-05 11:33:24.000000000 +0100
+++ system-config-printer-1.1.11/cupspk.py 2009-08-07 18:05:45.528421465 +0100 +++ system-config-printer-1.1.11/cupspk.py 2009-08-13 17:39:34.251284301 +0100
@@ -300,7 +300,53 @@ class Connection: @@ -300,7 +300,74 @@ class Connection:
# getPPDs # getPPDs
# getServerPPD # getServerPPD
# getDocument # getDocument
@ -10,13 +10,34 @@ diff -up system-config-printer-1.1.11/cupspk.py.getdevices system-config-printer
+ +
+ def getDevices(self, *args, **kwds): + def getDevices(self, *args, **kwds):
+ use_pycups = False + use_pycups = False
+ pk_args = () +
+ timeout = 0
+ include_schemes = ''
+ exclude_schemes = ''
+
+ if len(args) == 3:
+ (use_pycups, timeout, include_schemes, exclude_schemes) = self._args_to_tuple([int, str, str], *args)
+ else:
+ if kwds.has_key('timeout'):
+ timeout = kwds['timeout']
+
+ if kwds.has_key('include_schemes'):
+ include_schemes = kwds['include_schemes']
+
+ if kwds.has_key('exclude_schemes'):
+ exclude_schemes = kwds['exclude_schemes']
+
+ pk_args = (timeout, include_schemes, exclude_schemes)
+ +
+ result = self._call_with_pk_and_fallback(use_pycups, + result = self._call_with_pk_and_fallback(use_pycups,
+ 'DevicesGet', pk_args, + 'DevicesGet', pk_args,
+ self._connection.getDevices, + self._connection.getDevices,
+ *args, **kwds) + *args, **kwds)
+ +
+ # return 'result' if fallback was called
+ if len (result.keys()) > 0 and type (result[result.keys()[0]]) == dict:
+ return result
+
+ result_str = {} + result_str = {}
+ if result != None: + if result != None:
+ for i in result.keys(): + for i in result.keys():
@ -37,7 +58,7 @@ diff -up system-config-printer-1.1.11/cupspk.py.getdevices system-config-printer
+ device_uri = None + device_uri = None
+ device_dict = {} + device_dict = {}
+ for i in device_keys: + for i in device_keys:
+ key = i[:len(i)-len(postfix)] + key = i[:len(i) - len(postfix)]
+ if key != 'device-uri': + if key != 'device-uri':
+ device_dict[key] = result_str[i] + device_dict[key] = result_str[i]
+ else: + else:

View File

@ -7,7 +7,7 @@
Summary: A printer administration tool Summary: A printer administration tool
Name: system-config-printer Name: system-config-printer
Version: 1.1.11 Version: 1.1.11
Release: 1%{?dist} Release: 2%{?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
@ -183,6 +183,9 @@ rm -rf %buildroot
exit 0 exit 0
%changelog %changelog
* Thu Aug 13 2009 Tim Waugh <twaugh@redhat.com> 1.1.11-2
- Updated cupspk DevicesGet call for accepted API.
* Fri Aug 7 2009 Tim Waugh <twaugh@redhat.com> 1.1.11-1 * Fri Aug 7 2009 Tim Waugh <twaugh@redhat.com> 1.1.11-1
- 1.1.11: - 1.1.11:
- Several udev-configure-printer fixes. - Several udev-configure-printer fixes.