Skip to content

Commit ca7e479

Browse files
committed
wip
1 parent 3d5f57c commit ca7e479

File tree

1 file changed

+48
-54
lines changed

1 file changed

+48
-54
lines changed

pov.py

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,10 @@ def render_variable_table(variables, indent=0):
8989

9090

9191
def render_tree(variables, title):
92-
hd.markdown(f"### {title}")
93-
with hd.tree(indent_guide_width="1px"):
94-
render_variable_tree(variables)
92+
with hd.box(border="0px solid blue", padding=0.8):
93+
hd.markdown(f"### {title}")
94+
with hd.tree(indent_guide_width="1px"):
95+
render_variable_tree(variables)
9596

9697

9798
def render_variable_tree(variables):
@@ -123,8 +124,9 @@ def render_variable_tree(variables):
123124
# hd.markdown(f"`{evaluate_name}`")
124125
# hd.markdown(f"`{v.get('variablesReference', 0)}`")
125126

126-
hd.markdown(f"**{name}**: `{value}` (**Type**: {var_type}) ")
127+
hd.markdown(f"**{name}**: `{value}` (**Type**: `{var_type}`) ")
127128
if name != evaluate_name and evaluate_name:
129+
hd.markdown("     ")
128130
hd.markdown(f" **Evaluate Name**: `{evaluate_name}`")
129131

130132
# If this variable has child variables, recurse
@@ -133,56 +135,48 @@ def render_variable_tree(variables):
133135

134136

135137
def pov():
136-
hd.markdown("## Python Object Viewer")
137-
hd.divider(spacing=1, thickness=0)
138-
139-
dap_task = hd.task()
140-
dap_task.run(dap_client)
141-
142-
if dap_task.running:
143-
hd.markdown("## Waiting for variables...")
144-
with hd.box(font_size=4):
145-
hd.spinner(speed="5s", track_width=0.5)
146-
147-
if dap_task.error:
148-
print("Error collecting variables.")
149-
hd.markdown("`Error collecting variables`")
150-
return
151-
152-
if dap_task.done:
153-
hd.markdown("### Variables")
154-
hd.divider(spacing=1)
155-
156-
results = dap_task.result # This is the dict returned by dap_client()
157-
# print(f"Results: {results}")
158-
globals_scope = results.get("globals", [])
159-
locals_scope = results.get("locals", [])
160-
161-
# Sort by 'name' (optional) -- think this messes up the order of variables / children references
162-
# globals_scope.sort(key=lambda x: x.get("name", "").lower())
163-
# locals_scope.sort(key=lambda x: x.get("name", "").lower())
164-
165-
# Original table method
166-
# render_table(globals_scope, "Globals")
167-
# render_table(locals_scope, "Locals")
168-
169-
# Tree method
170-
# render_tree(globals_scope, "Globals")
171-
# hd.divider(spacing=2)
172-
render_tree(locals_scope, "Locals")
173-
174-
# with hd.tree(indent_guide_width="1px"):
175-
# hd.tree_item("One")
176-
# hd.tree_item("Two")
177-
# with hd.tree_item("Three"):
178-
# hd.tree_item("Three A")
179-
# hd.tree_item("Three B")
180-
# with hd.tree_item("Three C"):
181-
# hd.tree_item("Three C-1")
182-
# hd.tree_item("Three C-2")
183-
# hd.tree_item("Three D")
184-
# hd.tree_item("Four")
185-
# hd.tree_item("Five")
138+
with hd.hbox(gap=1, justify="space-around", border="0px solid red", padding=0.8):
139+
with hd.box(
140+
font_size=1, gap=0, justify="space-around", border="0px solid yellow"
141+
):
142+
hd.markdown("## Python Object Viewer")
143+
hd.divider(spacing=0.4, thickness=0)
144+
145+
dap_task = hd.task()
146+
dap_task.run(dap_client)
147+
148+
if dap_task.running:
149+
hd.markdown("## Waiting for variables...")
150+
with hd.hbox(font_size=4, justify="space-around"):
151+
hd.spinner(speed="5s", track_width=0.5)
152+
153+
if dap_task.error:
154+
hd.markdown("`Error collecting variables`")
155+
return
156+
157+
if dap_task.done:
158+
# hd.markdown("### Variables")
159+
# hd.divider(spacing=1)
160+
161+
results = dap_task.result # This is the dict returned by dap_client()
162+
# print(f"Results: {results}")
163+
globals_scope = results.get("globals", [])
164+
locals_scope = results.get("locals", [])
165+
166+
# Sort by 'name' (optional) -- think this messes up the order of variables / children references
167+
# globals_scope.sort(key=lambda x: x.get("name", "").lower())
168+
# locals_scope.sort(key=lambda x: x.get("name", "").lower())
169+
170+
# Original table method - doesnt work well with nested variables
171+
# render_table(globals_scope, "Globals")
172+
# render_table(locals_scope, "Locals")
173+
174+
# Tree method
175+
with hd.hbox(gap=1):
176+
render_tree(locals_scope, "Locals")
177+
hd.divider(spacing=2)
178+
with hd.hbox(gap=1):
179+
render_tree(globals_scope, "Globals")
186180

187181

188182
hd.run(

0 commit comments

Comments
 (0)