From b8742189a0fe1e6ae5a65c00ca9c53670c1ec3c4 Mon Sep 17 00:00:00 2001 From: Quentin Peter Date: Sat, 3 Sep 2022 22:53:48 +0200 Subject: [PATCH 1/2] goto_cursor_action --- .../plugins/debugger/widgets/main_widget.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/debugger/widgets/main_widget.py b/spyder/plugins/debugger/widgets/main_widget.py index 3b2b59252eb..82e8507637c 100644 --- a/spyder/plugins/debugger/widgets/main_widget.py +++ b/spyder/plugins/debugger/widgets/main_widget.py @@ -36,6 +36,7 @@ class DebuggerWidgetActions: Step = "step" Return = "return" Stop = "stop" + GotoCursor = "go to editor" # Toggles ToggleExcludeInternal = 'toggle_exclude_internal_action' @@ -263,6 +264,14 @@ def setup(self): register_shortcut=True ) + goto_cursor_action = self.create_action( + DebuggerWidgetActions.GotoCursor, + text=_("Show in editor"), + icon=self.create_icon('fromcursor'), + triggered=self.goto_current_step, + register_shortcut=True + ) + self.create_action( DebuggerToolbarActions.DebugCurrentFile, text=_("&Debug file"), @@ -333,6 +342,7 @@ def setup(self): step_action, return_action, stop_action, + goto_cursor_action, enter_debug_action, inspect_action, search_action]: @@ -395,7 +405,9 @@ def update_actions(self): DebuggerWidgetActions.Continue, DebuggerWidgetActions.Step, DebuggerWidgetActions.Return, - DebuggerWidgetActions.Stop]: + DebuggerWidgetActions.Stop, + DebuggerWidgetActions.GotoCursor, + ]: action = self.get_action(action_name) action.setEnabled(pdb_prompt) @@ -492,6 +504,12 @@ def close_widget(self, widget): # ---- Public API # ------------------------------------------------------------------------ + def goto_current_step(self): + """Go to last pdb step.""" + fname, lineno = self.get_pdb_last_step() + if fname: + self.sig_load_pdb_file.emit(fname, lineno) + def print_debug_file_msg(self): """Print message in the current console when a file can't be closed.""" widget = self.current_widget() From e36ab92e8e2b1898b85fb4dba302c778c0452266 Mon Sep 17 00:00:00 2001 From: Quentin Peter Date: Wed, 21 Sep 2022 17:59:10 +0200 Subject: [PATCH 2/2] Update spyder/plugins/debugger/widgets/main_widget.py Co-authored-by: Carlos Cordoba --- spyder/plugins/debugger/widgets/main_widget.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spyder/plugins/debugger/widgets/main_widget.py b/spyder/plugins/debugger/widgets/main_widget.py index 7181753175a..ac3b1084fb2 100644 --- a/spyder/plugins/debugger/widgets/main_widget.py +++ b/spyder/plugins/debugger/widgets/main_widget.py @@ -266,7 +266,8 @@ def setup(self): goto_cursor_action = self.create_action( DebuggerWidgetActions.GotoCursor, - text=_("Show in editor"), + text=_("Show in the editor the file and line where the debugger " + "is placed"), icon=self.create_icon('fromcursor'), triggered=self.goto_current_step, register_shortcut=True