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

« back to all changes in this revision

Viewing changes to ui/setupform.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:
237
237
            core.set_plugin_version()
238
238
            plugin = self.mq.get('plugin', PLUGIN_NONE)
239
239
            plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE)
240
 
            if plugin > PLUGIN_NONE and not core.check_for_plugin():
 
240
            if plugin > PLUGIN_NONE and core.check_for_plugin() != PLUGIN_INSTALLED:
241
241
                ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
242
242
                if not sudo_ok:
243
243
                    self.FailureUI(self.__tr("<b>Unable to find an appropriate su/sudo utility to run hp-plugin.</b><p>Install kdesu, gnomesu, or gksu.</p>"))
244
244
                    return
245
 
                if not ok or not core.check_for_plugin():
 
245
                if not ok or core.check_for_plugin() != PLUGIN_INSTALLED:
246
246
                    if plugin == PLUGIN_REQUIRED:
247
247
                        self.FailureUI(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 information.</p>"))
248
248
                        return
606
606
 
607
607
        printer_name = default_model
608
608
 
 
609
        installed_printer_names = device.getSupportedCUPSPrinterNames(['hp'])
609
610
        # Check for duplicate names
610
 
        if self.device_uri in self.installed_print_devices and \
611
 
            printer_name in self.installed_print_devices[self.device_uri]:
 
611
        if (self.device_uri in self.installed_print_devices and printer_name in self.installed_print_devices[self.device_uri]) \
 
612
           or (printer_name in installed_printer_names):
612
613
                i = 2
613
614
                while True:
614
615
                    t = printer_name + "_%d" % i
615
 
                    if t not in self.installed_print_devices[self.device_uri]:
 
616
                    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]):
616
617
                        printer_name += "_%d" % i
617
618
                        break
618
619
                    i += 1
713
714
        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
714
715
 
715
716
        fax_name = default_model + "_fax"
 
717
        installed_fax_names = device.getSupportedCUPSPrinterNames(['hpfax'])
716
718
 
717
719
        # Check for duplicate names
718
 
        if self.fax_uri in self.installed_fax_devices and \
719
 
            fax_name in self.installed_fax_devices[self.fax_uri]:
 
720
        if (self.fax_uri in self.installed_fax_devices and fax_name in self.installed_fax_devices[self.fax_uri]) \
 
721
           or (fax_name in installed_fax_names):
720
722
        #if fax_name in self.installed_queues or fax_name == self.printer_name:
721
723
                i = 2
722
724
                while True:
723
725
                    t = fax_name + "_%d" % i
724
 
                    if t not in self.installed_fax_devices[self.fax_uri]:
 
726
                    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]):
725
727
                        fax_name += "_%d" % i
726
728
                        break
727
729
                    i += 1