def NextButton_clicked(self): beginWaitCursor() try: if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED: self.disable_smart_install() elif self.Error_msg == QUEUES_PAUSED: cups.enablePrinter(self.printerName) msg = "'" + self.printerName + "' is enabled successfully" SuccessUI(self, self.__tr(msg)) else: status, status_str = cups.cups_operation( cups.delPrinter, GUI_MODE, 'qt4', self, self.printerName) if status != cups.IPP_OK: msg = "Failed to remove ' " + self.printerName + " ' queue.\nRemove using hp-toolbox..." FailureUI(self, self.__tr(msg)) else: msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..." log.debug(msg) path = utils.which('hp-setup') if path: log.debug("Starting hp-setup") utils.run('hp-setup --gui') finally: endWaitCursor() self.result = True self.close()
def NextButton_clicked(self): beginWaitCursor() try: if self.Error_msg == QUEUES_SMART_INSTALL_ENABLED: self.disable_smart_install() elif self.Error_msg == QUEUES_PAUSED: cups.enablePrinter(self.printerName) msg ="'"+self.printerName+"' is enabled successfully" SuccessUI(self, self.__tr(msg)) else: status, status_str = cups.cups_operation(cups.delPrinter, GUI_MODE, 'qt4', self, self.printerName) if status != cups.IPP_OK: msg="Failed to remove ' "+self.printerName+" ' queue.\nRemove using hp-toolbox..." FailureUI(self, self.__tr(msg)) else: msg="' "+self.printerName+" ' removed successfully.\nRe-configuring this printer by hp-setup..." log.debug(msg) path = utils.which('hp-setup') if path: log.debug("Starting hp-setup") utils.run('hp-setup --gui') finally: endWaitCursor() self.result = True self.close()
def reconfigure_Queue(que, mode, dialog= None,app=None): global Error_Found Error_msg =None if mode == INTERACTIVE_MODE: if 'hp' in que.DeviceType or 'hpfax' in que.DeviceType: if que.PPDFileError == False: log.debug("'%s' is configured correctly." %(que.PrinterName)) else: Error_msg = "PPD file for '%s' is not correct. Need to choose correct PPD file." %(que.PrinterName) else: Error_msg ="'%s' is not configured using HPLIP. Need to remove and re-cofigure using hp-setup." %(que.PrinterName) if Error_msg != None: Error_Found = True log.error(Error_msg) response, value = tui.enter_yes_no("Do you want to remove and re-configure?") if response == False: log.debug("User Exit") sys.exit(1) elif value == True: cups.delPrinter(que.PrinterName) log.info("' %s' removed successfully.\nRe-configuring this printer by hp-setup..."%que.PrinterName) path = utils.which('hp-setup') if path: log.debug("Starting hp-setup") os.system('hp-setup -i') elif que.IsEnabled == False: Error_Found = True responce, value =tui.enter_yes_no("'%s Queue is paused. Do you want to enable queue?"%(que.PrinterName)) if responce == False: log.debug("User Exit") sys.exit(1) elif value == True: cups.enablePrinter(que.PrinterName) log.info("'%s' is enabled successfully"%que.PrinterName) else: log.info("Manually enable '%s'."%que.PrinterName) else: if 'hp' in que.DeviceType or 'hpfax' in que.DeviceType: if que.PPDFileError == False: log.debug("'%s' is configured correctly." %(que.PrinterName)) else: log.error("PPD file for '%s' is not correct. Need to choose correct PPD file." %(que.PrinterName)) Error_msg = QUEUES_INCORRECT_PPD else: log.error("'%s' is not configured using HPLIP. Need to remove and re-cofigure using hp-setup." %(que.PrinterName)) Error_msg =QUEUES_CONFIG_ERROR if Error_msg == None and que.IsEnabled == False: Error_msg = QUEUES_PAUSED if Error_msg and dialog and app: Error_Found = True dialog.init(que.PrinterName, que.DeviceURI, Error_msg) dialog.show() log.debug("Starting GUI loop...") app.exec_()
def NextButton_clicked(self): try: if self.Error_msg != QUEUES_PAUSED: cups.delPrinter(self.printerName) msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..." log.debug(msg) path = utils.which("hp-setup") if path: log.debug("Starting hp-setup") utils.run("hp-setup") else: cups.enablePrinter(self.printerName) msg = "'" + self.printerName + "' is enabled successfully" SuccessUI(self, self.__tr(msg)) finally: endWaitCursor() self.result = True self.close()
def NextButton_clicked(self): try: if self.Error_msg != QUEUES_PAUSED: cups.delPrinter(self.printerName) msg = "' " + self.printerName + " ' removed successfully.\nRe-configuring this printer by hp-setup..." log.debug(msg) path = utils.which('hp-setup') if path: log.debug("Starting hp-setup") utils.run('hp-setup') else: cups.enablePrinter(self.printerName) msg = "'" + self.printerName + "' is enabled successfully" SuccessUI(self, self.__tr(msg)) finally: endWaitCursor() self.result = True self.close()
def reconfigure_Queue(que, mode, dialog=None, app=None): global Error_Found Error_msg = None if mode == INTERACTIVE_MODE: if 'hp' in que.DeviceType or 'hpfax' in que.DeviceType: if que.PPDFileError == False: log.debug("'%s' is configured correctly." % (que.PrinterName)) else: Error_msg = "PPD file for '%s' is not correct. Need to choose correct PPD file." % ( que.PrinterName) else: Error_msg = "'%s' is not configured using HPLIP. Need to remove and re-cofigure using hp-setup." % ( que.PrinterName) if Error_msg != None: Error_Found = True log.error(Error_msg) response, value = tui.enter_yes_no( "Do you want to remove and re-configure?") if response == False: log.debug("User Exit") sys.exit(1) elif value == True: status, status_str = cups.cups_operation( cups.delPrinter, INTERACTIVE_MODE, '', None, que.PrinterName) if status != cups.IPP_OK: log.error( "Failed to remove '%s' queue.\nRemove using hp-toolbox." % que.PrinterName) else: log.info( "' %s' removed successfully.\nRe-configuring this printer by hp-setup..." % que.PrinterName) if utils.which('hp-setup'): cmd = 'hp-setup -i' os_utils.execute(cmd) elif que.IsEnabled == False: Error_Found = True responce, value = tui.enter_yes_no( "'%s Queue is paused. Do you want to enable queue?" % (que.PrinterName)) if responce == False: log.debug("User Exit") sys.exit(1) elif value == True: cups.enablePrinter(que.PrinterName) log.info("'%s' is enabled successfully" % que.PrinterName) else: log.info("Manually enable '%s'." % que.PrinterName) else: if 'hp' in que.DeviceType or 'hpfax' in que.DeviceType: if que.PPDFileError == False: log.debug("'%s' is configured correctly." % (que.PrinterName)) else: log.error( "PPD file for '%s' is not correct. Need to choose correct PPD file." % (que.PrinterName)) Error_msg = QUEUES_INCORRECT_PPD else: log.error( "'%s' is not configured using HPLIP. Need to remove and re-cofigure using hp-setup." % (que.PrinterName)) Error_msg = QUEUES_CONFIG_ERROR if Error_msg == None and que.IsEnabled == False: Error_msg = QUEUES_PAUSED if Error_msg and dialog and app: Error_Found = True dialog.init(que.PrinterName, que.DeviceURI, Error_msg) dialog.show() log.debug("Starting GUI loop...") app.exec_()