feat: Add skill search and deck skill views, integrating them into the main application window.

This commit is contained in:
kiyreload27
2025-12-28 20:03:51 +00:00
parent c33d306b74
commit e4c583753a
3 changed files with 225 additions and 78 deletions

View File

@@ -194,78 +194,5 @@ class SkillSearchFrame(ttk.Frame):
self.stats_label.config(text=f"Found {len(cards)} cards")
def set_card(self, card_id):
"""
Show all skills (Hints and Events) for a specific card.
Called by main window when a card is selected in the list.
"""
card = get_card_by_id(card_id)
if not card: return
card_name = card[1]
self.result_header.config(text=f"Skills for: {card_name}")
# Clear tree
for item in self.tree.get_children():
self.tree.delete(item)
all_skills = []
# 1. Get Hints
hints = get_hints(card_id)
for h_name, h_desc in hints:
all_skills.append({
'card_id': card_id,
'name': card_name,
'rarity': card[2],
'type': card[3],
'image_path': card[6],
'source': 'Training Hint',
'details': f"{h_name}: {h_desc}",
'is_owned': bool(card[7])
})
# 2. Get Event Skills
event_dict = get_all_event_skills(card_id)
for ev_name, skills in event_dict.items():
all_skills.append({
'card_id': card_id,
'name': card_name,
'rarity': card[2],
'type': card[3],
'image_path': card[6],
'source': 'Event',
'details': f"{ev_name} ({', '.join(skills)})",
'is_owned': bool(card[7])
})
# Display them
for skill in all_skills:
img = self.icon_cache.get(skill['card_id'])
if not img:
resolved_path = resolve_image_path(skill['image_path'])
if resolved_path and os.path.exists(resolved_path):
try:
pil_img = Image.open(resolved_path)
pil_img.thumbnail((32, 32), Image.Resampling.LANCZOS)
img = ImageTk.PhotoImage(pil_img)
self.icon_cache[skill['card_id']] = img
except: pass
type_display = f"{get_type_icon(skill['type'])} {skill['type']}"
owned_mark = "" if skill.get('is_owned') else ""
values = (
owned_mark,
skill['name'],
skill['rarity'],
type_display,
skill['source'],
skill['details']
)
if img:
self.tree.insert('', tk.END, text='', image=img, values=values)
else:
self.tree.insert('', tk.END, text='?', values=values)
self.stats_label.config(text=f"Showing {len(all_skills)} skill sources for {card_name}")
"""No longer responsive to card selection in this tab"""
pass