♻️ rename time to temporal to avoid conflict with std

and some linter changes
This commit is contained in:
Ondřej Samohel 2025-01-29 22:22:05 +01:00
parent 085aa74976
commit 920f917f94
No known key found for this signature in database
GPG key ID: 02376E18990A97C6
8 changed files with 44 additions and 40 deletions

View file

@ -1,28 +1,25 @@
# -*- coding: utf-8 -*-
"""Addons for AYON."""
from . import click_wrap
from .interfaces import (
IPluginPaths,
ITrayAddon,
ITrayAction,
ITrayService,
IHostAddon,
ITraits,
)
from .base import (
ProcessPreparationError,
ProcessContext,
AYONAddon,
AddonsManager,
AYONAddon,
ProcessContext,
ProcessPreparationError,
load_addons,
)
from .interfaces import (
IHostAddon,
IPluginPaths,
ITraits,
ITrayAction,
ITrayAddon,
ITrayService,
)
from .utils import (
ensure_addons_are_process_context_ready,
ensure_addons_are_process_ready,
)
__all__ = (
"click_wrap",

View file

@ -1,3 +1,4 @@
"""Addon interfaces for AYON."""
from __future__ import annotations
import logging
@ -17,11 +18,11 @@ if TYPE_CHECKING:
class _AYONInterfaceMeta(ABCMeta):
"""AYONInterface metaclass to print proper string."""
def __str__(self):
return f"<'AYONInterface.{self.__name__}'>"
def __str__(cls):
return f"<'AYONInterface.{cls.__name__}'>"
def __repr__(self):
return str(self)
def __repr__(cls):
return str(cls)
class AYONInterface(metaclass=_AYONInterfaceMeta):
@ -84,7 +85,7 @@ class IPluginPaths(AYONInterface):
paths = [paths]
return paths
def get_launcher_action_paths(self):
def get_launcher_action_paths(self) -> list[str]:
"""Receive launcher actions paths.
Give addons ability to add launcher actions paths.
@ -208,7 +209,8 @@ class ITrayAddon(AYONInterface):
"""
if not self.tray_initialized:
# TODO: Called without initialized tray, still main thread needed
# TODO (Illicit): Called without initialized tray, still
# main thread needed.
try:
callback()
@ -245,7 +247,8 @@ class ITrayAddon(AYONInterface):
self.manager.add_doubleclick_callback(self, callback)
@staticmethod
def admin_submenu(tray_menu):
def admin_submenu(tray_menu: QtWidgets.QMenu) -> QtWidgets.QMenu:
"""Get or create admin submenu."""
if ITrayAddon._admin_submenu is None:
from qtpy import QtWidgets
@ -255,7 +258,9 @@ class ITrayAddon(AYONInterface):
return ITrayAddon._admin_submenu
@staticmethod
def add_action_to_admin_submenu(label, tray_menu):
def add_action_to_admin_submenu(
label: str, tray_menu: QtWidgets.QMenu) -> QtWidgets.QAction:
"""Add action to admin submenu."""
from qtpy import QtWidgets
menu = ITrayAddon.admin_submenu(tray_menu)
@ -330,7 +335,7 @@ class ITrayService(ITrayAddon):
"""Service label showed in menu."""
raise NotImplementedError
# TODO be able to get any sort of information to show/print
# TODO (Illicit): be able to get any sort of information to show/print
# @abstractmethod
# def get_service_info(self):
# pass