diff --git a/database/db_controller.py b/database/db_controller.py index 08e4ba1..5b58741 100644 --- a/database/db_controller.py +++ b/database/db_controller.py @@ -77,6 +77,7 @@ class DBController: JSON_EXTRACT(data, '$.national_dex') AS national_dex, JSON_EXTRACT(data, '$.generation') AS generation, JSON_EXTRACT(data, '$.is_baby_form') AS is_baby_form, + JSON_EXTRACT(data, '$.storable_in_home') AS storable_in_home FROM pokemon_forms WHERE PFIC = ? ''', (pfic,)) @@ -86,10 +87,11 @@ class DBController: def get_list_of_pokemon_forms(self): self.cursor.execute(''' SELECT JSON_EXTRACT(data, '$.name') AS name, - JSON_EXTRACT(data, '$.form_name') AS form_name, - JSON_EXTRACT(data, '$.national_dex') AS national_dex, - JSON_EXTRACT(data, '$.generation') AS generation, - JSON_EXTRACT(data, '$.is_baby_form') AS is_baby_form, + JSON_EXTRACT(data, '$.form_name') AS form_name, + JSON_EXTRACT(data, '$.national_dex') AS national_dex, + JSON_EXTRACT(data, '$.generation') AS generation, + JSON_EXTRACT(data, '$.is_baby_form') AS is_baby_form, + JSON_EXTRACT(data, '$.storable_in_home') AS storable_in_home, PFIC as pfic FROM pokemon_forms ''',) diff --git a/ui/main_window_controller.py b/ui/main_window_controller.py index 90b301e..ac0b0bf 100644 --- a/ui/main_window_controller.py +++ b/ui/main_window_controller.py @@ -1,6 +1,7 @@ from PyQt6.QtCore import Qt, QTimer, QThreadPool from PyQt6.QtWidgets import QMenu from PyQt6.QtGui import QAction +import os from ui.workers import GatherPokemonFormsWorker @@ -123,4 +124,28 @@ class MainWindowController: pass def add_encounter_to_set(self): - pass \ No newline at end of file + pass + + def refresh_pokemon_details_panel(self, pfic): + details = db.get_pokemon_details(pfic) + if details: + self.view.name_label.setText(details["name"]) + self.view.form_name_label.setText(details["form_name"] if details["form_name"] else "") + self.view.national_dex_label.setText(str(details["national_dex"])) + self.view.generation_label.setText(str(details["generation"])) + self.view.home_checkbox.setChecked(bool(details["storable_in_home"])) + #self.view.home_checkbox.stateChanged.connect(self.update_home_storable) + self.view.is_baby_form_checkbox.setChecked(bool(details["is_baby_form"])) + + image_path = f"images-new/{pfic}.png" + if os.path.exists(image_path): + pixmap = QPixmap(image_path) + self.view.image_label.setPixmap(pixmap.scaled(150, 150, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation)) + else: + self.view.image_label.setText("Image not found") + + #self.load_evolution_chain(pfic) + #self.load_encounter_locations(pfic) + self.current_pfic = pfic + +