~ubuntu-branches/ubuntu/saucy/hplip/saucy-proposed

« back to all changes in this revision

Viewing changes to ui4/setupdialog.py

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2012-05-26 11:20:39 UTC
  • mfrom: (1.5.6) (31.1.3 precise)
  • Revision ID: package-import@ubuntu.com-20120526112039-bevxczegxnbyr5m7
Tags: 3.12.4-1
* New upstream release
* Switch to source/format 3.0 (quilt) - drop dpatch
* Refreshed debian/patches
* dh_autoreconf debian/autogen.sh & set local-options single-debian-patch
* Update to debian/compat -> 9
* Fix "hardened build flags" patch from Moritz - thanks (Closes: #667828)
* Fix "duplex descriptor uninitialized" patch from Matej (Closes: #583273)
* Fix "please migrate to kde-runtime" patch from Pino (Closes: #666544)

Show diffs side-by-side

added added

removed removed

Lines of Context:
656
656
        plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE)
657
657
        if plugin > PLUGIN_NONE:
658
658
 
659
 
            if not core.check_for_plugin():
 
659
            if core.check_for_plugin() != PLUGIN_INSTALLED:
660
660
                ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
661
661
                if not sudo_ok:
662
662
                    FailureUI(self, self.__tr("<b>Unable to find an appropriate su/sudo utiltity to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"))
663
663
                    return
664
 
                if not ok or not core.check_for_plugin():
 
664
                if not ok or core.check_for_plugin() != PLUGIN_INSTALLED:
665
665
                    if plugin == PLUGIN_REQUIRED:
666
666
                        FailureUI(self, self.__tr("<b>The printer you are trying to setup requires a binary driver plug-in and it failed to install.</b><p>Please check your internet connection and try again.</p><p>Visit <u>http://hplipopensource.com</u> for more infomation.</p>"))
667
667
                        return
822
822
        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
823
823
 
824
824
        printer_name = default_model
825
 
 
 
825
        installed_printer_names = device.getSupportedCUPSPrinterNames(['hp'])
826
826
        # Check for duplicate names
827
 
        if self.device_uri in self.installed_print_devices and \
828
 
            printer_name in self.installed_print_devices[self.device_uri]:
 
827
        if (self.device_uri in self.installed_print_devices and printer_name in self.installed_print_devices[self.device_uri]) \
 
828
           or (printer_name in installed_printer_names):
829
829
                i = 2
830
830
                while True:
831
831
                    t = printer_name + "_%d" % i
832
 
                    if t not in self.installed_print_devices[self.device_uri]:
 
832
                    if (t not in installed_printer_names) and (self.device_uri not in self.installed_print_devices or t not in self.installed_print_devices[self.device_uri]):
833
833
                        printer_name += "_%d" % i
834
834
                        break
835
835
                    i += 1
850
850
        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
851
851
 
852
852
        fax_name = default_model + "_fax"
853
 
 
 
853
        installed_fax_names = device.getSupportedCUPSPrinterNames(['hpfax'])
854
854
        # Check for duplicate names
855
 
        if self.fax_uri in self.installed_fax_devices and \
856
 
            fax_name in self.installed_fax_devices[self.fax_uri]:
 
855
        if (self.fax_uri in self.installed_fax_devices and fax_name in self.installed_fax_devices[self.fax_uri]) \
 
856
           or (fax_name in installed_fax_names):
857
857
                i = 2
858
858
                while True:
859
859
                    t = fax_name + "_%d" % i
860
 
                    if t not in self.installed_fax_devices[self.fax_uri]:
 
860
                    if (t not in installed_fax_names) and (self.fax_uri not in self.installed_fax_devices or t not in self.installed_fax_devices[self.fax_uri]):
861
861
                        fax_name += "_%d" % i
862
862
                        break
863
863
                    i += 1