jdxi_editor.ui.editors.history

Undo, redo and reload for one tone editor.

A change is recorded where a control sends a parameter. A drag of one slider is one step. A value applied with the control’s signals blocked came from the JD-Xi, so it is not a step: it becomes the value undo returns to. Reload puts back every value as it was before its first change.

Attributes

MERGE_SECONDS

MAX_STEPS

Classes

_Edit

EditHistory

The user's changes to one editor's controls.

Functions

_parent_widget(widget)

The Qt parent. SynthBase stores the constructor parent on parent, which hides the method.

history_of(widget) → Optional[EditHistory]

The EditHistory of widget or one of its parents.

note_external_value(widget) → None

A value arrived with the control's signals blocked: the JD-Xi, not an edit.

shown_value(widget) → int

The value a control shows, the same number its valueChanged signal sends.

install_edit_history(editor) → EditHistory

Undo, Redo and Reload at the top of a tone editor, recording its controls.

Module Contents

jdxi_editor.ui.editors.history.MERGE_SECONDS = 1.0[source]
jdxi_editor.ui.editors.history.MAX_STEPS = 30[source]
jdxi_editor.ui.editors.history._parent_widget(widget)[source]

The Qt parent. SynthBase stores the constructor parent on parent, which hides the method.

jdxi_editor.ui.editors.history.history_of(widget) → EditHistory | None[source]

The EditHistory of widget or one of its parents.

jdxi_editor.ui.editors.history.note_external_value(widget) → None[source]

A value arrived with the control’s signals blocked: the JD-Xi, not an edit.

jdxi_editor.ui.editors.history.shown_value(widget) → int[source]

The value a control shows, the same number its valueChanged signal sends.

class jdxi_editor.ui.editors.history._Edit(widget, old: int, new: int)[source]
__slots__ = ('changes', 'time')[source]
changes[source]
time[source]
record(widget, old: int, new: int) → None[source]
class jdxi_editor.ui.editors.history.EditHistory(editor: PySide6.QtWidgets.QWidget)[source]

The user’s changes to one editor’s controls.

editor[source]
_undo: list[_Edit] = [][source]
_redo: list[_Edit] = [][source]
_origin: dict[source]
_replaying = False[source]
_sealed = True[source]
_group_depth = 0[source]
_group: _Edit | None = None[source]
_attach = 0[source]
_modified = False[source]
_on_state = [][source]
_on_modified = [][source]
property replaying: bool[source]
on_state(callback) → None[source]
on_modified(callback) → None[source]
record(widget, old: int, new: int) → None[source]

One user change of widget, from old to new.

attached()[source]

Changes made inside join the step just recorded (Link partials).

replaying_values()[source]

setValue inside is sent, and is not a new step (trying PCM waves).

begin_group() → None[source]

The changes until end_group are one step (several controls, one Undo).

end_group() → None[source]
_push(edit: _Edit) → None[source]
external_change(widget) → None[source]

The JD-Xi sent another value: a step on it would restore what the instrument no longer has.

can_undo() → bool[source]
can_redo() → bool[source]
can_restore() → bool[source]

Something differs from the sound before the changes (Reload).

undo() → bool[source]
redo() → bool[source]
revert() → bool[source]

Restore the values from before this editor’s changes and clear the steps.

reset() → None[source]

A new sound: nothing to undo.

_apply_all(values: list) → bool[source]
_apply(widget, value: int) → None[source]

Set the control as the user would, so the value is sent to the JD-Xi.

static _safe_shown(widget) → int | None[source]
_update() → None[source]
jdxi_editor.ui.editors.history.install_edit_history(editor: PySide6.QtWidgets.QWidget) → EditHistory[source]

Undo, Redo and Reload at the top of a tone editor, recording its controls.