mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
allow to change registry name in controller
This commit is contained in:
parent
cb06323e96
commit
3dacfec4ec
2 changed files with 18 additions and 13 deletions
|
|
@ -1,6 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from dataclasses import dataclass, field
|
||||
from typing import List, Dict, Optional
|
||||
from typing import Optional
|
||||
|
||||
|
||||
@dataclass
|
||||
|
|
@ -13,8 +15,8 @@ class TabItem:
|
|||
class InterpreterConfig:
|
||||
width: Optional[int]
|
||||
height: Optional[int]
|
||||
splitter_sizes: List[int] = field(default_factory=list)
|
||||
tabs: List[TabItem] = field(default_factory=list)
|
||||
splitter_sizes: list[int] = field(default_factory=list)
|
||||
tabs: list[TabItem] = field(default_factory=list)
|
||||
|
||||
|
||||
class AbstractInterpreterController(ABC):
|
||||
|
|
@ -27,7 +29,7 @@ class AbstractInterpreterController(ABC):
|
|||
self,
|
||||
width: int,
|
||||
height: int,
|
||||
splitter_sizes: List[int],
|
||||
tabs: List[Dict[str, str]],
|
||||
):
|
||||
splitter_sizes: list[int],
|
||||
tabs: list[dict[str, str]],
|
||||
) -> None:
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from typing import List, Dict
|
||||
from __future__ import annotations
|
||||
from typing import Optional
|
||||
|
||||
from ayon_core.lib import JSONSettingRegistry
|
||||
from ayon_core.lib.local_settings import get_launcher_local_dir
|
||||
|
|
@ -11,13 +12,15 @@ from .abstract import (
|
|||
|
||||
|
||||
class InterpreterController(AbstractInterpreterController):
|
||||
def __init__(self):
|
||||
def __init__(self, name: Optional[str] = None) -> None:
|
||||
if name is None:
|
||||
name = "python_interpreter_tool"
|
||||
self._registry = JSONSettingRegistry(
|
||||
"python_interpreter_tool",
|
||||
name,
|
||||
get_launcher_local_dir(),
|
||||
)
|
||||
|
||||
def get_config(self):
|
||||
def get_config(self) -> InterpreterConfig:
|
||||
width = None
|
||||
height = None
|
||||
splitter_sizes = []
|
||||
|
|
@ -54,9 +57,9 @@ class InterpreterController(AbstractInterpreterController):
|
|||
self,
|
||||
width: int,
|
||||
height: int,
|
||||
splitter_sizes: List[int],
|
||||
tabs: List[Dict[str, str]],
|
||||
):
|
||||
splitter_sizes: list[int],
|
||||
tabs: list[dict[str, str]],
|
||||
) -> None:
|
||||
self._registry.set_item("width", width)
|
||||
self._registry.set_item("height", height)
|
||||
self._registry.set_item("splitter_sizes", splitter_sizes)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue