Skip to content

Remove global state and initialisation from Loader #427

@mottosso

Description

@mottosso

What happened?
The loader is creating and maintaining its own global state in conjunction with making database queries and creating Qt widgets at the same time, using an overly magical function without return value.

def refresh_group_config():
"""Get subset group configurations from the database
The 'group' configuration must be stored in the project `config` field.
See schema `config-1.0.json`
"""
# Subset group item's default icon and order
default_group_icon = qtawesome.icon("fa.object-group",
color=style.colors.default)
default_group_config = {"icon": default_group_icon,
"order": 0}

What did you expect?

  • State should be initialized during api.install() (and the associated host-install)
  • All state should reside in avalon\__init__.py, where it can be cleared on api.uninstall to avoid memory leaks

In addition, these functions are only used in one place.

  • Single-use functions should be merged with where they are used - reference

Additional context
See #426

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions