This commit is contained in:
Andrej730
2024-08-26 17:23:51 +05:00
parent 24aaefb927
commit 27aee31adf
6 changed files with 43 additions and 18 deletions
+9 -8
View File
@@ -33,7 +33,7 @@ from pytest_bdd import scenarios, given, when, then, parsers
from mathutils import Vector
from math import radians
from pathlib import Path
from typing import Union
from typing import Union, Any
scenarios("feature")
@@ -49,18 +49,18 @@ webbrowser.open = lambda x: True
class PanelSpy:
def __init__(self, panel):
def __init__(self, panel: type[bpy.types.Panel]):
self.is_spy_dirty = True
self.panel = panel
def refresh_spy(self):
if self.is_spy_dirty:
self.is_spy_dirty = False
self.spied_attr = None
self.spied_labels = []
self.spied_props = []
self.spied_operators = []
self.spied_lists = []
self.spied_attr: Union[str, None] = None
self.spied_labels: list[str] = []
self.spied_props: list[dict[str, Any]] = []
self.spied_operators: list[dict[str, Any]] = []
self.spied_lists: list[dict[str, Any]] = []
self.panel.draw(self, bpy.context)
def __getattr__(self, attr):
@@ -91,6 +91,7 @@ class PanelSpy:
return self
elif self.spied_attr == "prop":
props, name = args
props: bpy.types.bpy_struct
text = kwargs.get("text", props.bl_rna.properties[name].name)
icon = kwargs.get("icon", None)
prop_type = props.bl_rna.properties[name].type
@@ -152,7 +153,7 @@ class TemplateListSpy:
panel_name_cache = {}
panel_spy = None
panel_spy: PanelSpy = None
def replace_variables(value):