jdxi_editor.ui.windows.skin.editor ================================== .. py:module:: jdxi_editor.ui.windows.skin.editor .. autoapi-nested-parse:: Skin Editor =========== Make a skin of your own without writing a file by hand: start from any skin, change its colours, sizes, meters and lanes, see it in a live preview, and save it as a user skin (``~/.jdxi_editor/skins/.toml``, see :mod:`jdxi_editor.ui.style.user_skins`), which joins the JDXiSkin menu. The window edits the skin file's tables directly, the same tables a file holds. A field left alone is inherited from the skin it is based on, and is not written; a field you change is written, and its reset button (↺) takes it out again. Parts the form does not show -- named colours, gradients, a decoration's sizes -- are kept as they are when an existing file is opened and saved. The colours of the panel's decorations (rules, step buttons, a keyboard) and of the cheeks' and rail's details (patch cords, grilles, cables) are offered too. A file can only replace such a list, not change one item of it, so the first colour changed writes the inherited list out whole; its ↺ takes the whole list out again. Attributes ---------- .. autoapisummary:: jdxi_editor.ui.windows.skin.editor.PALETTE_FIELDS jdxi_editor.ui.windows.skin.editor.LANE_CHOICES jdxi_editor.ui.windows.skin.editor.DETAIL_LISTS jdxi_editor.ui.windows.skin.editor.DETAIL_NAMES jdxi_editor.ui.windows.skin.editor.DETAIL_COLOR_NAMES jdxi_editor.ui.windows.skin.editor.DetailSlot jdxi_editor.ui.windows.skin.editor.SIZE_FIELDS Classes ------- .. autoapisummary:: jdxi_editor.ui.windows.skin.editor.ColorButton jdxi_editor.ui.windows.skin.editor.LcdSample jdxi_editor.ui.windows.skin.editor.SkinPreview jdxi_editor.ui.windows.skin.editor.SkinEditorWindow Functions --------- .. autoapisummary:: jdxi_editor.ui.windows.skin.editor.detail_slots jdxi_editor.ui.windows.skin.editor.detail_title jdxi_editor.ui.windows.skin.editor._hex Module Contents --------------- .. py:data:: PALETTE_FIELDS :type: Dict[str, List[Tuple[str, str]]] .. py:data:: LANE_CHOICES :type: List[Tuple[str, Optional[Dict[str, Any]]]] .. py:data:: DETAIL_LISTS :value: [('face', 'decorations', 'Panel decorations'), ('face', 'overlays', 'Panel overlays'), ('ear',... .. py:data:: DETAIL_NAMES .. py:data:: DETAIL_COLOR_NAMES .. py:data:: DetailSlot .. py:function:: detail_slots(item: Any) -> List[Tuple[Tuple[Any, ...], str, Any]] The colours of a decoration or detail: (path, label, rgba) each. .. py:function:: detail_title(item: Any) -> str "Rule (top)": what a decoration or detail is, and where. .. py:data:: SIZE_FIELDS :value: [('ear_width', 'Cheek width', 40), ('bezel', 'Bezel', 20), ('rail_height', 'Rail height', 30)] .. py:function:: _hex(color: Any) -> str "#RRGGBB" from a QColor, an RGBA tuple or text. .. py:class:: ColorButton(parent: Optional[PySide6.QtWidgets.QWidget] = None) Bases: :py:obj:`PySide6.QtWidgets.QPushButton` A swatch with its "#RRGGBB"; clicking it picks another colour. .. py:attribute:: colorChosen .. py:attribute:: _color :value: '#000000' .. py:method:: color() -> str .. py:method:: set_color(color: str) -> None Show ``color`` without telling anyone. .. py:method:: _pick() -> None .. py:class:: LcdSample(parent: Optional[PySide6.QtWidgets.QWidget] = None) Bases: :py:obj:`PySide6.QtWidgets.QWidget` A few characters on a screen in the skin's display palette. .. py:attribute:: _lcd :value: None .. py:method:: set_lcd(lcd) -> None .. py:method:: paintEvent(_event) -> None .. py:class:: SkinPreview(parent: Optional[PySide6.QtWidgets.QWidget] = None) Bases: :py:obj:`PySide6.QtWidgets.QWidget` A panel wearing the skin being edited, with lettering and a display. .. py:attribute:: title .. py:attribute:: subtitle .. py:attribute:: rule .. py:attribute:: lcd .. py:attribute:: panel .. py:attribute:: _body .. py:method:: set_skin(skin: picoui.skin.Skin) -> None .. py:method:: paintEvent(_event) -> None .. py:class:: SkinEditorWindow(parent: Optional[PySide6.QtWidgets.QWidget] = None, wear: Optional[Callable[[picoui.skin.Skin, bool], None]] = None, saved: Optional[Callable[[picoui.skin.Skin], None]] = None, folder: Optional[pathlib.Path] = None) Bases: :py:obj:`PySide6.QtWidgets.QMainWindow` Edit a user skin's tables with a live preview, and save them to a file. :param parent: the main window :param wear: called with (skin, remember) to put a skin on the editor :param saved: called with the skin once it is saved and offered :param folder: where user skins are saved; :data:`USER_SKIN_DIR` if None .. py:attribute:: _wear :value: None .. py:attribute:: _saved :value: None .. py:attribute:: _folder .. py:attribute:: _worn_before :value: None .. py:attribute:: _trying :value: False .. py:attribute:: _path :type: Optional[pathlib.Path] :value: None .. py:attribute:: _id_follows_label :value: True .. py:attribute:: _skin :type: Optional[picoui.skin.Skin] :value: None .. py:attribute:: _updating :value: False .. py:attribute:: _data :type: Dict[str, Any] .. py:attribute:: _rebuild .. py:method:: _build_ui() -> None .. py:method:: _row(key: Tuple[str, str], widget: PySide6.QtWidgets.QWidget) -> PySide6.QtWidgets.QWidget A field and its reset button. .. py:method:: _identity_group() -> PySide6.QtWidgets.QGroupBox .. py:method:: _sizes_group() -> PySide6.QtWidgets.QGroupBox .. py:method:: _palette_group(table: str, title: str) -> PySide6.QtWidgets.QGroupBox .. py:method:: _face_group() -> PySide6.QtWidgets.QGroupBox .. py:method:: _ear_group() -> PySide6.QtWidgets.QGroupBox .. py:method:: _details_group() -> PySide6.QtWidgets.QGroupBox The colours of the panel's decorations and the cheeks' and rail's details; its rows are made to fit the skin (see :meth:`_fill_details`). .. py:method:: _features_group() -> PySide6.QtWidgets.QGroupBox .. py:method:: _table(name: str) -> Dict[str, Any] .. py:method:: _edited(table: str, key: str, value: Any) -> None .. py:method:: _reset(table: str, key: str) -> None .. py:method:: _changed() -> None .. py:method:: tables() -> Dict[str, Any] A copy of the skin file's tables, as they would be saved. .. py:method:: new_skin(based_on: str) -> None Start a new skin from ``based_on``, changing nothing yet. .. py:method:: open_file(path: pathlib.Path) -> None Edit the skin in ``path``. .. py:method:: _free_id(skin_id: str) -> str ``skin_id``, numbered if a skin or file already has it. .. py:method:: _label_edited(text: str) -> None .. py:method:: _id_edited(text: str) -> None .. py:method:: _based_on_changed(_index: int) -> None .. py:method:: _meter_changed(_index: int) -> None .. py:method:: _lanes_changed(_index: int) -> None .. py:method:: _repaint_face_toggled(on: bool) -> None .. py:method:: _write_face_material() -> None .. py:method:: _repaint_ear_toggled(on: bool) -> None .. py:method:: _write_ear_material() -> None .. py:method:: _detail_edited(slot: DetailSlot, color: str) -> None A decoration's or detail's colour changed. A list inherited from the skin it is based on is written out whole first, as a file can only replace a list, then the one colour is changed in it. .. py:method:: _detail_color(slot: DetailSlot) The colour a slot shows now, as RGBA, or None. .. py:method:: _build(refresh_form: bool = False) -> None Make the skin from the tables; show it, or say what is wrong. .. py:method:: _id_problem() -> Optional[str] .. py:method:: _say(text: str, error: bool = False) -> None .. py:method:: _refresh_form(skin: Optional[picoui.skin.Skin]) -> None Show the skin's values: changed ones bold, inherited ones plain. .. py:method:: _fill_details(skin: picoui.skin.Skin) -> None A row per colour of each decoration and detail the skin has, under a heading per list; remade only when the skin's lists change shape. .. py:method:: _make_detail_rows(lists) -> None .. py:method:: _fill_based_on(based_on: Optional[str]) -> None .. py:method:: _shown_color(skin: picoui.skin.Skin, table: str, key: str) -> Optional[str] :staticmethod: .. py:method:: _fill_stops(buttons: List[ColorButton], material, fallback: str, checked: bool) -> None :staticmethod: The repaint colours: the current gradient's, else the body's shades. .. py:method:: _choose_new() -> None .. py:method:: _open() -> None .. py:method:: _try_on() -> None .. py:method:: save() -> Optional[pathlib.Path] Save the skin, offer it, and wear it; returns the file, or None. .. py:method:: _save() -> None .. py:method:: closeEvent(event) -> None