mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
This is preparation for new version of pydantic which will require to customize the field for AYON purposes and raw pydantic Field could not be used.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from ayon_server.settings import BaseSettingsModel, SettingsField
|
|
|
|
|
|
class ScriptsmenuSubmodel(BaseSettingsModel):
|
|
"""Item Definition"""
|
|
_isGroup = True
|
|
|
|
type: str = SettingsField(title="Type")
|
|
command: str = SettingsField(title="Command")
|
|
sourcetype: str = SettingsField(title="Source Type")
|
|
title: str = SettingsField(title="Title")
|
|
tooltip: str = SettingsField(title="Tooltip")
|
|
|
|
|
|
class ScriptsmenuSettings(BaseSettingsModel):
|
|
"""Nuke script menu project settings."""
|
|
_isGroup = True
|
|
|
|
"""# TODO: enhance settings with host api:
|
|
- in api rename key `name` to `menu_name`
|
|
"""
|
|
name: str = SettingsField(title="Menu name")
|
|
definition: list[ScriptsmenuSubmodel] = SettingsField(
|
|
default_factory=list,
|
|
title="Definition",
|
|
description="Scriptmenu Items Definition")
|
|
|
|
|
|
DEFAULT_SCRIPTSMENU_SETTINGS = {
|
|
"name": "Custom Tools",
|
|
"definition": [
|
|
{
|
|
"type": "action",
|
|
"sourcetype": "python",
|
|
"title": "Ayon Hiero Docs",
|
|
"command": "import webbrowser;webbrowser.open(url='https://ayon.ynput.io/docs/addon_hiero_artist')", # noqa
|
|
"tooltip": "Open the Ayon Hiero user doc page"
|
|
}
|
|
]
|
|
}
|