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: Move dock attributes from plugin to dockwidget #12181

Merged
merged 2 commits into from
Apr 7, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3100,7 +3100,7 @@ def apply_settings(self):
def apply_panes_settings(self):
"""Update dockwidgets features settings"""
for plugin in (self.widgetlist + self.thirdparty_plugins):
features = plugin._FEATURES
features = plugin.dockwidget.FEATURES
if CONF.get('main', 'vertical_dockwidget_titlebars'):
features = features | QDockWidget.DockWidgetVerticalTitleBar
plugin.dockwidget.setFeatures(features)
Expand Down
10 changes: 3 additions & 7 deletions spyder/plugins/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,6 @@ class BasePluginWidgetMixin(object):
Implementation of the basic functionality for Spyder plugin widgets.
"""

_ALLOWED_AREAS = Qt.AllDockWidgetAreas
_LOCATION = Qt.LeftDockWidgetArea
_FEATURES = QDockWidget.DockWidgetClosable | QDockWidget.DockWidgetMovable

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

Expand Down Expand Up @@ -255,8 +251,8 @@ def _create_dockwidget(self):

# Set properties
dock.setObjectName(self.__class__.__name__+"_dw")
dock.setAllowedAreas(self._ALLOWED_AREAS)
dock.setFeatures(self._FEATURES)
dock.setAllowedAreas(dock.ALLOWED_AREAS)
dock.setFeatures(dock.FEATURES)
dock.setWidget(self)
self._update_margins()
dock.visibilityChanged.connect(self._visibility_changed)
Expand All @@ -281,7 +277,7 @@ def _create_dockwidget(self):
self.register_shortcut(sc, "_", "Switch to {}".format(
self.CONF_SECTION))

return (dock, self._LOCATION)
return (dock, dock.LOCATION)

def _switch_to_plugin(self):
"""Switch to plugin."""
Expand Down
7 changes: 7 additions & 0 deletions spyder/widgets/dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,13 @@ def mouseMoveEvent(self, event):

class SpyderDockWidget(QDockWidget):
"""Subclass to override needed methods"""

# Attributes
ALLOWED_AREAS = Qt.AllDockWidgetAreas
LOCATION = Qt.LeftDockWidgetArea
FEATURES = QDockWidget.DockWidgetClosable | QDockWidget.DockWidgetMovable

# Signals
sig_plugin_closed = Signal()

def __init__(self, title, parent):
Expand Down