~ubuntu-branches/ubuntu/natty/system-config-printer/natty

« back to all changes in this revision

Viewing changes to newprinter.py

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-02-17 19:28:47 UTC
  • mfrom: (1.1.59 upstream)
  • Revision ID: james.westby@ubuntu.com-20110217192847-7jmu0rr95s927y2p
Tags: 1.3.1+20110217-0ubuntu1
New upstream release
o Now really use the tarball of system-config-printer 1.3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
## system-config-printer
4
4
 
5
 
## Copyright (C) 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
 
5
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
6
6
## Authors:
7
7
##  Tim Waugh <twaugh@redhat.com>
8
8
##  Florian Festi <ffesti@redhat.com>
971
971
                        ready (self.NewPrinterWindow)
972
972
                        return
973
973
 
974
 
                if (self.device.hp_scannable and
 
974
                if (hasattr (self.device, 'hp_scannable') and
 
975
                    self.device.hp_scannable and
975
976
                    not os.access ("/etc/sane.d/dll.d/hpaio", os.R_OK)):
976
977
                    try:
977
978
                        pk = installpackage.PackageKit ()
1025
1026
                                                    "Generic Printer",
1026
1027
                                                    [],
1027
1028
                                                    self.device.uri)
 
1029
                        status = "generic"
1028
1030
 
1029
1031
                    if ppdname and not self.remotecupsqueue:
1030
1032
                        ppddict = self.ppds.getInfoFromPPDName (ppdname)
1034
1036
                        self.auto_make = make
1035
1037
                        self.auto_model = model
1036
1038
                        self.auto_driver = ppdname
1037
 
                        if (status == self.ppds.STATUS_SUCCESS and \
 
1039
                        if (status == "exact" and \
1038
1040
                            self.dialog_mode != "ppd"):
1039
1041
                            self.exactdrivermatch = True
1040
1042
                        else:
1602
1604
            if (self._host == 'localhost' or
1603
1605
                self._host[0] == '/'):
1604
1606
                self.firewall = firewall.Firewall ()
 
1607
                debugprint ("Examining firewall")
1605
1608
                self.firewall.read (reply_handler=self.on_firewall_read,
1606
1609
                                    error_handler=lambda x:
1607
1610
                                        self.start_fetching_devices())
1614
1617
            nonfatalException ()
1615
1618
 
1616
1619
        if allowed:
 
1620
            debugprint ("Fetching devices (no firewall service")
1617
1621
            self.start_fetching_devices ()
1618
1622
 
1619
1623
    def on_firewall_read (self, data):
1636
1640
                f.add_rule (f.ALLOW_MDNS)
1637
1641
 
1638
1642
            if not allowed:
 
1643
                debugprint ("Asking for permission to adjust firewall:\n%s" %
 
1644
                            secondary_text)
1639
1645
                dialog = gtk.MessageDialog (self.NewPrinterWindow,
1640
1646
                                            gtk.DIALOG_MODAL |
1641
1647
                                            gtk.DIALOG_DESTROY_WITH_PARENT,
1651
1657
            nonfatalException ()
1652
1658
 
1653
1659
        if allowed:
 
1660
            debugprint ("Firewall all OK; fetching devices")
1654
1661
            self.start_fetching_devices ()
1655
1662
 
1656
1663
    def adjust_firewall_response (self, dialog, response):
1659
1666
            self.firewall.add_rule (self.firewall.ALLOW_IPP_SERVER)
1660
1667
            self.firewall.write ()
1661
1668
 
 
1669
        debugprint ("Fetching devices after firewall dialog response")
1662
1670
        self.start_fetching_devices ()
1663
1671
 
1664
1672
    def start_fetching_devices (self):
2467
2475
                        physicaldevice.add_device (faxdev)
2468
2476
 
2469
2477
            physicaldevice.set_data ('hp-scannable', True)
2470
 
            if hp_scannable and not os.access ("/etc/sane.d/dll.d/hpaio",
2471
 
                                               os.R_OK):
2472
 
                try:
2473
 
                    pk = installpackage.PackageKit ()
2474
 
                    xid = self.NewPrinterWindow.window.xid
2475
 
                    pk.InstallPackageName (xid, 0, "libsane-hpaio")
2476
 
                except:
2477
 
                    pass
2478
 
 
2479
2478
            physicaldevice.set_data ('checked-hplip', True)
2480
2479
 
2481
2480
        device.hp_scannable = physicaldevice.get_data ('hp-scannable')