Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/workflows/test-linux-qt6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
INSTALL_TYPE: ['pip'] # conda has no PyQt6 package
PYTHON_VERSION: ['3.10']
TEST_TYPE: ['fast', 'slow']
SPYDER_QT_BINDING: ['pyqt6'] # TODO add 'pyside6' once Spyder supports it
SPYDER_QT_BINDING: ['pyqt6', 'pyside6']
timeout-minutes: 90
steps:
- name: Setup Remote SSH Connection
Expand Down
1 change: 0 additions & 1 deletion spyder/api/config/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class SpyderConfigurationObserver(SpyderConfigurationAccessor):
"""

def __init__(self):
super().__init__()
if self.CONF_SECTION is None:
warnings.warn(
'A SpyderConfigurationObserver must define a `CONF_SECTION` '
Expand Down
4 changes: 2 additions & 2 deletions spyder/api/plugin_registration/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def apply_conf(self, _unused):
pass


class SpyderPluginRegistry(QObject, PreferencesAdapter):
class SpyderPluginRegistry(PreferencesAdapter, QObject):
"""
Global plugin registry.

Expand Down Expand Up @@ -81,7 +81,7 @@ class SpyderPluginRegistry(QObject, PreferencesAdapter):
"""

def __init__(self):
super().__init__()
QObject.__init__(self)
PreferencesAdapter.__init__(self)

# Reference to the main window
Expand Down
8 changes: 4 additions & 4 deletions spyder/api/plugins/new_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
logger = logging.getLogger(__name__)


class SpyderPluginV2(QObject, SpyderActionMixin, SpyderConfigurationObserver,
SpyderPluginObserver):
class SpyderPluginV2(SpyderActionMixin, SpyderConfigurationObserver,
SpyderPluginObserver, QObject):
"""
A Spyder plugin to extend functionality without a dockable widget.

Expand Down Expand Up @@ -318,11 +318,11 @@ class SpyderPluginV2(QObject, SpyderActionMixin, SpyderConfigurationObserver,
_CONF_NAME_MAP = None

def __init__(self, parent, configuration=None):
super().__init__(parent)

# This is required since the MRO of this class does not go up until to
# SpyderPluginObserver and SpyderConfigurationObserver when using
# super(), see https://fuhm.net/super-harmful/
QObject.__init__(self, parent)
SpyderActionMixin.__init__(self)
SpyderPluginObserver.__init__(self)
SpyderConfigurationObserver.__init__(self)

Expand Down
2 changes: 1 addition & 1 deletion spyder/api/widgets/auxiliary_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from spyder.utils.stylesheet import APP_STYLESHEET


class SpyderWindowWidget(QMainWindow, SpyderMainWindowMixin):
class SpyderWindowWidget(SpyderMainWindowMixin, QMainWindow):
"""MainWindow subclass that contains a SpyderDockablePlugin."""

# ---- Signals
Expand Down
6 changes: 3 additions & 3 deletions spyder/api/widgets/main_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
status bar widgets or toolbars.
"""

from qtpy import PYSIDE2
from qtpy import PYSIDE2, PYSIDE6
from qtpy.QtCore import Signal
from qtpy.QtWidgets import QWidget

from spyder.api.widgets.mixins import SpyderWidgetMixin


class PluginMainContainer(QWidget, SpyderWidgetMixin):
class PluginMainContainer(SpyderWidgetMixin, QWidget):
"""
Spyder plugin main container class.

Expand Down Expand Up @@ -116,7 +116,7 @@ class PluginMainContainer(QWidget, SpyderWidgetMixin):
"""

def __init__(self, name, plugin, parent=None):
if not PYSIDE2:
if not (PYSIDE2 or PYSIDE6):
super().__init__(parent=parent, class_parent=plugin)
else:
QWidget.__init__(self, parent)
Expand Down
6 changes: 3 additions & 3 deletions spyder/api/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from typing import Optional

# Third party imports
from qtpy import PYSIDE2
from qtpy import PYSIDE2, PYSIDE6
from qtpy.QtCore import QByteArray, QSize, Qt, Signal, Slot
from qtpy.QtGui import QFocusEvent, QIcon
from qtpy.QtWidgets import (
Expand Down Expand Up @@ -57,7 +57,7 @@
logger = logging.getLogger(__name__)


class PluginMainWidget(QWidget, SpyderWidgetMixin):
class PluginMainWidget(SpyderWidgetMixin, QWidget):
"""
Spyder plugin main widget class.

Expand Down Expand Up @@ -273,7 +273,7 @@ class PluginMainWidget(QWidget, SpyderWidgetMixin):
"""

def __init__(self, name, plugin, parent=None):
if not PYSIDE2:
if not (PYSIDE2 or PYSIDE6):
super().__init__(parent=parent, class_parent=plugin)
else:
QWidget.__init__(self, parent)
Expand Down
2 changes: 1 addition & 1 deletion spyder/api/widgets/menus.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def pixelMetric(self, metric, option=None, widget=None):

# ---- Widgets
# -----------------------------------------------------------------------------
class SpyderMenu(QMenu, SpyderFontsMixin):
class SpyderMenu(SpyderFontsMixin, QMenu):
"""
A QMenu subclass to implement additional functionality for Spyder.
"""
Expand Down
6 changes: 3 additions & 3 deletions spyder/api/widgets/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Third party imports
import qstylizer.parser
from qtpy import PYSIDE2
from qtpy import PYSIDE2, PYSIDE6
from qtpy.QtCore import Qt, QSize, QTimer, Signal
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QHBoxLayout, QLabel, QWidget
Expand All @@ -22,7 +22,7 @@
from spyder.utils.stylesheet import MAC


class StatusBarWidget(QWidget, SpyderWidgetMixin):
class StatusBarWidget(SpyderWidgetMixin, QWidget):
"""
Base class for status bar widgets.

Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(self, parent=None, show_icon=True, show_label=True,
1. To use an icon, you need to redefine the ``get_icon`` method.
2. To use a label, you need to call ``set_value``.
"""
if not PYSIDE2:
if not (PYSIDE2 or PYSIDE6):
super().__init__(parent, class_parent=parent)
else:
QWidget.__init__(self, parent)
Expand Down
12 changes: 8 additions & 4 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
QApplication, QMainWindow, QMessageBox, QShortcut, QTabBar)

# Avoid a "Cannot mix incompatible Qt library" error on Windows platforms
from qtpy import QtSvg # analysis:ignore
from qtpy import QtSvg, PYSIDE6 # analysis:ignore

# Avoid a bug in Qt: https://bugreports.qt.io/browse/QTBUG-46720
try:
Expand Down Expand Up @@ -119,7 +119,7 @@
#==============================================================================
# Main Window
#==============================================================================
class MainWindow(QMainWindow, SpyderMainWindowMixin, SpyderShortcutsMixin):
class MainWindow(SpyderMainWindowMixin, SpyderShortcutsMixin, QMainWindow):
"""Spyder main window"""
CONF_SECTION = 'main'

Expand Down Expand Up @@ -1005,7 +1005,9 @@ def resizeEvent(self, event):
QMainWindow.resizeEvent(self, event)

# To be used by the tour to be able to resize
self.sig_resized.emit(event)
# TODO: Figure out why this doesn't work on PySide6.9+
if not PYSIDE6:
self.sig_resized.emit(event)

def moveEvent(self, event):
"""Reimplement Qt method"""
Expand All @@ -1017,7 +1019,9 @@ def moveEvent(self, event):
self.window_position = self.pos()
QMainWindow.moveEvent(self, event)
# To be used by the tour to be able to move
self.sig_moved.emit(event)
# TODO: Figure out why this doesn't work on PySide6.9+
if not PYSIDE6:
self.sig_moved.emit(event)

def hideEvent(self, event):
"""Reimplement Qt method"""
Expand Down
2 changes: 1 addition & 1 deletion spyder/plugins/completion/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def _wrap_provider_option(self, option):
return option


class SpyderCompletionProvider(QObject, CompletionConfigurationObserver):
class SpyderCompletionProvider(CompletionConfigurationObserver, QObject):
"""
Spyder provider API for completion providers.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@


@class_register
class LSPClient(QObject, LSPMethodProviderMixIn, SpyderConfigurationAccessor):
class LSPClient(LSPMethodProviderMixIn, SpyderConfigurationAccessor, QObject):
"""Language Server Protocol v3.0 client implementation."""
#: Signal to inform the editor plugin that the client has
# started properly and it's ready to be used.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
LanguageServerProvider)


class CompletionPluginMock(QObject, MagicMock):
class CompletionPluginMock(MagicMock, QObject):
"""Mock for the completion plugin."""
CONF_SECTION = 'completions'

Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/completion/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@


class MainWindowMock(QMainWindow):
register_shortcut = Mock()

def __init__(self):
super().__init__(None)
self.register_shortcut = Mock()
self.default_style = None
self.widgetlist = []
self.thirdparty_plugins = []
Expand Down Expand Up @@ -93,7 +93,7 @@ def completion_plugin_all_started(request, qtbot_module,
def wait_until_all_started():
all_started = True
for provider in completion_plugin.providers:

provider_info = completion_plugin.providers[provider]
all_started &= provider_info['status'] == completion_plugin.RUNNING
return all_started
Expand Down
4 changes: 3 additions & 1 deletion spyder/plugins/debugger/utils/breakpointsmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ class BreakpointsManager(Manager, SpyderConfigurationObserver, QObject):
sig_repaint_breakpoints = Signal()

def __init__(self, editor):
super().__init__(editor)
QObject.__init__(self, editor)
Manager.__init__(self, editor)
SpyderConfigurationObserver.__init__(self)
self.filename = editor.filename
self._breakpoint_blocks = {}
self.breakpoints = []
Expand Down
6 changes: 3 additions & 3 deletions spyder/plugins/debugger/widgets/breakpoint_table_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# Third party imports
import qstylizer.style
from qtpy import PYSIDE2
from qtpy import PYSIDE2, PYSIDE6
from qtpy.compat import to_qvariant
from qtpy.QtCore import QAbstractTableModel, QModelIndex, Qt, Signal
from qtpy.QtWidgets import QAbstractItemView, QTableView
Expand Down Expand Up @@ -160,7 +160,7 @@ def reset(self):
self.endResetModel()


class BreakpointTableView(QTableView, SpyderWidgetMixin):
class BreakpointTableView(SpyderWidgetMixin, QTableView):
"""
Table to display code breakpoints.
"""
Expand All @@ -175,7 +175,7 @@ class BreakpointTableView(QTableView, SpyderWidgetMixin):
sig_conditional_breakpoint_requested = Signal()

def __init__(self, parent, data):
if not PYSIDE2:
if not (PYSIDE2 or PYSIDE6):
super().__init__(parent, class_parent=parent)
else:
QTableView.__init__(self, parent)
Expand Down
6 changes: 4 additions & 2 deletions spyder/plugins/debugger/widgets/framesbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class FramesBrowserState:


class FramesBrowser(
QWidget, SpyderWidgetMixin, ShellConnectWidgetForStackMixin
SpyderWidgetMixin, ShellConnectWidgetForStackMixin, QWidget
):
"""Frames browser (global debugger widget)"""
CONF_SECTION = 'debugger'
Expand Down Expand Up @@ -80,7 +80,9 @@ class FramesBrowser(
"""

def __init__(self, parent, shellwidget):
super().__init__(parent)
QWidget.__init__(self, parent)
ShellConnectWidgetForStackMixin.__init__(self)
SpyderWidgetMixin.__init__(self, class_parent=parent)
self.shellwidget = shellwidget
self.results_browser = None
# -1 means never clear, otherwise number of calls
Expand Down
4 changes: 2 additions & 2 deletions spyder/plugins/editor/api/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
logger = logging.getLogger(__name__)


class Panel(QWidget, EditorExtension):
class Panel(EditorExtension, QWidget):
"""
Base class for editor panels.

Expand Down Expand Up @@ -76,8 +76,8 @@ def scrollable(self, value):
self._scrollable = value

def __init__(self, dynamic=False):
EditorExtension.__init__(self)
QWidget.__init__(self)
EditorExtension.__init__(self)
# Specifies whether the panel is dynamic. A dynamic panel is a panel
# that will be shown/hidden depending on the context.
# Dynamic panel should not appear in any GUI menu
Expand Down
24 changes: 13 additions & 11 deletions spyder/plugins/editor/tests/test_editor_config_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@


class MainWindowMock(QMainWindow):
register_shortcut = Mock()
file_menu_actions = []
file_toolbar_actions = []
statusbar = Mock()
new_instance = Mock()
plugin_focus_changed = Mock()
fallback_completions = Mock()
ipyconsole = Mock()
mainmenu = Mock()
sig_setup_finished = Mock()
switcher = Mock()
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.register_shortcut = Mock()
self.file_menu_actions = []
self.file_toolbar_actions = []
self.statusbar = Mock()
self.new_instance = Mock()
self.plugin_focus_changed = Mock()
self.fallback_completions = Mock()
self.ipyconsole = Mock()
self.mainmenu = Mock()
self.sig_setup_finished = Mock()
self.switcher = Mock()


@pytest.mark.parametrize(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@

class MainWindow(QMainWindow):

_cli_options = MagicMock()
def __init__(self):
super().__init__(self)
self._cli_options = MagicMock()

def get_plugin(self, name, error=True):
return MagicMock()
Expand Down
6 changes: 3 additions & 3 deletions spyder/plugins/editor/widgets/editorstack/editorstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

# Third party imports
import qstylizer.style
from qtpy import PYSIDE2
from qtpy import PYSIDE2, PYSIDE6
from qtpy.compat import getsavefilename
from qtpy.QtCore import QFileInfo, Qt, QTimer, Signal, Slot
from qtpy.QtGui import QFontMetrics, QTextCursor
Expand Down Expand Up @@ -96,7 +96,7 @@ class EditorStackMenuSections:
NewWindowCloseSection = "new_window_and_close_section"


class EditorStack(QWidget, SpyderWidgetMixin):
class EditorStack(SpyderWidgetMixin, QWidget):

# This is necessary for the EditorStack tests to run independently of the
# Editor plugin.
Expand Down Expand Up @@ -218,7 +218,7 @@ class EditorStack(QWidget, SpyderWidgetMixin):
"""

def __init__(self, parent, actions, use_switcher=True):
if not PYSIDE2:
if not (PYSIDE2 or PYSIDE6):
super().__init__(parent, class_parent=parent)
else:
QWidget.__init__(self, parent)
Expand Down
Loading
Loading