4.9 KiB
4.9 KiB
Asset Processor GUI Development Plan
This document outlines the plan for developing a Graphical User Interface (GUI) for the Asset Processor Tool.
I. Foundation & Framework Choice
- Choose GUI Framework: PySide6 (LGPL license, powerful features).
- Project Structure: Create
gui/directory. Core logic remains separate. - Dependencies: Add
PySide6torequirements.txt.
II. Core GUI Layout & Basic Functionality
- Main Window:
gui/main_window.py. - Layout Elements:
- Drag & Drop Area (
QWidgetsubclass). - Preset Dropdown (
QComboBox). - Preview Area (
QListWidget). - Progress Bar (
QProgressBar). - Control Buttons (
QPushButton: Start, Cancel, Manage Presets). - Status Bar (
QStatusBar).
- Drag & Drop Area (
III. Input Handling & Predictive Preview
- Connect Drag & Drop: Validate drops, add valid paths to Preview List.
- Refactor for Prediction: Create/refactor methods in
AssetProcessor/Configurationto predict output names without full processing. - Implement Preview Update: On preset change or file add, load config, call prediction logic, update Preview List items (e.g., "Input: ... -> Output: ...").
- Responsive Preview: Utilize PySide6 list widget efficiency (consider model/view for very large lists).
IV. Processing Integration & Progress Reporting
- Adapt Processing Logic: Refactor
main.py'sProcessPoolExecutorloop into a callable function/class (gui/processing_handler.py). - Background Execution: Run processing logic in a
QThreadto keep GUI responsive. - Progress Updates (Signals & Slots):
- Background thread emits signals:
progress_update(current, total),file_status_update(path, status, msg),processing_finished(stats). - Main window connects slots to these signals to update UI elements (
QProgressBar,QListWidgetitems, status bar).
- Background thread emits signals:
- Completion/Error Handling: Re-enable controls, display summary stats, report errors on
processing_finished.
V. Preset Management Interface (Sub-Task)
- New Window/Dialog:
gui/preset_editor.py. - Functionality: List, load, edit (tree view/form), create, save/save as presets (
.jsoninpresets/). Basic validation.
VI. Refinements & Additional Features (Ideas)
- Cancel Button: Implement cancellation signal to background thread/workers.
- Log Viewer: Add
QTextEditto displayloggingoutput. - Output Directory Selection: Add browse button/field.
- Configuration Options: Expose key
config.pysettings. - Clearer Error Display: Tooltips, status bar updates, or error panel.
VII. Packaging (Deployment)
- Tooling: PyInstaller or cx_Freeze.
- Configuration: Build scripts (
.spec) to bundle code, dependencies, assets, andpresets/.
High-Level Mermaid Diagram:
graph TD
subgraph GUI Application (PySide6)
A[Main Window] --> B(Drag & Drop Area);
A --> C(Preset Dropdown);
A --> D(Preview List Widget);
A --> E(Progress Bar);
A --> F(Start Button);
A -- Contains --> SB(Status Bar);
A --> CB(Cancel Button);
A --> MB(Manage Presets Button);
B -- fileDroppedSignal --> X(Handle Input Files);
C -- currentIndexChangedSignal --> Y(Update Preview);
X -- Adds paths --> D;
X -- Triggers --> Y;
Y -- Reads --> C;
Y -- Uses --> J(Prediction Logic);
Y -- Updates --> D;
F -- clickedSignal --> Z(Start Processing);
CB -- clickedSignal --> AA(Cancel Processing);
MB -- clickedSignal --> L(Preset Editor Dialog);
Z -- Starts --> BB(Processing Thread: QThread);
AA -- Signals --> BB;
BB -- progressSignal(curr, total) --> E;
BB -- fileStatusSignal(path, status, msg) --> D;
BB -- finishedSignal(stats) --> AB(Handle Processing Finished);
AB -- Updates --> SB;
AB -- Enables/Disables --> F;
AB -- Enables/Disables --> CB;
AB -- Enables/Disables --> C;
AB -- Enables/Disables --> B;
L -- Modifies --> H(Presets Dir: presets/*.json);
end
subgraph Backend Logic (Existing + Refactored)
H -- Loaded by --> C;
H -- Loaded/Saved by --> L;
J -- Reads --> M(configuration.py / asset_processor.py);
BB -- Runs --> K(Adapted main.py Logic);
K -- Uses --> N(ProcessPoolExecutor);
N -- Runs --> O(process_single_asset_wrapper);
O -- Uses --> M;
O -- Reports Status --> K;
K -- Reports Progress --> BB;
end
classDef gui fill:#f9f,stroke:#333,stroke-width:2px;
classDef backend fill:#ccf,stroke:#333,stroke-width:2px;
classDef thread fill:#ffc,stroke:#333,stroke-width:1px;
class A,B,C,D,E,F,CB,MB,L,SB,X,Y,Z,AA,AB gui;
class H,J,K,M,N,O backend;
class BB thread;
This plan provides a roadmap for the GUI development.