Skip to content

Commit

Permalink
Internal console: Fix mixins initialization in ShellBaseWidget
Browse files Browse the repository at this point in the history
- Before we were initializing SpyderShortcutsMixin in PythonShellWidget,
but that changed some attributes of other ShellBaseWidget mixins (e.g.
it made SaveHistoryMixin.history_filename empty).
- However, moving SpyderShortcutsMixin to ShellBaseWidget and
initializing it before other mixins fixes that problem.
  • Loading branch information
ccordoba12 committed Dec 8, 2024
1 parent 95f5666 commit 049774b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions spyder/plugins/console/widgets/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,12 @@
MAX_LINES = 1000


class ShellBaseWidget(ConsoleBaseWidget, SaveHistoryMixin,
BrowseHistoryMixin):
class ShellBaseWidget(
ConsoleBaseWidget,
SpyderShortcutsMixin,
SaveHistoryMixin,
BrowseHistoryMixin
):
"""
Shell base widget
"""
Expand All @@ -65,6 +69,7 @@ def __init__(self, parent, history_filename, profile=False,
parent : specifies the parent widget
"""
ConsoleBaseWidget.__init__(self, parent)
SpyderShortcutsMixin.__init__(self)
SaveHistoryMixin.__init__(self, history_filename)
BrowseHistoryMixin.__init__(self)

Expand Down Expand Up @@ -642,9 +647,7 @@ def drop_pathlist(self, pathlist):
# from spyder.utils.debug import log_methods_calls
# log_methods_calls('log.log', ShellBaseWidget)

class PythonShellWidget(
TracebackLinksMixin, ShellBaseWidget, GetHelpMixin, SpyderShortcutsMixin
):
class PythonShellWidget(ShellBaseWidget, TracebackLinksMixin, GetHelpMixin):
"""Python shell widget"""
QT_CLASS = ShellBaseWidget
INITHISTORY = ['# -*- coding: utf-8 -*-',
Expand Down Expand Up @@ -679,7 +682,6 @@ def __init__(
)
TracebackLinksMixin.__init__(self)
GetHelpMixin.__init__(self)
SpyderShortcutsMixin.__init__(self)

# Local shortcuts
self.register_shortcuts()
Expand Down

0 comments on commit 049774b

Please sign in to comment.