rekordbox_set_list_manager.controllers.edit_controller#

EditController — single entry point for all project mutations.

Classes#

EditController

Routes all model mutations through a single controller with undo/redo.

Module Contents#

class rekordbox_set_list_manager.controllers.edit_controller.EditController(ctrl, parent=None)[source]#

Bases: PySide6.QtCore.QObject

Routes all model mutations through a single controller with undo/redo.

Every public method:
  1. Pushes a JSON snapshot onto the undo stack.

  2. Mutates the project.

  3. Emits project_changed.

Signals#

project_changed : emitted after every mutation.

project_changed[source]#
property can_undo: bool[source]#

Return True if there are undo steps available.

Return type:

bool

property can_redo: bool[source]#

Return True if there are redo steps available.

Return type:

bool

add_section(section)[source]#

Append a new section to the project.

Parameters:

section (Section) – The section to append.

Return type:

None

remove_section(section_id)[source]#

Remove the section identified by section_id from the project.

Parameters:

section_id (UUID) – The ID of the section to remove.

Return type:

None

rename_section(section_id, name)[source]#

Rename the section identified by section_id.

Parameters:
  • section_id (UUID) – The ID of the section to rename.

  • name (str) – The new display name.

Return type:

None

set_section_color(section_id, color)[source]#

Set the display color of the section identified by section_id.

Parameters:
  • section_id (UUID) – The ID of the section to recolor.

  • color (RekordboxColor) – The new color to assign.

Return type:

None

edit_section(section_id, name, section_type, color)[source]#

Rename + retype + recolor a section in one atomic operation.

Parameters:
  • section_id (UUID) – The ID of the section to edit.

  • name (str) – The new display name.

  • section_type (SectionType) – The new section type. Changing the type also resets the color to the project’s default for that type unless color overrides it.

  • color (RekordboxColor | None) – An explicit color override, or None to use the type default.

Return type:

None

move_section(section_id, new_index)[source]#

Move the section identified by section_id to new_index.

Parameters:
  • section_id (UUID) – The ID of the section to reposition.

  • new_index (int) – Target zero-based position in the sections list.

Return type:

None

apply_theme(theme_name)[source]#

Apply the named colour/name theme to all sections.

Parameters:

theme_name (str) – Name of the theme preset to apply.

Return type:

None

recolor_all_by_type()[source]#

Recolor every section to its type’s default color; returns sections changed.

Returns:

The number of sections whose color was updated.

Return type:

int

add_track(track, section_id)[source]#

Add track to the project and append it to the given section.

Parameters:
  • track (Track) – The track to register in the project and append to the section.

  • section_id (UUID) – The ID of the section to append the track to.

Return type:

None

remove_track(track_id, section_id)[source]#

Remove track_id from the specified section.

Parameters:
  • track_id (UUID) – The ID of the track to remove from the section.

  • section_id (UUID) – The ID of the section containing the track.

Return type:

None

move_track(track_id, from_section_id, to_section_id, index)[source]#

Move track_id from one section to another at a given index.

Parameters:
  • track_id (UUID) – The ID of the track to move.

  • from_section_id (UUID) – The section the track is currently in.

  • to_section_id (UUID) – The destination section.

  • index (int) – Target zero-based insertion index in the destination section.

Return type:

None

reorder_section_tracks(section_id, track_ids)[source]#

Replace the track order in a section with the supplied track_ids list.

Parameters:
  • section_id (UUID) – The ID of the section whose track order to replace.

  • track_ids (list[UUID]) – The new ordered list of track IDs for the section.

Return type:

None

apply_match(track_id, local)[source]#

Apply a local-track match result to track_id in the project.

Parameters:
  • track_id (UUID) – The streaming track to update.

  • local (Track | None) – The local Rekordbox track to copy metadata from, or None to clear the existing match.

Return type:

None

undo()[source]#

Restore the project to the previous snapshot.

Return type:

None

redo()[source]#

Re-apply the next snapshot after an undo.

Return type:

None

clear()[source]#

Clear the undo/redo history.

Return type:

None

push_snapshot()[source]#

Push current project state onto undo stack (for external callers).

Return type:

None

notify_changed()[source]#

Mark project dirty and emit project_changed (for external callers).

Use when a mutation was performed outside the EditController but should still be reflected in the undo stack bookkeeping and UI state.

Return type:

None

set_transition_note(section_id, track_id, text)[source]#

Update a transition note without pushing a snapshot.

The caller is responsible for pushing a snapshot beforehand (typically via push_snapshot() triggered by about_to_modify).

Parameters:
  • section_id (UUID) – The section containing the track.

  • track_id (UUID) – The track after which the transition note appears.

  • text (str) – The note text. An empty string removes the note.

Return type:

None

move_tracks_batch(track_ids, from_section_id, to_section_id, dest_index)[source]#

Move multiple tracks from one section to another in a single undo step.

Parameters:
  • track_ids (list[UUID]) – Ordered list of track IDs to move.

  • from_section_id (UUID) – The section the tracks are being moved from.

  • to_section_id (UUID) – The destination section.

  • dest_index (int) – Target zero-based insertion index in the destination section.

Return type:

None

Parameters: