You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

from PyQt6.QtCore import QObject, pyqtSignal, QRunnable
import json
from cache import cache
from db import db
from ui.workers.gather_evolutions_worker import GatherEvolutions
from utility.data import exclusive_choice_pokemon
from utility.functions import get_display_name, get_form_name, get_shiftable_forms, parse_pfic
class GatherBabyStatusWorkerSignals(QObject):
finished = pyqtSignal(list)
class GatherBabyStatusWorker(GatherEvolutions):
def __init__(self):
super().__init__()
self.signals = GatherBabyStatusWorkerSignals()
def run(self):
try:
gathered_data = self.gather_baby_status(False)
self.signals.finished.emit(gathered_data)
except Exception as e:
print(f"Error gathering Pokémon home storage status: {e}")
def gather_baby_status(self, force_refresh = False):
all_pokemon_forms = db.get_pokemon_home_list()
babys = []
for pokemon_form in all_pokemon_forms:
evolution_tree = self.gather_evolution_tree(pokemon_form, force_refresh)
if not evolution_tree:
continue
if evolution_tree["pokemon"] != pokemon_form["name"]:
continue
if evolution_tree["is_baby"]:
babys.append(pokemon_form["pfic"])
return babys