Skip to content

Item Browser Subsystem

Item list panel -- the center panel of the library browser. Displays library items as a flat list with expandable variant children (accordion pattern).

Structure

item_browser/
  model/    -- tree data model and node classes
  view/     -- widget and delegate

Model

item_tree_nodes.py

ItemTreeNode -- lightweight node class (not QObject) for the item tree model. Two levels: item nodes at root, variant nodes as children.

build_item_tree() creates the hierarchy from a list of LibraryItem objects and user settings (for favorite state). Supports sorting by name and filtering.

item_tree_model.py

ItemTreeModel (QAbstractItemModel) -- two-level tree model. Root nodes are items, children are variants. Provides drag support with custom MIME type application/x-library-item-id for drag-and-drop onto folder tree.

View

item_tree_widget.py

ItemTreeWidget -- composite widget wrapping a QTreeView with the item model and delegate. Uses Fusion style for QSS consistency. Double-click toggles the variant accordion (expand/collapse). Indentation is 0 (flat list appearance).

Signals: item_selected(str), variant_selected(str, str), add_variant_requested(str), set_default_variant_requested(str, str), delete_variant_requested(str, str).

item_tree_delegate.py

ItemTreeDelegate (QStyledItemDelegate) -- paints item rows with a colored icon box, item name, type label, variant count badge, and favorite star. Variant child rows are rendered with a simpler indented layout.