Skip to content

Commit

Permalink
Backport PR #23452 on branch 6.x (PR: Make shortcuts for actions that…
Browse files Browse the repository at this point in the history
… control the debugger global again) (#23474)
  • Loading branch information
meeseeksmachine authored Jan 15, 2025
1 parent 4cfc957 commit 39ae7d0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 5 additions & 5 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,11 @@
'debugger/refresh': 'Ctrl+R',
'debugger/search': 'Ctrl+F',
'debugger/run file in debugger': "Ctrl+F5",
'debugger/next': "Ctrl+F10",
'debugger/continue': "Ctrl+F12",
'debugger/step': "Ctrl+F11",
'debugger/return': "Ctrl+Shift+F11",
'debugger/stop': "Ctrl+Shift+F12",
'_/next': "Ctrl+F10",
'_/continue': "Ctrl+F12",
'_/step': "Ctrl+F11",
'_/return': "Ctrl+Shift+F11",
'_/stop': "Ctrl+Shift+F12",
'debugger/toggle breakpoint': 'F12',
'debugger/toggle conditional breakpoint': 'Shift+F12',
'debugger/show breakpoint table': "",
Expand Down
22 changes: 16 additions & 6 deletions spyder/plugins/debugger/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os.path as osp

# Third party imports
from qtpy.QtCore import Signal, Slot
from qtpy.QtCore import Qt, Signal, Slot
from qtpy.QtWidgets import QHBoxLayout, QSplitter

# Local imports
Expand Down Expand Up @@ -260,39 +260,49 @@ def setup(self):
text=_("Execute current line"),
icon=self.create_icon('arrow-step-over'),
triggered=lambda: self.debug_command("next"),
register_shortcut=True
register_shortcut=True,
context=Qt.ApplicationShortcut,
shortcut_context="_"
)

continue_action = self.create_action(
DebuggerWidgetActions.Continue,
text=_("Continue execution until next breakpoint"),
icon=self.create_icon('arrow-continue'),
triggered=lambda: self.debug_command("continue"),
register_shortcut=True
register_shortcut=True,
context=Qt.ApplicationShortcut,
shortcut_context="_"
)

step_action = self.create_action(
DebuggerWidgetActions.Step,
text=_("Step into function or method"),
icon=self.create_icon('arrow-step-in'),
triggered=lambda: self.debug_command("step"),
register_shortcut=True
register_shortcut=True,
context=Qt.ApplicationShortcut,
shortcut_context="_"
)

return_action = self.create_action(
DebuggerWidgetActions.Return,
text=_("Execute until function or method returns"),
icon=self.create_icon('arrow-step-out'),
triggered=lambda: self.debug_command("return"),
register_shortcut=True
register_shortcut=True,
context=Qt.ApplicationShortcut,
shortcut_context="_"
)

stop_action = self.create_action(
DebuggerWidgetActions.Stop,
text=_("Stop debugging"),
icon=self.create_icon('stop_debug'),
triggered=self.stop_debugging,
register_shortcut=True
register_shortcut=True,
context=Qt.ApplicationShortcut,
shortcut_context="_"
)

goto_cursor_action = self.create_action(
Expand Down
5 changes: 0 additions & 5 deletions spyder/plugins/editor/widgets/editorstack/editorstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,6 @@ def register_shortcuts(self):

# Register shortcuts for debugger actions
for action_id in [
"next",
"continue",
"step",
"return",
"stop",
"toggle breakpoint",
"toggle conditional breakpoint",
]:
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/shortcuts/tests/test_shortcuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_shortcuts_filtering(shortcut_table):
assert not shortcut_table.isSortingEnabled()
# Six hits (causes a bit of an issue to hardcode it like this if new
# shortcuts are added...)
assert shortcut_table.model().rowCount() == 14
assert shortcut_table.model().rowCount() == 9
# Remove filter text
shortcut_table.finder = FilterTextMock('')
shortcut_table.set_regex()
Expand Down

0 comments on commit 39ae7d0

Please sign in to comment.