Skip to content
This repository was archived by the owner on Aug 31, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions mu/interface/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,18 +819,21 @@ def add_debug_inspector(self):
for col, width in enumerate(self.debug_widths):
self.debug_inspector.setColumnWidth(col, width)

def update_debug_inspector(self, locals_dict):
def update_debug_inspector(self, locals_dict, globals_dict):
"""
Given the contents of a dict representation of the locals in the
current stack frame, update the debug inspector with the new values.
Given the contents of a dict representation of the locals and
globals in the current stack frame, update the debug inspector with the
new values.
"""
excluded_names = ["__builtins__", "__debug_code__", "__debug_script__"]
names = sorted([x for x in locals_dict if x not in excluded_names])
locals_names = sorted([x for x in locals_dict if x not in excluded_names])
globals_names = sorted([x for x in globals_dict if x not in excluded_names])

# Remove rows so we keep the same column layouts if manually set
while self.debug_model.rowCount() > 0:
self.debug_model.removeRow(0)
for name in names:
# Add globals to the top.
for name in locals_names:
item_to_expand = None
try:
# DANGER!
Expand Down
5 changes: 4 additions & 1 deletion mu/modes/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,13 @@ def debug_on_stack(self, stack):
"""
if stack:
locals_dict = {}
globals_dict = {}
for frame in stack:
for k, v in frame[1]["locals"].items():
locals_dict[k] = v
self.view.update_debug_inspector(locals_dict)
for k, v in frame[1]["globals"].items():
globals_dict[k] = v
self.view.update_debug_inspector(locals_dict, globals_dict)

def debug_on_postmortem(self, args, kwargs):
"""
Expand Down