jdxi_editor.ui.editors.history ============================== .. py:module:: jdxi_editor.ui.editors.history .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: jdxi_editor.ui.editors.history.MERGE_SECONDS jdxi_editor.ui.editors.history.MAX_STEPS Classes ------- .. autoapisummary:: jdxi_editor.ui.editors.history._Edit jdxi_editor.ui.editors.history.EditHistory Functions --------- .. autoapisummary:: jdxi_editor.ui.editors.history._parent_widget jdxi_editor.ui.editors.history.history_of jdxi_editor.ui.editors.history.note_external_value jdxi_editor.ui.editors.history.shown_value jdxi_editor.ui.editors.history.install_edit_history Module Contents --------------- .. py:data:: MERGE_SECONDS :value: 1.0 .. py:data:: MAX_STEPS :value: 30 .. py:function:: _parent_widget(widget) The Qt parent. SynthBase stores the constructor parent on ``parent``, which hides the method. .. py:function:: history_of(widget) -> Optional[EditHistory] The EditHistory of *widget* or one of its parents. .. py:function:: note_external_value(widget) -> None A value arrived with the control's signals blocked: the JD-Xi, not an edit. .. py:function:: shown_value(widget) -> int The value a control shows, the same number its valueChanged signal sends. .. py:class:: _Edit(widget, old: int, new: int) .. py:attribute:: __slots__ :value: ('changes', 'time') .. py:attribute:: changes .. py:attribute:: time .. py:method:: record(widget, old: int, new: int) -> None .. py:class:: EditHistory(editor: PySide6.QtWidgets.QWidget) The user's changes to one editor's controls. .. py:attribute:: editor .. py:attribute:: _undo :type: list[_Edit] :value: [] .. py:attribute:: _redo :type: list[_Edit] :value: [] .. py:attribute:: _origin :type: dict .. py:attribute:: _replaying :value: False .. py:attribute:: _sealed :value: True .. py:attribute:: _group_depth :value: 0 .. py:attribute:: _group :type: Optional[_Edit] :value: None .. py:attribute:: _attach :value: 0 .. py:attribute:: _modified :value: False .. py:attribute:: _on_state :value: [] .. py:attribute:: _on_modified :value: [] .. py:property:: replaying :type: bool .. py:method:: on_state(callback) -> None .. py:method:: on_modified(callback) -> None .. py:method:: record(widget, old: int, new: int) -> None One user change of *widget*, from *old* to *new*. .. py:method:: attached() Changes made inside join the step just recorded (Link partials). .. py:method:: replaying_values() setValue inside is sent, and is not a new step (trying PCM waves). .. py:method:: begin_group() -> None The changes until end_group are one step (several controls, one Undo). .. py:method:: end_group() -> None .. py:method:: _push(edit: _Edit) -> None .. py:method:: external_change(widget) -> None The JD-Xi sent another value: a step on it would restore what the instrument no longer has. .. py:method:: can_undo() -> bool .. py:method:: can_redo() -> bool .. py:method:: can_restore() -> bool Something differs from the sound before the changes (Reload). .. py:method:: undo() -> bool .. py:method:: redo() -> bool .. py:method:: revert() -> bool Restore the values from before this editor's changes and clear the steps. .. py:method:: reset() -> None A new sound: nothing to undo. .. py:method:: _apply_all(values: list) -> bool .. py:method:: _apply(widget, value: int) -> None Set the control as the user would, so the value is sent to the JD-Xi. .. py:method:: _safe_shown(widget) -> Optional[int] :staticmethod: .. py:method:: _update() -> None .. py:function:: install_edit_history(editor: PySide6.QtWidgets.QWidget) -> EditHistory Undo, Redo and Reload at the top of a tone editor, recording its controls.