diff --git a/ui/attachment_selector.py b/ui/attachment_selector.py index f1820d7..0d543ac 100644 --- a/ui/attachment_selector.py +++ b/ui/attachment_selector.py @@ -14,6 +14,9 @@ from PyQt6.QtGui import QColor from typing import Optional, List from core.nexus_full_api import get_nexus_api, NexusAttachment +import logging + +logger = logging.getLogger(__name__) class AttachmentLoaderThread(QThread): @@ -24,8 +27,37 @@ class AttachmentLoaderThread(QThread): def run(self): try: api = get_nexus_api() - attachments = api.get_all_attachments() - self.attachments_loaded.emit(attachments) + # Fetch all attachment types separately + all_attachments = [] + + # Get amplifiers + try: + amps = api.get_all_amplifiers() + for amp in amps: + amp.attachment_type = "amplifier" + all_attachments.extend(amps) + except Exception as e: + logger.warning(f"Could not load amplifiers: {e}") + + # Get scopes/sights + try: + scopes = api.get_all_scopes() + for scope in scopes: + scope.attachment_type = "scope" + all_attachments.extend(scopes) + except Exception as e: + logger.warning(f"Could not load scopes: {e}") + + # Get absorbers + try: + absorbers = api.get_all_absorbers() + for absorber in absorbers: + absorber.attachment_type = "absorber" + all_attachments.extend(absorbers) + except Exception as e: + logger.warning(f"Could not load absorbers: {e}") + + self.attachments_loaded.emit(all_attachments) except Exception as e: self.error_occurred.emit(str(e))