diff --git a/database/db_controller.py b/database/db_controller.py index e176510..6d28b4c 100644 --- a/database/db_controller.py +++ b/database/db_controller.py @@ -99,16 +99,17 @@ class DBController: return query - def get_pokemon_details(self, pfic): - fields = [ - "name", - "form_name", - "national_dex", - "generation", - "is_baby_form", - "storable_in_home", - "gender_relevant" - ] + def get_pokemon_details(self, pfic, fields = None): + if fields == None: + fields = [ + "name", + "form_name", + "national_dex", + "generation", + "is_baby_form", + "storable_in_home", + "gender_relevant" + ] query = self.craft_pokemon_json_query(fields, pfic) self.cursor.execute(query) results = self.cursor.fetchone() @@ -360,7 +361,7 @@ class DBController: gender_specific_nodes.extend([from_node, to_node]) return list(set(gender_specific_nodes)) # Return unique nodes - + def get_gender_relevant_pokemon(self): self.cursor.execute(f"SELECT PFIC FROM pokemon_forms WHERE JSON_EXTRACT(data, '$.gender_relevant') = true") results = self.cursor.fetchall() diff --git a/ui/main_window_controller.py b/ui/main_window_controller.py index 12cd29a..53240c6 100644 --- a/ui/main_window_controller.py +++ b/ui/main_window_controller.py @@ -46,6 +46,7 @@ class MainWindowController: if show_only_home_storable: # TODO: update the call to correctly filter the data, or better yet update the data at the source to include this info. home_storable = True #event_system.call_sync('get_home_storable', pfic) + home_storable = db.get_pokemon_details(pfic, ["storable_in_home"])["storable_in_home"] # Check to see if the pokemon has encounters has_encounters = True @@ -74,8 +75,9 @@ class MainWindowController: context_menu.exec(self.pokemon_list.viewport().mapToGlobal(position)) def on_pokemon_selected(self, item): - pfic = item.data(Qt.ItemDataRole.UserRole) - self.refresh_pokemon_details_panel(pfic) + if item: + pfic = item.data(Qt.ItemDataRole.UserRole) + self.refresh_pokemon_details_panel(pfic) def edit_encounter(self): pass @@ -183,6 +185,5 @@ class MainWindowController: self.current_pfic = pfic def load_evolution_chain(self, pfic): - #chain = db.get_evolution_paths(pfic) chain = db.get_full_evolution_paths(pfic) self.view.update_evolution_tree(chain, pfic) diff --git a/ui/workers/gather_home_storage_status_worker.py b/ui/workers/gather_home_storage_status_worker.py index 85351d0..e63846a 100644 --- a/ui/workers/gather_home_storage_status_worker.py +++ b/ui/workers/gather_home_storage_status_worker.py @@ -49,6 +49,10 @@ class GatherHomeStorageStatus(QRunnable): if working_form and name in working_form: working_form = working_form.replace(name, "").strip() + if working_form: + working_form = working_form.replace("Female", "").replace("female", "").strip() + working_form = working_form.replace("Male", "").replace("male", "").strip() + # serebii doesn't list gender in the table so we have to assume based on form name. if working_form and ("male" in working_form.lower() or "working_form" in working_form.lower()): working_form = None @@ -63,6 +67,9 @@ class GatherHomeStorageStatus(QRunnable): if name == "Alcremie": working_form = None + if working_form == "": + working_form = None + for pokemon in pokemon_by_national_dex[national_dex]: if working_form: parts = pokemon['name'].split(" ")