Merge pull request #6 from asmeurer/stack-setting
Add an option to change the order of the stack
This commit is contained in:
commit
56173c510e
@ -464,8 +464,13 @@ class DebuggerUI(FrameVarInfoKeeper):
|
||||
|
||||
# stack listeners -----------------------------------------------------
|
||||
def examine_frame(w, size, key):
|
||||
from pudb import CONFIG
|
||||
|
||||
_, pos = self.stack_list._w.get_focus()
|
||||
self.debugger.set_frame_index(len(self.debugger.stack)-1-pos)
|
||||
if CONFIG["current_stack_frame"] == "top":
|
||||
self.debugger.set_frame_index(len(self.debugger.stack)-1-pos)
|
||||
else: # CONFIG["current_stack_frame"] == "bottom":
|
||||
self.debugger.set_frame_index(pos)
|
||||
|
||||
self.stack_list.listen("enter", examine_frame)
|
||||
|
||||
@ -1020,6 +1025,7 @@ class DebuggerUI(FrameVarInfoKeeper):
|
||||
edit_config(self, CONFIG)
|
||||
save_config(CONFIG)
|
||||
self.setup_palette(self.screen)
|
||||
self.update_stack()
|
||||
|
||||
for sl in self.source:
|
||||
sl._invalidate()
|
||||
@ -1329,8 +1335,15 @@ class DebuggerUI(FrameVarInfoKeeper):
|
||||
code.co_name, class_name,
|
||||
self._format_fname(code.co_filename), lineno)
|
||||
|
||||
self.stack_walker[:] = [make_frame_ui(fl)
|
||||
for fl in self.debugger.stack[::-1]]
|
||||
from pudb import CONFIG
|
||||
|
||||
if CONFIG["current_stack_frame"] == "top":
|
||||
self.stack_walker[:] = [make_frame_ui(fl)
|
||||
for fl in self.debugger.stack[::-1]]
|
||||
else: # CONFIG["current_stack_frame"] == "bottom":
|
||||
self.stack_walker[:] = [make_frame_ui(fl)
|
||||
for fl in self.debugger.stack]
|
||||
|
||||
|
||||
def show_exception(self, exc_type, exc_value, traceback):
|
||||
from traceback import format_exception
|
||||
|
@ -54,6 +54,7 @@ def load_config():
|
||||
conf_dict.setdefault("theme", "classic")
|
||||
conf_dict.setdefault("line_numbers", False)
|
||||
conf_dict.setdefault("seen_welcome", "a")
|
||||
conf_dict.setdefault("current_stack_frame", "top")
|
||||
|
||||
def hack_bool(name):
|
||||
try:
|
||||
@ -131,6 +132,15 @@ def edit_config(ui, conf_dict):
|
||||
"box above."),
|
||||
]
|
||||
|
||||
stack_rb_group = []
|
||||
stack_opts = ["top", "bottom"]
|
||||
stack_info = urwid.Text("Show the current stack frame at the\n")
|
||||
stack_rbs = [
|
||||
urwid.RadioButton(stack_rb_group, name,
|
||||
conf_dict["current_stack_frame"] == name)
|
||||
for name in stack_opts
|
||||
]
|
||||
|
||||
if ui.dialog(
|
||||
urwid.ListBox(
|
||||
[heading]
|
||||
@ -139,7 +149,11 @@ def edit_config(ui, conf_dict):
|
||||
+ [urwid.AttrMap(urwid.Text("Shell:\n"), "group head")]
|
||||
+ [shell_info]
|
||||
+ shell_rbs
|
||||
+ [urwid.AttrMap(urwid.Text("\nTheme:\n"), "group head")] + theme_rbs,
|
||||
+ [urwid.AttrMap(urwid.Text("\nTheme:\n"), "group head")]
|
||||
+ theme_rbs
|
||||
+ [urwid.AttrMap(urwid.Text("\nStack Order:\n"), "group head")]
|
||||
+ [stack_info]
|
||||
+ stack_rbs
|
||||
),
|
||||
[
|
||||
("OK", True),
|
||||
@ -161,8 +175,9 @@ def edit_config(ui, conf_dict):
|
||||
|
||||
conf_dict["line_numbers"] = cb_line_numbers.get_state()
|
||||
|
||||
|
||||
|
||||
for opt, stack_rb in zip(stack_opts, stack_rbs):
|
||||
if stack_rb.get_state():
|
||||
conf_dict["current_stack_frame"] = opt
|
||||
|
||||
|
||||
# {{{ breakpoint saving
|
||||
|
Loading…
x
Reference in New Issue
Block a user