~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to ui/setupform.py

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
225
225
                if device_uri:
226
226
                    self.device_uri = device_uri
227
227
 
228
 
            back_end, is_hp, bus, model, serial, dev_file, host, port = \
 
228
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = \
229
229
                device.parseDeviceURI(self.device_uri)
230
230
 
231
231
            self.bus = bus
236
236
            core = core_install.CoreInstall()
237
237
            core.set_plugin_version()
238
238
            plugin = self.mq.get('plugin', PLUGIN_NONE)
 
239
            plugin_reason = self.mq.get('plugin-reason', PLUGIN_REASON_NONE)
239
240
            if plugin > PLUGIN_NONE and not core.check_for_plugin():
240
 
                ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED)
 
241
                ok, sudo_ok = pkit.run_plugin_command(plugin == PLUGIN_REQUIRED, plugin_reason)
 
242
                if not sudo_ok:
 
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
                    return
241
245
                if not ok or not core.check_for_plugin():
242
246
                    if plugin == PLUGIN_REQUIRED:
243
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>"))
411
415
                          }
412
416
 
413
417
            filter_dict = {}
414
 
            for f in self.filter:
415
 
                if f in FILTER_MAP:
416
 
                    filter_dict[FILTER_MAP[f]] = (operator.gt, 0)
417
 
                else:
418
 
                    filter_dict[f] = (operator.gt, 0)
419
 
 
420
 
            devices = device.probeDevices([self.bus], self.timeout, self.ttl, filter_dict, self.search)
 
418
 
 
419
            if prop.fax_build and prop.scan_build:
 
420
                for f in self.filter:
 
421
                    if f in FILTER_MAP:
 
422
                        filter_dict[FILTER_MAP[f]] = (operator.gt, 0)
 
423
                    else:
 
424
                        filter_dict[f] = (operator.gt, 0)
 
425
            else:
 
426
                filter_dict['scan-type'] = (operator.le, SCAN_TYPE_NONE)
 
427
 
 
428
            devices = device.probeDevices([self.bus], self.timeout, self.ttl, filter_dict, self.search, net_search='slp')
421
429
 
422
430
            self.probeHeadingTextLabel.setText(self.__tr("%1 device(s) found on the %1:").arg(len(devices)).arg(io_str))
423
431
 
436
444
        if devices:
437
445
            row = 0
438
446
            for d in devices:
439
 
                back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(d)
 
447
                back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(d)
440
448
 
441
449
                mq = {}
442
450
                model_ui = models.normalizeModelUIName(model)
498
506
            cups_uri, sane_uri, fax_uri = device.makeURI(dlg.param)
499
507
 
500
508
            if cups_uri:
501
 
                back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(cups_uri)
 
509
                back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(cups_uri)
502
510
                name = ''
503
511
                if self.bus == 'net':
504
512
                    try:
519
527
    def updatePPDPage(self, ppds=None):
520
528
        QApplication.setOverrideCursor(QApplication.waitCursor)
521
529
        try:
522
 
            back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
 
530
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
523
531
        except Error:
524
532
            self.FailureUI(self.__tr("<b>Device not found or invalid HPLIP device.</b><p>If you specified a USB ID, IP address, or other parameter, please re-check it and try again."))
525
533
            self.close()
583
591
 
584
592
        self.installed_queues = [p.name for p in cups.getPrinters()]
585
593
 
586
 
        back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.device_uri)
 
594
        back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
587
595
        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
588
596
 
589
597
        printer_name = default_model
691
699
 
692
700
        self.fax_uri = self.device_uri.replace('hp:', 'hpfax:')
693
701
 
694
 
        back_end, is_hp, bus, model, serial, dev_file, host, port = device.parseDeviceURI(self.fax_uri)
 
702
        back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.fax_uri)
695
703
        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
696
704
 
697
705
        fax_name = default_model + "_fax"
849
857
    def setupPrinter(self):
850
858
        QApplication.setOverrideCursor(QApplication.waitCursor)
851
859
 
 
860
        cups.setPasswordPrompt("You do not have permission to add a printer.")
852
861
        #if self.ppd_file.startswith("foomatic:"):
853
862
        if not os.path.exists(self.ppd_file): # assume foomatic: or some such
854
863
            status, status_str = cups.addPrinter(self.printer_name.encode('utf8'), self.device_uri,
928
937
            else: # Quit
929
938
                return
930
939
 
 
940
        cups.setPasswordPrompt("You do not have permission to add a fax device.")
931
941
        if not os.path.exists(fax_ppd):
932
942
            status, status_str = cups.addPrinter(self.fax_name.encode('utf8'),
933
943
                self.fax_uri, self.fax_location, '', fax_ppd,  self.fax_desc)
1010
1020
class PasswordDialog(QDialog):
1011
1021
    def __init__(self,prompt, parent=None, name=None, modal=0, fl=0):
1012
1022
        QDialog.__init__(self,parent,name,modal,fl)
 
1023
        self.prompt = prompt
1013
1024
 
1014
1025
        if not name:
1015
1026
            self.setName("PasswordDialog")
1050
1061
        return unicode(self.passwordLineEdit.text())
1051
1062
 
1052
1063
    def languageChange(self):
1053
 
        self.setCaption(self.__tr("HP Device Manager - Enter Password"))
1054
 
        self.promptTextLabel.setText(self.__tr("You do not have authorization for this function."))
 
1064
        self.setCaption(self.__tr("HP Device Manager - Enter Username/Password"))
 
1065
        self.promptTextLabel.setText(self.__tr(self.prompt))
1055
1066
        self.usernameTextLabel.setText(self.__tr("Username"))
1056
1067
        self.passwordTextLabel.setText(self.__tr("Password"))
1057
1068
        self.okPushButton.setText(self.__tr("OK"))