mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-22 05:00:53 +00:00
PanelSpy - target not all callables
Because sometimes we have `Data` classes as panel attributes and they're also callable.
This commit is contained in:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
import os
|
import os
|
||||||
|
import types
|
||||||
import bpy
|
import bpy
|
||||||
import pytest
|
import pytest
|
||||||
import traceback
|
import traceback
|
||||||
@@ -81,7 +82,8 @@ class PanelSpy:
|
|||||||
return self
|
return self
|
||||||
sentinel = object()
|
sentinel = object()
|
||||||
attr_value = getattr(self.blender_panel, attr, sentinel)
|
attr_value = getattr(self.blender_panel, attr, sentinel)
|
||||||
if attr_value is not sentinel and not callable(attr_value):
|
# Don't use `callable`, because we might have `Data` classes as panel attributes.
|
||||||
|
if attr_value is not sentinel and not isinstance(attr_value, types.FunctionType):
|
||||||
return attr_value
|
return attr_value
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user