Skip to content

AYON_in_flame

app_initialized(parent=None)

Inicialization of Framework

Parameters:

Name Type Description Default
parent obj

Parent object. Defaults to None.

None
Source code in client/ayon_flame/startup/AYON_in_flame.py
87
88
89
90
91
92
93
94
95
96
97
def app_initialized(parent=None):
    """Inicialization of Framework

    Args:
        parent (obj, optional): Parent object. Defaults to None.
    """
    flame_api.CTX.app_framework = flame_api.FlameAppFramework()

    print(f"{flame_api.CTX.app_framework.bundle_name} initializing")

    load_apps()

ayon_flame_install()

Registering AYON in context

Source code in client/ayon_flame/startup/AYON_in_flame.py
13
14
15
16
17
def ayon_flame_install():
    """Registering AYON in context
    """
    flame_host = FlameHost()
    install_host(flame_host)

cleanup()

Cleaning up Flame framework context

Source code in client/ayon_flame/startup/AYON_in_flame.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
def cleanup():
    """Cleaning up Flame framework context
    """
    if flame_api.CTX.flame_apps:
        print(
            f"`{__file__}` cleaning up flame_apps:\n "
            f"{pformat(flame_api.CTX.flame_apps)}\n"
        )
        while len(flame_api.CTX.flame_apps):
            app = flame_api.CTX.flame_apps.pop()
            print(f"`{__file__}` removing : {app.name}")
            del app
        flame_api.CTX.flame_apps = []

    if flame_api.CTX.app_framework:
        print(f"AYON\t: {flame_api.CTX.app_framework.bundle_name} cleaning up")
        flame_api.CTX.app_framework.save_prefs()
        flame_api.CTX.app_framework = None

exception_handler(exctype, value, _traceback)

Exception handler for improving UX

Parameters:

Name Type Description Default
exctype str

type of exception

required
value str

exception value

required
tb str

traceback to show

required
Source code in client/ayon_flame/startup/AYON_in_flame.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def exception_handler(exctype, value, _traceback):
    """Exception handler for improving UX

    Args:
        exctype (str): type of exception
        value (str): exception value
        tb (str): traceback to show
    """
    msg = f"AYON: Python exception {value} in {exctype}"
    mbox = QtWidgets.QMessageBox()
    mbox.setText(msg)
    mbox.setDetailedText(
        pformat(traceback.format_exception(exctype, value, _traceback)))
    mbox.setStyleSheet("QLabel{min-width: 800px;}")
    mbox.exec_()
    sys.__excepthook__(exctype, value, _traceback)

get_batch_custom_ui_actions()

Hook to create submenu in batch

Returns:

Name Type Description
list

menu object

Source code in client/ayon_flame/startup/AYON_in_flame.py
194
195
196
197
198
199
200
201
202
203
def get_batch_custom_ui_actions():
    """Hook to create submenu in batch

    Returns:
        list: menu object
    """
    # install AYON and the host
    ayon_flame_install()

    return _build_app_menu("FlameMenuUniversal")

get_main_menu_custom_ui_actions()

Hook to create submenu in start menu

Returns:

Name Type Description
list

menu object

Source code in client/ayon_flame/startup/AYON_in_flame.py
170
171
172
173
174
175
176
177
178
179
def get_main_menu_custom_ui_actions():
    """Hook to create submenu in start menu

    Returns:
        list: menu object
    """
    # install AYON and the host
    ayon_flame_install()

    return _build_app_menu("FlameMenuProjectConnect")

get_media_panel_custom_ui_actions()

Hook to create submenu in desktop

Returns:

Name Type Description
list

menu object

Source code in client/ayon_flame/startup/AYON_in_flame.py
206
207
208
209
210
211
212
213
214
215
def get_media_panel_custom_ui_actions():
    """Hook to create submenu in desktop

    Returns:
        list: menu object
    """
    # install AYON and the host
    ayon_flame_install()

    return _build_app_menu("FlameMenuUniversal")

get_timeline_custom_ui_actions()

Hook to create submenu in timeline

Returns:

Name Type Description
list

menu object

Source code in client/ayon_flame/startup/AYON_in_flame.py
182
183
184
185
186
187
188
189
190
191
def get_timeline_custom_ui_actions():
    """Hook to create submenu in timeline

    Returns:
        list: menu object
    """
    # install AYON and the host
    ayon_flame_install()

    return _build_app_menu("FlameMenuTimeline")

load_apps()

Load available flame_apps into Flame framework

Source code in client/ayon_flame/startup/AYON_in_flame.py
66
67
68
69
70
71
72
73
74
75
def load_apps():
    """Load available flame_apps into Flame framework
    """
    flame_api.CTX.flame_apps.append(
        flame_api.FlameMenuProjectConnect(flame_api.CTX.app_framework))
    flame_api.CTX.flame_apps.append(
        flame_api.FlameMenuTimeline(flame_api.CTX.app_framework))
    flame_api.CTX.flame_apps.append(
        flame_api.FlameMenuUniversal(flame_api.CTX.app_framework))
    flame_api.CTX.app_framework.log.info("Apps are loaded")

project_changed_dict(info)

Hook for project change action

Parameters:

Name Type Description Default
info str

info text

required
Source code in client/ayon_flame/startup/AYON_in_flame.py
78
79
80
81
82
83
84
def project_changed_dict(info):
    """Hook for project change action

    Args:
        info (str): info text
    """
    cleanup()

project_saved(project_name, save_time, is_auto_save)

Hook to activate when project is saved

Parameters:

Name Type Description Default
project_name str

name of project

required
save_time str

time when it was saved

required
is_auto_save bool

autosave is on or off

required
Source code in client/ayon_flame/startup/AYON_in_flame.py
158
159
160
161
162
163
164
165
166
167
def project_saved(project_name, save_time, is_auto_save):
    """Hook to activate when project is saved

    Args:
        project_name (str): name of project
        save_time (str): time when it was saved
        is_auto_save (bool): autosave is on or off
    """
    if flame_api.CTX.app_framework:
        flame_api.CTX.app_framework.save_prefs()