diff --git a/pudb/debugger.py b/pudb/debugger.py index eed2b714..5aa7fa56 100644 --- a/pudb/debugger.py +++ b/pudb/debugger.py @@ -948,13 +948,15 @@ def helpside(w, size, key): ], dividechars=1) + background = urwid.AttrMap(self.columns, "background") + self.caption = urwid.Text("") - header = urwid.AttrMap(self.caption, "header") - self.top = SignalWrap(urwid.Frame( - urwid.AttrMap(self.columns, "background"), - header)) + self.header = urwid.AttrMap(self.caption, "header") - # }}} + self.top = SignalWrap(urwid.Frame(background, self.header)) + + if CONFIG["hide_header"]: + self.top._w.header = None def change_rhs_box(name, index, direction, w, size, key): from pudb.settings import save_config @@ -2421,6 +2423,7 @@ def __call__(subself, w, size, key): # noqa: N805, E501 # pylint: disable=no-se width=("relative", 75), height=("relative", 75), ) + w = Attr(w, "background") return self.event_loop(w)[0] @@ -2838,11 +2841,16 @@ def interaction(self, exc_tuple, show_exc_dialog=True): (None, " "), ("header warning", "[POST-MORTEM MODE]") ]) + self.show_header() + CONFIG["hide_header"] = False + elif exc_tuple is not None: caption.extend([ (None, " "), ("header warning", "[PROCESSING EXCEPTION - hit 'e' to examine]") ]) + self.show_header() + CONFIG["hide_header"] = False self.caption.set_text(caption) self.event_loop() @@ -2956,6 +2964,14 @@ def make_frame_ui(i, frame_lineno): def update_cmdline_win(self): self.set_cmdline_state(not CONFIG["hide_cmdline_win"]) + def update_header(self): + """Update the header to reflect the current settings.""" + self.top._w.header = self.header if not CONFIG["hide_header"] else None + + def show_header(self): + """Show the header.""" + self.top._w.header = self.header + # }}} # vim: foldmethod=marker:expandtab:softtabstop=4 diff --git a/pudb/settings.py b/pudb/settings.py index d4ab9923..67a9e2fd 100644 --- a/pudb/settings.py +++ b/pudb/settings.py @@ -112,6 +112,7 @@ def load_config(): conf_dict.setdefault("prompt_on_quit", "True") conf_dict.setdefault("hide_cmdline_win", "False") + conf_dict.setdefault("hide_header", "False") # hotkeys conf_dict.setdefault("hotkeys_code", "C") @@ -133,6 +134,7 @@ def normalize_bool_inplace(name): normalize_bool_inplace("wrap_variables") normalize_bool_inplace("prompt_on_quit") normalize_bool_inplace("hide_cmdline_win") + normalize_bool_inplace("hide_header") _config_[0] = conf_dict return conf_dict @@ -179,6 +181,9 @@ def _update_prompt_on_quit(): def _update_hide_cmdline_win(): ui.update_cmdline_win() + def _update_hide_header(): + ui.update_header() + def _update_current_stack_frame(): ui.update_stack() @@ -222,6 +227,11 @@ def _update_config(check_box, new_state, option_newvalue): conf_dict.update(new_conf_dict) _update_hide_cmdline_win() + elif option == "hide_header": + new_conf_dict["hide_header"] = not check_box.get_state() + conf_dict.update(new_conf_dict) + _update_hide_header() + elif option == "current_stack_frame": # only activate if the new state of the radio button is 'on' if new_state: @@ -270,6 +280,10 @@ def _update_config(check_box, new_state, option_newvalue): bool(conf_dict["hide_cmdline_win"]), on_state_change=_update_config, user_data=("hide_cmdline_win", None)) + hide_header = urwid.CheckBox("Hide header from top of window", + bool(conf_dict["hide_header"]), on_state_change=_update_config, + user_data=("hide_header", None)) + # {{{ shells shell_info = urwid.Text("This is the shell that will be " @@ -441,6 +455,7 @@ def _update_config(check_box, new_state, option_newvalue): + [cb_line_numbers] + [cb_prompt_on_quit] + [hide_cmdline_win] + + [hide_header] + [urwid.AttrMap(urwid.Text("\nShell:\n"), "group head")] + [shell_info]