def update(self): updated = Update.last_checked() if updated: fmt = time.strftime('%d %b %Y, %H:%M:%S', time.localtime(updated)) self.set("Last checked: %s" % fmt) else: self.set('')
def refresh(self, force=False): try: self.is_refreshing = True self.enable(False) self.set(Update.all(force)) if self.refresh_callback: self.refresh_callback() except Update.ConnectionError: raise UpdateList.ConnectionError finally: self.enable(True) self.is_refreshing = False
def check_for_updates(self): """Open updates window unless ran in last hour""" if self.should_check_for_updates(): try: skip_patches = bool(Storage.get('ignore_patch_updates')) updates = Update.all(force=True, skip_patches=skip_patches) except Update.ConnectionError: logger.info("Couldn't connect to the internet") return if updates: logger.info("%d new updates found", len(updates)) Bus().emit("newUpdatesFound", updates) else: logger.info("No new updates found") else: logger.info("Skipping a check for new updates")
def get_updates(self, force): skip_patches = bool(Storage.get("ignore_patch_updates")) return Update.all(force, skip_patches=skip_patches)
def should_check_for_updates(self): return bool(Storage.get('check_on_startup')) and \ not Update.checked_recently()