-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy path_debug.py
More file actions
35 lines (24 loc) · 789 Bytes
/
_debug.py
File metadata and controls
35 lines (24 loc) · 789 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from imgui_bundle import imgui
from icecream import ic
from ._base import Window
class DebugWindow(Window):
def __init__(self, objs: list):
self._objs = objs
super().__init__()
@property
def objs(self) -> tuple:
return tuple(self._objs)
def add(self, obj):
self._objs.append(obj)
def draw_window(self):
imgui.set_next_window_pos((300, 0), imgui.Cond_.appearing)
imgui.set_next_window_pos((0, 0), imgui.Cond_.appearing)
imgui.begin("Debug", None)
info = list()
for obj in self.objs:
if callable(obj):
info.append(ic.format(obj()))
else:
info.append(ic.format(obj))
imgui.text_wrapped("\n\n".join(info))
imgui.end()