|
1 | 1 | # 🏷️ Classification UI Module |
2 | 2 |
|
3 | | -This directory contains the user interface components specifically designed for the **Whole-Video Classification** task. |
| 3 | +This directory contains the specific user interface components designed for the **Whole-Video Classification** task. |
4 | 4 |
|
5 | | -In this mode, users assign attributes (labels) to an entire video clip rather than specific timestamps. The UI is designed to dynamically adapt to the project's JSON schema. |
| 5 | +Unlike the previous monolithic structure, this module is split into two specialized sub-packages (`event_editor` and `media_player`) that plug into the application's common workspace. |
6 | 6 |
|
7 | | -## 📂 File Descriptions |
| 7 | +## 📂 Directory Structure & Modules |
8 | 8 |
|
9 | | -### `panels.py` |
| 9 | +### 1. `event_editor/` (The Right Panel) |
| 10 | +**Responsible for:** Dynamic annotation forms, Schema management, and Task controls. |
10 | 11 |
|
11 | | -This file defines the structural containers for the classification interface. It arranges the screen into three distinct areas: |
| 12 | +* **`editor.py`**: |
| 13 | + * Defines **`ClassificationEventEditor`**: The main container for the right side of the screen. |
| 14 | + * Hosts the **Undo/Redo** buttons specific to classification. |
| 15 | + * Contains the **Schema Editor** (Add Head) and the **Manual Annotation Box** (Confirm/Clear). |
| 16 | +* **`dynamic_widgets.py`**: |
| 17 | + * Contains the logic to programmatically generate UI elements based on the JSON schema: |
| 18 | + * **`DynamicSingleLabelGroup`**: Generates Radio Buttons for mutually exclusive categories. |
| 19 | + * **`DynamicMultiLabelGroup`**: Generates Checkboxes for multi-select categories. |
| 20 | +* **`__init__.py`**: Exposes `ClassificationEventEditor` for external use. |
12 | 21 |
|
13 | | -* **`LeftPanel`**: |
14 | | - * Hosts the **Project Controls** (imported from `ui/common`). |
15 | | - * Displays the **Action Clip List** (File Tree). |
16 | | - * Manages filtering options (All / Done / Not Done). |
17 | | -* **`CenterPanel`**: |
18 | | - * Contains the video player (`VideoViewAndControl`). |
19 | | - * Hosts navigation buttons (Previous/Next Action, Previous/Next Clip). |
20 | | -* **`RightPanel`**: |
21 | | - * **Dynamic Form Area**: Automatically generates input fields based on the project Schema. |
22 | | - * **Manual Annotation Box**: Displays the current selection state and confirmation buttons. |
| 22 | +### 2. `media_player/` (The Center Panel) |
| 23 | +**Responsible for:** Video rendering, playback controls, and navigation. |
23 | 24 |
|
24 | | -### `widgets.py` |
25 | | -**Task-Specific Components** |
26 | | - |
27 | | -This file contains specialized widgets that are mostly generated programmatically based on the user's label definitions: |
28 | | - |
29 | | -* **`DynamicSingleLabelGroup`**: A `QGroupBox` containing **Radio Buttons**. Used when the schema defines a "single_label" type (Mutually exclusive). |
30 | | -* **`DynamicMultiLabelGroup`**: A `QGroupBox` containing **Checkboxes**. Used when the schema defines a "multi_label" type (Multiple selections allowed). |
31 | | -* **`VideoViewAndControl`**: A wrapper widget combining `QVideoWidget`, a custom clickable seek slider, and time labels specific to the classification workflow. |
32 | | - |
33 | | -### `__init__.py` |
34 | | -* Exposes the classes from `panels` and `widgets` to the rest of the application, simplifying import statements. |
| 25 | +* **`preview.py`**: |
| 26 | + * Defines **`MediaPreview`**: A wrapper around `QMediaPlayer` and `QVideoWidget`. |
| 27 | + * Includes the custom **`ClickableSlider`** for instant seeking and time labels (e.g., `00:05 / 01:30`). |
| 28 | +* **`controls.py`**: |
| 29 | + * Defines **`NavigationToolbar`**: Hosts the buttons for navigating between clips (Previous/Next Clip) and actions (Previous/Next Action). |
| 30 | +* **`__init__.py`**: |
| 31 | + * Exposes **`ClassificationMediaPlayer`**: The assembled widget that combines the preview area and the navigation toolbar into a vertical layout. |
35 | 32 |
|
36 | 33 | --- |
37 | 34 |
|
38 | | -## 💡 Key Concepts |
| 35 | +## 🏗️ Architecture Changes |
| 36 | + |
| 37 | +### Where is `panels.py`? |
| 38 | +The specific `LeftPanel`, `CenterPanel`, and `RightPanel` classes have been refactored: |
| 39 | +1. **Left Panel**: Now uses the generic **`CommonProjectTreePanel`** (located in `ui/common/clip_explorer.py`). |
| 40 | +2. **Center & Right Panels**: Now reside in the `media_player` and `event_editor` folders described above. |
| 41 | +3. **Assembly**: The overall layout is now handled by the **`UnifiedTaskPanel`** (in `ui/common/workspace.py`), which composes these components dynamically. |
39 | 42 |
|
40 | | -1. **Dynamic UI Generation**: The **RightPanel** does not have hardcoded buttons for labels (e.g., "Goal", "Foul"). Instead, it reads the `label_definitions` from the Model and instantiates the appropriate `Dynamic...LabelGroup` widgets from `widgets.py` at runtime. |
41 | | -2. **Shared Controls**: The **LeftPanel** embeds the `UnifiedProjectControls` from the `../common/` directory to ensure the "Save/Load/Export" experience is consistent with the Localization mode. |
| 43 | +### Dynamic UI Generation |
| 44 | +The **`event_editor`** module retains the core capability of adapting to the project's data model. It reads `label_definitions` from the Model and instantiates `Dynamic...LabelGroup` widgets at runtime, ensuring the tool works with any classification schema without code changes. |
0 commit comments