Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Improve UI/UX of the Debugger pane #22163

Merged
merged 7 commits into from
Jun 12, 2024
Merged
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
44 changes: 22 additions & 22 deletions spyder/app/tests/test_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -5858,25 +5858,25 @@ def test_debugger_plugin(main_window, qtbot):

# Test post mortem
with qtbot.waitSignal(shell.executed):
debugger.enter_debug()
debugger.enter_debugger_after_exception()

assert len(frames_browser.stack_dict) == 1
assert list(frames_browser.stack_dict.keys())[0] == "pdb"
assert list(frames_browser.stack_dict.keys())[0] == "Frames"
assert not enter_debug_action.isEnabled()

# Test that executing a statement doesn't change the frames browser
with qtbot.waitSignal(shell.executed):
shell.execute('a = 1')

assert len(frames_browser.stack_dict) == 1
assert list(frames_browser.stack_dict.keys())[0] == "pdb"
assert list(frames_browser.stack_dict.keys())[0] == "Frames"
assert not enter_debug_action.isEnabled()

with qtbot.waitSignal(shell.executed):
shell.execute('w')

assert len(frames_browser.stack_dict) == 1
assert list(frames_browser.stack_dict.keys())[0] == "pdb"
assert list(frames_browser.stack_dict.keys())[0] == "Frames"
assert not enter_debug_action.isEnabled()

# Test that quitting resets the explorer
Expand All @@ -5891,7 +5891,7 @@ def test_debugger_plugin(main_window, qtbot):
shell.execute('%debug print()')

assert len(frames_browser.stack_dict) == 1
assert list(frames_browser.stack_dict.keys())[0] == "pdb"
assert list(frames_browser.stack_dict.keys())[0] == "Frames"
assert not enter_debug_action.isEnabled()

# Restart Kernel
Expand All @@ -5911,7 +5911,7 @@ def test_debugger_plugin(main_window, qtbot):
shell.execute('%debug print()')

assert len(frames_browser.stack_dict) == 1
assert list(frames_browser.stack_dict.keys())[0] == "pdb"
assert list(frames_browser.stack_dict.keys())[0] == "Frames"
assert not enter_debug_action.isEnabled()

# Crash Kernel
Expand All @@ -5923,7 +5923,7 @@ def test_debugger_plugin(main_window, qtbot):


@flaky(max_runs=3)
def test_enter_debugger(main_window, qtbot):
def test_interrupt_and_debug(main_window, qtbot):
"""
Test that we can enter the debugger while code is running in the kernel.
"""
Expand All @@ -5934,8 +5934,8 @@ def test_enter_debugger(main_window, qtbot):
timeout=SHELL_TIMEOUT)

debugger = main_window.debugger.get_widget()
enter_debug_action = debugger.get_action(
DebuggerWidgetActions.EnterDebug)
interrupt_debug_action = debugger.get_action(
DebuggerWidgetActions.InterrupAndDebug)
inspect_action = debugger.get_action(
DebuggerWidgetActions.Inspect)

Expand All @@ -5944,18 +5944,18 @@ def test_enter_debugger(main_window, qtbot):
shell.execute('import time')
with qtbot.waitSignal(shell.executed):
shell.execute('%debug for i in range(100): time.sleep(.1)')
assert not enter_debug_action.isEnabled()
assert not interrupt_debug_action.isEnabled()
assert not inspect_action.isEnabled()
shell.execute('c')
qtbot.wait(200)
assert enter_debug_action.isEnabled()
assert interrupt_debug_action.isEnabled()
assert inspect_action.isEnabled()

# enter the debugger
with qtbot.waitSignal(shell.executed):
debugger.enter_debug()
debugger.interrupt_and_debug()
# make sure we are stopped somewhere in the middle
assert not enter_debug_action.isEnabled()
assert not interrupt_debug_action.isEnabled()
assert not inspect_action.isEnabled()
assert shell.is_debugging()
assert 0 < shell.get_value("i") < 99
Expand All @@ -5970,32 +5970,32 @@ def test_enter_debugger(main_window, qtbot):
return

# Check we can enter the debugger
assert not enter_debug_action.isEnabled()
assert not interrupt_debug_action.isEnabled()
assert not inspect_action.isEnabled()
shell.execute('for i in range(100): time.sleep(.1)')
qtbot.wait(200)

assert enter_debug_action.isEnabled()
assert interrupt_debug_action.isEnabled()
assert inspect_action.isEnabled()

# enter the debugger
with qtbot.waitSignal(shell.executed):
debugger.enter_debug()
debugger.interrupt_and_debug()
assert shell.is_debugging()

# make sure we are stopped somewhere in the middle
assert not enter_debug_action.isEnabled()
assert not interrupt_debug_action.isEnabled()
assert not inspect_action.isEnabled()
assert 0 < shell.get_value("i") < 99

shell.execute('c')
qtbot.wait(200)
# enter the debugger
with qtbot.waitSignal(shell.executed):
debugger.enter_debug()
debugger.interrupt_and_debug()

# make sure we are stopped somewhere in the middle
assert not enter_debug_action.isEnabled()
assert not interrupt_debug_action.isEnabled()
assert not inspect_action.isEnabled()
assert 0 < shell.get_value("i") < 99

Expand Down Expand Up @@ -6025,21 +6025,21 @@ def test_recursive_debug(main_window, qtbot):
with qtbot.waitSignal(shell.executed):
shell.execute('s')
# a in framesbrowser
assert frames_browser.stack_dict['pdb'][2]["name"] == 'a'
assert frames_browser.stack_dict['Frames'][2]["name"] == 'a'

# Recursive debug
with qtbot.waitSignal(shell.executed):
shell.execute('debug b()')
with qtbot.waitSignal(shell.executed):
shell.execute('s')
# b in framesbrowser
assert frames_browser.stack_dict['pdb'][2]["name"] == 'b'
assert frames_browser.stack_dict['Frames'][2]["name"] == 'b'

# Quit recursive debugger
with qtbot.waitSignal(shell.executed):
shell.execute('q')
# a in framesbrowser
assert frames_browser.stack_dict['pdb'][2]["name"] == 'a'
assert frames_browser.stack_dict['Frames'][2]["name"] == 'a'

# quit debugger
with qtbot.waitSignal(shell.executed):
Expand Down
37 changes: 35 additions & 2 deletions spyder/images/dark/go_to_editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 99 additions & 4 deletions spyder/images/dark/interrupt_and_debug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions spyder/images/dark/postmortem_debug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions spyder/images/light/go_to_editor.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion spyder/images/light/interrupt_and_debug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions spyder/images/light/postmortem_debug.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions spyder/plugins/debugger/widgets/breakpoint_table_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class BreakpointTableView(QTableView, SpyderWidgetMixin):
"""

# Constants
MIN_WIDTH = 300
MIN_INITIAL_WIDTH = 300

# Signals
sig_clear_all_breakpoints_requested = Signal()
Expand Down Expand Up @@ -194,7 +194,6 @@ def __init__(self, parent, data):
self._adjust_columns()
self.horizontalHeader().setStretchLastSection(True)
self.verticalHeader().hide()
self.setMinimumWidth(self.MIN_WIDTH)

# Attributes
self._update_when_shown = True
Expand Down
Loading