Skip to content

server

Traypublisher

Bases: BaseServerAddon

Source code in server/__init__.py
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
class Traypublisher(BaseServerAddon):
    settings_model = TraypublisherSettings

    async def get_default_settings(self):
        settings_model_cls = self.get_settings_model()
        return settings_model_cls(**DEFAULT_TRAYPUBLISHER_SETTING)

    async def get_simple_actions(
        self,
        project_name: str | None = None,
        variant: str = "production",
    ) -> list["SimpleActionManifest"]:
        if not project_name:
            return []
        icon = {
            "type": "material-symbols",
            "name": "upload_2",
            "color": "#ffffff",
        }
        kwargs = {
            "label": "Tray Publisher",
            "category": "Desktop tools",
            "icon": icon,
            "order": 100,
            "entity_subtypes": None,
            "allow_multiselection": False,
        }
        return [
            SimpleActionManifest(
                identifier="traypublisher.project",
                entity_type="project",
                **kwargs
            ),
            SimpleActionManifest(
                identifier="traypublisher.folder",
                entity_type="folder",
                **kwargs
            ),
            SimpleActionManifest(
                identifier="traypublisher.task",
                entity_type="task",
                **kwargs
            ),
        ]

    async def execute_action(
        self,
        executor: "ActionExecutor",
    ) -> "ExecuteResponseModel":
        """Execute an action provided by the addon"""
        context = executor.context
        project_name = context.project_name

        return await executor.get_launcher_action_response(
            args=[
                "addon", "traypublisher",
                "launch", "--project", project_name,
            ]
        )

execute_action(executor) async

Execute an action provided by the addon

Source code in server/__init__.py
61
62
63
64
65
66
67
68
69
70
71
72
73
74
async def execute_action(
    self,
    executor: "ActionExecutor",
) -> "ExecuteResponseModel":
    """Execute an action provided by the addon"""
    context = executor.context
    project_name = context.project_name

    return await executor.get_launcher_action_response(
        args=[
            "addon", "traypublisher",
            "launch", "--project", project_name,
        ]
    )