def settingsTriggered(self): if self.menu is None: return self.sendMessage('', '', EVENT_DEVICE_STOP_POLLING) # sys_conf cur_vers = sys_conf.get('hplip', 'version') self.user_settings.load() installed_time =time.strftime("%d-%m-%Y", time.localtime(self.user_settings.upgrade_last_update_time)) if utils.Is_HPLIP_older_version(cur_vers, self.user_settings.latest_available_version): if int(time.time()) < self.user_settings.upgrade_pending_update_time : postponed_time =time.strftime("%d-%m-%Y", time.localtime(self.user_settings.upgrade_pending_update_time)) upgrade_msg ="HPLIP-%s version was installed on %s.\n\nNew version of HPLIP-%s is available for upgrade. HPLIP upgrade is scheduled on %s." %(cur_vers,installed_time , self.user_settings.latest_available_version, postponed_time) elif self.user_settings.upgrade_last_update_time: upgrade_msg ="HPLIP-%s version was installed on %s.\n\nNew version of HPLIP-%s is available for upgrade." %(cur_vers,installed_time , self.user_settings.latest_available_version) else: upgrade_msg ="HPLIP-%s version was installed.\n\nNew version of HPLIP-%s is available for upgrade." %(cur_vers, self.user_settings.latest_available_version) elif self.user_settings.upgrade_last_update_time: upgrade_msg ="HPLIP-%s version was installed on %s."%(cur_vers, installed_time) else: upgrade_msg ="HPLIP-%s version was installed."%(cur_vers) try: dlg = SystraySettingsDialog(self.menu, self.user_settings.systray_visible, self.user_settings.polling, self.user_settings.polling_interval, self.user_settings.systray_messages, self.user_settings.polling_device_list, self.user_settings.upgrade_notify, self.user_settings.upgrade_pending_update_time, self.user_settings.upgrade_last_update_time, upgrade_msg) if dlg.exec_() == QDialog.Accepted: self.user_settings.systray_visible = dlg.systray_visible self.user_settings.systray_messages = dlg.systray_messages self.user_settings.upgrade_notify = dlg.upgrade_notify log.debug("HPLIP update notification = %d"%(self.user_settings.upgrade_notify)) self.user_settings.save() if self.user_settings.systray_visible == SYSTRAY_VISIBLE_SHOW_ALWAYS: log.debug("Showing...") self.tray_icon.setVisible(True) else: log.debug("Waiting to hide...") QTimer.singleShot(HIDE_INACTIVE_DELAY, self.timeoutHideWhenInactive) self.sendMessage('', '', EVENT_USER_CONFIGURATION_CHANGED) finally: self.sendMessage('', '', EVENT_DEVICE_START_POLLING)
installed_version = sys_conf.get("hplip", "version", "0.0.0") log.debug("HPLIP previous installed version =%s." % installed_version) HPLIP_latest_ver = get_latest_hplip_version() if HPLIP_latest_ver == "0.0.0": log.error("Failed to get latest version of HPLIP.") clean_exit(1) user_conf.set('upgrade', 'latest_available_version', HPLIP_latest_ver) if CHECKING_ONLY is True: log.debug("Available HPLIP version =%s." % HPLIP_latest_ver) elif NOTIFY is True: if not utils.Is_HPLIP_older_version(installed_version, HPLIP_latest_ver): log.debug("Latest version of HPLIP is already installed.") else: msg = "Latest version of HPLIP-%s is available." % HPLIP_latest_ver if core.is_auto_installer_support(): distro_type = 1 else: distro_type = 2 if ui_toolkit == 'qt3': if not utils.canEnterGUIMode(): log.error( "%s requires GUI support. Is Qt3 Installed?.. Exiting." % __mod__) clean_exit(1)