def jump_to_next_image(self) -> None: if len(self._list_of_images) == 0: self.mainWindow.statusbar.flash_message( red("no more"), wait=cfg.MESSAGE_FLASH_TIME_1) self.mainWindow.play_error_sound() return # else if self._curr_img_idx == len(self._list_of_images) - 1: self.mainWindow.statusbar.flash_message( red("no more"), wait=cfg.MESSAGE_FLASH_TIME_1) if self._curr_img.is_it_really_the_last(): # type: ignore self.mainWindow.play_error_sound() img = self._curr_img subreddit_name = img.extra_info.get("subreddit") # type: ignore after_id = img.extra_info.get("after_id") # type: ignore if img and subreddit_name and after_id: urls = [] if self.mainWindow.auto_load_next_subreddit_page: urls = subreddit.read_subreddit( subreddit_name, after_id, statusbar=self.mainWindow.statusbar, mainWindow=self.mainWindow) else: reply = QMessageBox.question( self.mainWindow, 'Question', "Load the next page?", QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if reply == QMessageBox.No: return else: # self.open_subreddit(subreddit, after_id) urls = subreddit.read_subreddit( subreddit_name, after_id, statusbar=self.mainWindow.statusbar, mainWindow=self.mainWindow) if len(urls) == 0: QMessageBox.information(self.mainWindow, "Info", "No new images were found.") else: lst = [ImageProperty(url, self.mainWindow) for url in urls] self._list_of_images.extend(lst) self.jump_to_next_image() return else: return # else new_idx = self._curr_img_idx + 1 if new_idx >= len(self._list_of_images): new_idx = len(self._list_of_images) - 1 # self.jump_to_image(new_idx)
def get_short_flags(self) -> str: sb = [] if self.to_save: sb.append(yellow("S")) if self.to_delete: sb.append(red("D")) if self.to_wallpaper: sb.append(lightblue("W")) return "<br>".join(sb)
def jump_to_prev_image(self) -> None: if len(self._list_of_images) == 0 or self._curr_img_idx == 0: self.mainWindow.statusbar.flash_message( red("no less"), wait=cfg.MESSAGE_FLASH_TIME_1) self.mainWindow.play_error_sound() return # else new_idx = self._curr_img_idx - 1 if new_idx < 0: new_idx = 0 # self.jump_to_image(new_idx)