Browse Source

- Hook up the on select for the details pane

feature-new-db-implementation
Quildra 1 year ago
parent
commit
2946c95109
  1. 2
      database/db_controller.py
  2. 25
      ui/main_window_controller.py

2
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,))
@ -90,6 +91,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,
PFIC as pfic
FROM pokemon_forms
''',)

25
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
@ -124,3 +125,27 @@ class MainWindowController:
def add_encounter_to_set(self):
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

Loading…
Cancel
Save