Esempio n. 1
0
    def updatePPDPage(self, ppds=None):
        QApplication.setOverrideCursor(QApplication.waitCursor)
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(
                self.device_uri)
        except Error:
            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."
                ))
            self.close()
            sys.exit()

        if ppds is None or not ppds:
            ppds = cups.getSystemPPDs()

        #print ppds

        default_model = utils.xstrip(
            model.replace('series', '').replace('Series', ''), '_')
        stripped_model = cups.stripModel2(
            models.normalizeModelName(model).lower())

        #Check if common ppd name is already given in models.dat(This is needed because in case of devices having more than one derivatives
        #will have diffrent model name strings in device ID, because of which we don't get the common ppd name for search)

        ppd_name = self.mq.get('ppd-name', 0)

        if ppd_name == 0:
            self.ppd = cups.getPPDFile2(stripped_model, ppds)
        else:
            self.ppd = cups.getPPDFile2(ppd_name, ppds)

        log.debug(self.ppd)
        self.ppdListView.clear()

        if self.ppd is not None:
            #for ppd in self.ppd_dict:
            PPDListViewItem(self.ppdListView, self.ppd[0], self.ppd[1])

            #            i = self.ppdListView.firstChild()
            #            self.ppdListView.setCurrentItem(i)
            #            self.ppdListView.setSelected(i, True)
            #            self.ppd_file = self.ppdListView.currentItem().ppd_file
            self.ppd_file = self.ppd[0]
            log.debug(self.ppd_file)

        else:
            self.FailureUI(
                self.__tr(
                    '<b>PPD not file found.</b><p>An appropriate PPD file could not be found. Please check your HPLIP install, use <i>Select Other...</i>, or download one from linuxprinting.org.'
                ))

        QApplication.restoreOverrideCursor()
Esempio n. 2
0
    def updatePPDPage(self, ppds=None):
        QApplication.setOverrideCursor(QApplication.waitCursor)
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
        except Error:
            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."
                )
            )
            self.close()
            sys.exit()

        if ppds is None or not ppds:
            ppds = cups.getSystemPPDs()

        self.ppd = cups.getPPDFile2(self.mq, model, ppds)
        log.debug(self.ppd)
        self.ppdListView.clear()

        if self.ppd is not None:
            PPDListViewItem(self.ppdListView, self.ppd[0], self.ppd[1])

            self.ppd_file = self.ppd[0]
            log.debug(self.ppd_file)

        else:
            self.FailureUI(
                self.__tr(
                    "<b>PPD not file found.</b><p>An appropriate PPD file could not be found. Please check your HPLIP install, use <i>Select Other...</i>, or download one from linuxprinting.org."
                )
            )

        QApplication.restoreOverrideCursor()
Esempio n. 3
0
    def updatePPDPage(self, ppds=None):
        QApplication.setOverrideCursor(QApplication.waitCursor)
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
        except Error:
            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."))
            self.close()
            sys.exit()

        if ppds is None or not ppds:
            ppds = cups.getSystemPPDs()

        self.ppd = cups.getPPDFile2(self.mq,  model , ppds)
        log.debug(self.ppd)
        self.ppdListView.clear()

        if self.ppd is not None:
            PPDListViewItem(self.ppdListView, self.ppd[0], self.ppd[1])

            self.ppd_file = self.ppd[0]
            log.debug(self.ppd_file)

        else:
            self.FailureUI(self.__tr('<b>PPD not file found.</b><p>An appropriate PPD file could not be found. Please check your HPLIP install, use <i>Select Other...</i>, or download one from linuxprinting.org.'))

        QApplication.restoreOverrideCursor()
    def updatePPDPage(self, ppds=None):
        QApplication.setOverrideCursor(QApplication.waitCursor)
        try:
            back_end, is_hp, bus, model, serial, dev_file, host, zc, port = device.parseDeviceURI(self.device_uri)
        except Error:
            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."))
            self.close()
            sys.exit()

        if ppds is None or not ppds:
            ppds = cups.getSystemPPDs()

        #print ppds

        default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
        stripped_model = cups.stripModel2(models.normalizeModelName(model).lower())
        
        
        #Check if common ppd name is already given in models.dat(This is needed because in case of devices having more than one derivatives
        #will have diffrent model name strings in device ID, because of which we don't get the common ppd name for search)
       
        ppd_name = self.mq.get('ppd-name',0)
        
        if ppd_name == 0:
        	self.ppd = cups.getPPDFile2(stripped_model, ppds)
        else:
            self.ppd = cups.getPPDFile2(ppd_name, ppds)
        
        log.debug(self.ppd)
        self.ppdListView.clear()

        if self.ppd is not None:
            #for ppd in self.ppd_dict:
            PPDListViewItem(self.ppdListView, self.ppd[0], self.ppd[1])

#            i = self.ppdListView.firstChild()
#            self.ppdListView.setCurrentItem(i)
#            self.ppdListView.setSelected(i, True)
#            self.ppd_file = self.ppdListView.currentItem().ppd_file
            self.ppd_file = self.ppd[0]
            log.debug(self.ppd_file)

        else:
            self.FailureUI(self.__tr('<b>PPD not file found.</b><p>An appropriate PPD file could not be found. Please check your HPLIP install, use <i>Select Other...</i>, or download one from linuxprinting.org.'))

        QApplication.restoreOverrideCursor()
Esempio n. 5
0
 def findPrinterPPD(self):
     QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
     try:
         self.print_ppd = None
         self.ppds = cups.getSystemPPDs()
         self.print_ppd = cups.getPPDFile2(self.mq, self.model, self.ppds)
         
     finally:
         QApplication.restoreOverrideCursor()
Esempio n. 6
0
    def findPrinterPPD(self):
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        try:
            self.print_ppd = None
            self.ppds = cups.getSystemPPDs()
            
            #Check if common ppd name is already given in models.dat(This is needed because in case of devices having more than one derivatives
            #will have diffrent model name strings in device ID, because of which we don't get the common ppd name for search)

            ppd_name = self.mq.get('ppd-name',0)
    
            if ppd_name == 0:    #Means ppd-name is not provided So follow earlier path of getting name from device ID.
            	model = cups.stripModel2(self.model)
            	self.print_ppd = cups.getPPDFile2(model, self.ppds)
            else:
            	self.print_ppd = cups.getPPDFile2(ppd_name, self.ppds)
            
        finally:
            QApplication.restoreOverrideCursor()
Esempio n. 7
0
                            if c in cups.INVALID_PRINTER_NAME_CHARS:
                                log.error("Invalid character '%s' in printer name. Please enter a name that does not contain this character." % c)
                                name_ok = False

                        if name_ok:
                            break
            else:
                printer_name = printer_default_model

            log.info("Using queue name: %s" % printer_name)

            default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')


            log.info("Locating PPD file... Please wait.")
            print_ppd = cups.getPPDFile2(mq, default_model, ppds)

            enter_ppd = False
            if print_ppd is None:
                enter_ppd = True
                log.error("Unable to find an appropriate PPD file.")

            else:
                print_ppd, desc = print_ppd
                log.info("\nFound PPD file: %s" % print_ppd)

                log.info("Description: %s" % desc)
#
                if not auto:
                    log.info("\nNote: The model number may vary slightly from the actual model number on the device.")
                    ok, ans = tui.enter_yes_no("\nDoes this PPD file appear to be the correct one")
Esempio n. 8
0
                                name_ok = False

                        if name_ok:
                            break
            else:
                printer_name = printer_default_model

            log.info("Using queue name: %s" % printer_name)

            default_model = utils.xstrip(
                model.replace('series', '').replace('Series', ''), '_')
            stripped_model = default_model.lower().replace('hp-', '').replace(
                'hp_', '')

            log.info("Locating PPD file... Please wait.")
            print_ppd = cups.getPPDFile2(stripped_model, ppds)
            enter_ppd = False

            if print_ppd is None:
                enter_ppd = True
                log.error("Unable to find an appropriate PPD file.")

            else:
                print_ppd, desc = print_ppd
                log.info("\nFound PPD file: %s" % print_ppd)

                if desc:
                    log.info("Description: %s" % desc)
                    #
                    if not auto:
                        log.info(
Esempio n. 9
0
                            if c in cups.INVALID_PRINTER_NAME_CHARS:
                                log.error("Invalid character '%s' in printer name. Please enter a name that does not contain this character." % c)
                                name_ok = False

                        if name_ok:
                            break
            else:
                printer_name = printer_default_model

            log.info("Using queue name: %s" % printer_name)

            default_model = utils.xstrip(model.replace('series', '').replace('Series', ''), '_')
            stripped_model = default_model.lower().replace('hp-', '').replace('hp_', '')

            log.info("Locating PPD file... Please wait.")
            print_ppd = cups.getPPDFile2(stripped_model, ppds)
            enter_ppd = False

            if print_ppd is None:
                enter_ppd = True
                log.error("Unable to find an appropriate PPD file.")

            else:
                print_ppd, desc = print_ppd
                log.info("\nFound PPD file: %s" % print_ppd)

                if desc:
                    log.info("Description: %s" % desc)
#
                    if not auto:
                        log.info("\nNote: The model number may vary slightly from the actual model number on the device.")