jdxi_editor.ui.style.user_skins =============================== .. py:module:: jdxi_editor.ui.style.user_skins .. autoapi-nested-parse:: User skins ========== Skins a user writes as TOML files, with no code, offered in the JDXiSkin menu beside the built-in ones. The files live in ``~/.jdxi_editor/skins/`` (:data:`USER_SKIN_DIR`), one skin per ``*.toml`` file, and are read once when the editor starts. The format is picoui's (see :mod:`picoui.skin.loader`), with what the editor adds: - under ``[skin]``, ``meter = "bars"``, ``"needles"`` or ``"vintage_vu"`` (the Audio Monitor's meters, :class:`~jdxi_editor.ui.style.rack_skin.MeterStyle`); - a ``[lanes]`` table for the MIDI player: ``cards = true`` for punched cards, and ``backing`` the material they lie on; - ``based_on`` may name any built-in skin, such as ``"tr909"``; - the editor's woods may be named as gradients: ``"mini_wood"``, ``"juno_wood"``. A file with a mistake is skipped, and the editor says why in its log, rather than failing to start. A user skin cannot take a built-in skin's id. See ``doc/skins/tr1000_user.toml`` for a complete example. Attributes ---------- .. autoapisummary:: jdxi_editor.ui.style.user_skins.USER_SKIN_DIR jdxi_editor.ui.style.user_skins.EDITOR_GRADIENTS jdxi_editor.ui.style.user_skins.BUILT_IN_IDS Functions --------- .. autoapisummary:: jdxi_editor.ui.style.user_skins._meter jdxi_editor.ui.style.user_skins._lanes jdxi_editor.ui.style.user_skins.skin_from_tables jdxi_editor.ui.style.user_skins.load_user_skin jdxi_editor.ui.style.user_skins.skin_id_from_label jdxi_editor.ui.style.user_skins.user_skin_path jdxi_editor.ui.style.user_skins.save_user_skin jdxi_editor.ui.style.user_skins.load_user_skins Module Contents --------------- .. py:data:: USER_SKIN_DIR .. py:data:: EDITOR_GRADIENTS .. py:data:: BUILT_IN_IDS .. py:function:: _meter(value: Any) -> jdxi_editor.ui.style.rack_skin.MeterStyle .. py:function:: _lanes(table: Mapping[str, Any], resolver: picoui.skin.loader.Resolver) -> jdxi_editor.ui.style.rack_skin.LaneStyle .. py:function:: skin_from_tables(data: Mapping[str, Any], registry=REGISTRY) -> jdxi_editor.ui.style.rack_skin.JDXiSkin A user skin from a skin file's tables (as read, or as the Skin Editor holds them). :param data: the tables :param registry: SkinRegistry whose skins it may be based on :return: JDXiSkin :raises SkinFileError: saying where the fault is .. py:function:: load_user_skin(path: pathlib.Path, registry=REGISTRY) -> jdxi_editor.ui.style.rack_skin.JDXiSkin One user skin from its file. :param path: Path the .toml file :param registry: SkinRegistry whose skins a file may be based on :return: JDXiSkin :raises SkinFileError: naming the file and where in it the fault is .. py:function:: skin_id_from_label(label: str) -> str An id for a skin named ``label``: lower case, words joined by "_". :param label: str such as "My TR-909" :return: str such as "my_tr_909" .. py:function:: user_skin_path(skin_id: str, folder: Optional[pathlib.Path] = None) -> pathlib.Path Where the skin ``skin_id`` is saved. :param skin_id: str :param folder: Path; :data:`USER_SKIN_DIR` if None :return: Path .. py:function:: save_user_skin(data: Mapping[str, Any], folder: Optional[pathlib.Path] = None) -> pathlib.Path Write a skin's tables to its file, as TOML. :param data: the tables; ``data["skin"]["id"]`` names the file :param folder: Path; :data:`USER_SKIN_DIR` if None :return: Path the file written :raises ValueError: for a built-in skin's id .. py:function:: load_user_skins(folder: Optional[pathlib.Path] = None, registry=REGISTRY) -> List[jdxi_editor.ui.style.rack_skin.JDXiSkin] Offer every skin in ``folder``'s ``*.toml`` files, in name order. Call once at start-up, before the window builds its JDXiSkin menu. A file with a mistake, or one taking a built-in skin's id, is skipped and logged. :param folder: Path; :data:`USER_SKIN_DIR` if None :param registry: SkinRegistry to offer them in :return: the skins offered