jdxi_editor.ui.editors.ab_compare ================================= .. py:module:: jdxi_editor.ui.editors.ab_compare .. autoapi-nested-parse:: Two photos of one part's tone, to switch between while playing. On the Digital and Analog editors, after Undo / Redo / Reload: A, B, Capture and Switch. A photo is the editor's own parameter values, not a SysEx dump. Capture stores the tone in the chosen slot. A and B recall that photo, and Switch recalls the other one. A recall is one Undo step. The photos are kept per part in ~/.jdxi_editor/ab_compare and come back at start; nothing is sent until a slot is pressed. After a program change, or when a photo was stored in another session, a recall asks first. Editing after a recall marks that photo as edited. The other photo stays as it was stored. Attributes ---------- .. autoapisummary:: jdxi_editor.ui.editors.ab_compare.SLOTS jdxi_editor.ui.editors.ab_compare.SCHEMA_VERSION jdxi_editor.ui.editors.ab_compare.PARTS Classes ------- .. autoapisummary:: jdxi_editor.ui.editors.ab_compare.Photo jdxi_editor.ui.editors.ab_compare.ABSession Functions --------- .. autoapisummary:: jdxi_editor.ui.editors.ab_compare.store_dir jdxi_editor.ui.editors.ab_compare.part_of jdxi_editor.ui.editors.ab_compare._store_file jdxi_editor.ui.editors.ab_compare.load_slots jdxi_editor.ui.editors.ab_compare.save_slots jdxi_editor.ui.editors.ab_compare.widgets_of jdxi_editor.ui.editors.ab_compare._read jdxi_editor.ui.editors.ab_compare._bind_check jdxi_editor.ui.editors.ab_compare._bind_mode jdxi_editor.ui.editors.ab_compare._write jdxi_editor.ui.editors.ab_compare.tone_values jdxi_editor.ui.editors.ab_compare.apply_values jdxi_editor.ui.editors.ab_compare._ask_overwrite jdxi_editor.ui.editors.ab_compare._ask_context jdxi_editor.ui.editors.ab_compare._history_row jdxi_editor.ui.editors.ab_compare.install_ab_compare Module Contents --------------- .. py:data:: SLOTS :value: ('A', 'B') .. py:data:: SCHEMA_VERSION :value: 1 .. py:data:: PARTS .. py:function:: store_dir() -> pathlib.Path Where the photos are kept. Tests point this somewhere else. .. py:function:: part_of(editor) -> Optional[str] digital_1, digital_2 or analog, or None for an editor without A/B. .. py:class:: Photo .. py:attribute:: values :type: dict .. py:attribute:: taken_at :type: str .. py:attribute:: epoch :type: Optional[int] :value: None .. py:function:: _store_file(part: str) -> pathlib.Path .. py:function:: load_slots(part: str) -> dict The photos kept for *part*. An unreadable file gives none. .. py:function:: save_slots(part: str, slots: dict) -> bool Keep *part*'s photos. False if they could not be written. .. py:function:: widgets_of(editor) -> list (key, widget) for every tone control. Keys stay stable across sessions. .. py:function:: _read(widget) -> Optional[int] .. py:function:: _bind_check(widget) -> None A checkbox gains value/setValue so a recall of it is an Undo step. .. py:function:: _bind_mode(widget) -> None A mode row gains setValue so a recall of it is an Undo step. .. py:function:: _write(widget, value: int) -> None .. py:function:: tone_values(editor) -> dict The tone the editor shows now, keyed like a photo. .. py:function:: apply_values(editor, values: dict) -> int Set the editor to *values*. One Undo step. How many controls changed. .. py:class:: ABSession(editor, part: str) The two photos of one editor, and which one was recalled last. .. py:attribute:: editor .. py:attribute:: part .. py:attribute:: slots .. py:attribute:: selected :value: 'A' .. py:attribute:: active :type: Optional[str] :value: None .. py:attribute:: modified :value: False .. py:attribute:: notice :value: '' .. py:attribute:: epoch :value: 0 .. py:attribute:: _accepted_epoch :type: Optional[int] :value: None .. py:attribute:: _updating :value: False .. py:attribute:: _on_changed :value: [] .. py:method:: on_changed(callback) -> None .. py:method:: _emit() -> None .. py:method:: note_program_change() -> None Another program: the next recall asks first. .. py:method:: can_switch() -> bool .. py:method:: other() -> str .. py:method:: capture(slot: str, confirm_overwrite=lambda _photo: True) -> bool Store the tone in *slot*. False if the old photo was kept. .. py:method:: recall(slot: str, confirm_context=lambda _photo: True) -> bool Show *slot*'s photo. False if it was not recalled. .. py:method:: switch(confirm_context=lambda _photo: True) -> bool Recall the other photo. .. py:method:: _after_edit() -> None .. py:method:: button_text(slot: str) -> str .. py:function:: _ask_overwrite(editor, slot: str) -> bool .. py:function:: _ask_context(editor, photo: Photo, slot: str) -> bool .. py:function:: _history_row(editor) .. py:function:: install_ab_compare(editor: PySide6.QtWidgets.QWidget) -> Optional[ABSession] A, B, Capture and Switch on a Digital or Analog editor. None otherwise.