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_pathsmethod ingui/main_window.pycorrectly callsupdate_previewafter files are added via drag-and-drop. - However, the
update_previewmethod checksself.editor_preset_list.currentItem()to get the selected preset. - If no preset is selected, or if the placeholder "--- Select a Preset ---" is selected,
update_previewcorrectly identifies this and returns before starting thePredictionHandlerthread. - 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:
- Modify
MainWindowto store the last validly selected preset path. - Update the
update_previewmethod:- Instead of relying solely on
currentItem(), use the stored last valid preset path ifcurrentItem()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.
- Instead of relying solely on
Affected Files:
gui/main_window.py
Debugging Steps Taken:
- Confirmed
AssetProcessor.__init__error was fixed. - Added logging to
PredictionHandlerandMainWindow. - Logs confirmed
update_previewis called on drop, but exits early due to no valid preset being selected viacurrentItem().
Related Changes (Session 2025-04-28)
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.pygui/preview_table_model.pygui/main_window.pygui/processing_handler.py- Core
asset_processorlogic
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.