All of lore.kernel.org
 help / color / mirror / Atom feed
From: Till Kamppeter <till.kamppeter@gmail.com>
To: Tim Waugh <twaugh@redhat.com>
Cc: printing-architecture@lists.linux-foundation.org,
	printing-japan@lists.linux-foundation.org,
	michael.vogt@ubuntu.com, martin.pitt@ubuntu.com
Subject: Re: [Printing-architecture] Ubuntu Natty the first distribution which does automatic download of binary printer driver packages
Date: Tue, 01 Mar 2011 22:06:29 +0100	[thread overview]
Message-ID: <4D6D5FD5.4010506@gmail.com> (raw)
In-Reply-To: <1298669202.5347.0.camel@worm.elk>

[-- Attachment #1: Type: text/plain, Size: 627 bytes --]

On 02/25/2011 10:26 PM, Tim Waugh wrote:
> On Fri, 2011-02-25 at 13:40 +0100, Till Kamppeter wrote:
>> Tim, is there a new way to test the driver selection and
>> automatic-download for a given device ID without needing to modify the
>> code of system-config-printer and without having the appropriate printer
>> physically? Or do I need to re-develop this feature?
>
> Use: python newprinter.py --with-uri URI
> (requires current git master... I'll do a 1.3.2 release in a week or so)

Unfortunately, this testing mode does not work. I have fixed it, 
including the possibility to supply device IDs. Patch attached.

    Till

[-- Attachment #2: 0001-Activated-and-fixed-testing-mode-for-device-ID-drive.patch --]
[-- Type: text/x-patch, Size: 4285 bytes --]

From dbf81b6ce20fa4270b5da3e89e7485e42773c23b Mon Sep 17 00:00:00 2001
From: Till Kamppeter <till.kamppeter@gmail.com>
Date: Tue, 1 Mar 2011 21:50:40 +0100
Subject: [PATCH] Activated and fixed testing mode for device ID/driver association

Currently, newprinter.py has only one testing mode to test the
complete wiozard setting up physically available printers. This did
not allow testing which driver gets associated to a printer with a
given device ID, for example if a user reports a bug about a wrong
driver being selected but the maintainer or developer does not have
the user's printer.

Exactly this is now available by a second testing mode with
parameters, which is fixed and made available with this change.

Instead of

cd /usr/share/system-config-printer
python newprinter.py

one does the call with parameters:

cupsctl FileDevice=yes
cd /usr/share/system-config-printer
python newprinter.py --setup-printer=file:/tmp/printout --devid="MFG:HP;MDL:Fax;"

and the printer with the device ID "MFG:HP;MDL:Fax;" will get set up
and the appropriate driver (here the fax driver of HPLIP) gets
selected. Also automatic driver downloads happen if appropriate.

This change only makes an already existing testing mode accessible and
fixes a bug in it (the device/driver association did not get
triggered). It does not change any behavior for normal use of
system-config-printer.
---
 newprinter.py |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/newprinter.py b/newprinter.py
index f10018a..0d58a40 100644
--- a/newprinter.py
+++ b/newprinter.py
@@ -661,6 +661,16 @@ class NewPrinterGUI(GtkGUI):
             self.on_rbtnNPFoomatic_toggled(self.rbtnNPFoomatic)
             self.rbtnChangePPDKeepSettings.set_active(True)
 
+            if self.dialog_mode == "printer_with_uri":
+                p = ppdsloader.PPDsLoader (device_id=devid,
+                                           device_uri=device_uri,
+                                           parent=self.NewPrinterWindow,
+                                           host=self._host,
+                                           encryption=self._encryption)
+                self.ppdsloader = p
+                p.connect ('finished',self.change_ppd_have_devs_and_ppds)
+                p.run ()
+
             self.auto_make = ""
             self.auto_model = ""
             self.auto_driver = None
@@ -3665,9 +3675,39 @@ class NewPrinterGUI(GtkGUI):
         self.device = None
         del self.printers
 
+def show_help():
+    print ("\nThis is the test/debug mode of the new-printer dialog of " \
+           "system-config-printer.\n\n"
+           "Options:\n\n"
+           "  --setup-printer URI\n"
+           "            Select the (detected) CUPS device URI on start up\n"
+           "            and run the new-printer wizard for it.\n\n"
+           "  --devid   Supply a device ID which should be used for the\n"
+           "            setup of the new peinter with \"--setup-printer\".\n"
+           "            This can be any printer's ID, so that driver \n"
+           "            selection can be tested for p[rinters which are not\n"
+           "            physically available.\n")
+
 gobject.type_register (NewPrinterGUI)
 
 if __name__ == '__main__':
+    import getopt
+    try:
+        opts, args = getopt.gnu_getopt (sys.argv[1:], '',
+                                        ['setup-printer=',
+                                         'devid='])
+    except getopt.GetoptError:
+        show_help ()
+        sys.exit (1)
+
+    setup_printer = None
+    devid = ""
+    for opt, optarg in opts:
+        if opt == '--setup-printer':
+            setup_printer = optarg
+        elif opt == '--devid':
+            devid = optarg
+
     os.environ["SYSTEM_CONFIG_PRINTER_UI"] = "ui"
     import ppdippstr
     import locale
@@ -3683,5 +3723,8 @@ if __name__ == '__main__':
     n.connect ("printer-added", on_signal)
     n.connect ("printer-modified", on_signal)
     n.connect ("dialog-canceled", on_signal)
-    n.init ("printer")
+    if setup_printer != None:
+        n.init ("printer_with_uri", device_uri=setup_printer, devid=devid)
+    else:
+        n.init ("printer")
     gtk.main ()
-- 
1.7.4.1


  parent reply	other threads:[~2011-03-01 21:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <F30723B8678F584CB6A4269E911255CB03396379@m1a.epkowa.co.jp>
     [not found] ` <4B8241D4.2040207@gmail.com>
     [not found]   ` <F30723B8678F584CB6A4269E911255CB034CE4DE@m1a.epkowa.co.jp>
     [not found]     ` <4B8E4CEF.8040007@gmail.com>
     [not found]       ` <F30723B8678F584CB6A4269E911255CB035D7CF6@m1a.epkowa.co.jp>
     [not found]         ` <4BBBA6A9.5050005@gmail.com>
     [not found]           ` <F30723B8678F584CB6A4269E911255CB0392318F@m1a.epkowa.co.jp>
     [not found]             ` <4BD18655.8060000@gmail.com>
     [not found]               ` <F30723B8678F584CB6A4269E911255CB03BF5E5C@m1a.epkowa.co.jp>
     [not found]                 ` <4C091F92.7050102@gmail.com>
     [not found]                   ` <4C1284F4.3000707@gmail.com>
     [not found]                     ` <4C89CF0C.60003@avasys.jp>
2010-11-18 16:55                       ` [Printing-architecture] Updates for auto-downloadable printer packages Till Kamppeter
2010-12-03  6:16                         ` yuji.saito
2010-12-06 16:54                           ` Till Kamppeter
2011-01-07  0:13                           ` [Printing-architecture] Ubuntu Natty the first distribution which does automatic download of binary printer driver packages Till Kamppeter
2011-01-07  0:20                           ` Till Kamppeter
2011-01-21  2:36                             ` yuji.saito
2011-01-24 23:00                               ` Till Kamppeter
     [not found]                               ` <20110131104358.GC4406@piware.de>
2011-02-24  9:38                                 ` Till Kamppeter
2011-02-25  7:00                                   ` yuji.saito
2011-02-25 12:40                                     ` Till Kamppeter
2011-02-25 21:26                                       ` Tim Waugh
2011-02-25 21:31                                         ` Till Kamppeter
2011-02-25 21:37                                         ` Till Kamppeter
2011-03-01 21:06                                         ` Till Kamppeter [this message]
2011-03-01 22:03                                           ` Till Kamppeter
2011-03-04  9:29                                             ` Olaf Meeuwissen
2011-03-04 16:50                                               ` Till Kamppeter
     [not found]                                               ` <20110304172254.GF30872@piware.de>
2011-03-07  1:32                                                 ` Olaf Meeuwissen
2011-03-11  3:03                                                   ` [Printing-architecture] [Printing-japan] " Olaf Meeuwissen
     [not found]                                                     ` <20110311080832.GB2541@piware.de>
2011-03-11 15:50                                                       ` Till Kamppeter
2011-03-14  9:29                                                       ` Olaf Meeuwissen
2011-03-11 16:15                                                     ` Till Kamppeter
2011-03-11 16:59                                                       ` Tim Waugh
2011-03-11 17:45                                                         ` Till Kamppeter
2011-03-12 16:21                                                           ` Till Kamppeter
2011-03-12 17:36                                                             ` Till Kamppeter
2011-03-14 11:13                                                               ` Tim Waugh
2011-03-14  9:39                                                             ` Olaf Meeuwissen
2011-03-14 20:47                                                               ` Till Kamppeter
2011-03-08 15:55                                           ` [Printing-architecture] " Tim Waugh
2011-02-25 13:03                                     ` Till Kamppeter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D6D5FD5.4010506@gmail.com \
    --to=till.kamppeter@gmail.com \
    --cc=martin.pitt@ubuntu.com \
    --cc=michael.vogt@ubuntu.com \
    --cc=printing-architecture@lists.linux-foundation.org \
    --cc=printing-japan@lists.linux-foundation.org \
    --cc=twaugh@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.