Asset-Frameworker/Tickets/ISSUE-GUI-PreviewNotUpdatingOnDrop.md
2025-04-29 18:26:13 +02:00

3.2 KiB

Issue: GUI Preview Not Updating on File Drop Without Preset Selection

ID: ISSUE-GUI-PreviewNotUpdatingOnDrop Date: 2025-04-28 Status: Open Priority: High

Description: The file preview list (QTableView in the main panel) does not populate when files or folders are dropped onto the application if a valid preset has not been explicitly selected after the application starts and before the drop event.

Root Cause:

  • The add_input_paths method in gui/main_window.py correctly calls update_preview after files are added via drag-and-drop.
  • However, the update_preview method checks self.editor_preset_list.currentItem() to get the selected preset.
  • If no preset is selected, or if the placeholder "--- Select a Preset ---" is selected, update_preview correctly identifies this and returns before starting the PredictionHandler thread.
  • This prevents the file prediction from running and the preview table from being populated, even if assets have been added.

Expected Behavior: Dropping files should trigger a preview update based on the last valid preset selected by the user, or potentially prompt the user to select a preset if none has ever been selected. The preview should not remain empty simply because the user hasn't re-clicked the preset list immediately before dropping files.

Proposed Solution:

  1. Modify MainWindow to store the last validly selected preset path.
  2. Update the update_preview method:
    • Instead of relying solely on currentItem(), use the stored last valid preset path if currentItem() is invalid or the placeholder.
    • If no valid preset has ever been selected, display a clear message in the status bar or a dialog box prompting the user to select a preset first.
    • Ensure the prediction handler is triggered with the correct preset name based on this updated logic.

Affected Files:

  • gui/main_window.py

Debugging Steps Taken:

  • Confirmed AssetProcessor.__init__ error was fixed.
  • Added logging to PredictionHandler and MainWindow.
  • Logs confirmed update_preview is called on drop, but exits early due to no valid preset being selected via currentItem().

During a recent session, work was done to implement a feature allowing GUI editing of the file preview list, specifically the file status and predicted output name.

This involved defining a data interface (ProjectNotes/Data_Structures/Preview_Edit_Interface.md) and modifying several GUI and backend components.

Key files modified for this feature include:

  • gui/prediction_handler.py
  • gui/preview_table_model.py
  • gui/main_window.py
  • gui/processing_handler.py
  • Core asset_processor logic

The changes involved passing the editable file_list and asset_properties data structure through the prediction handler, to the preview table model, and finally to the processing handler. The preview table model was made editable to allow user interaction. The backend logic was updated to utilize this editable data.

Debugging steps taken during this implementation included fixing indentation errors and resolving an AssetProcessor instantiation issue that occurred during the prediction phase.