Skip to content

Commit

Permalink
Main window: Prevent error when unmaximizing plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
ccordoba12 committed Sep 19, 2024
1 parent 0a2e474 commit 49a9cca
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,15 @@ def unmaximize_plugin(self, not_this_plugin=None):
not_this_plugin: SpyderDockablePlugin, optional
Unmaximize plugin if the maximized one is `not_this_plugin`.
"""
if not_this_plugin is None:
self.layouts.unmaximize_dockwidget()
else:
self.layouts.unmaximize_other_dockwidget(
plugin_instance=not_this_plugin)
# This is necessary to avoid an error when layouts is not ready.
# Fixes spyder-ide/spyder#22514
if self.layouts is not None:
if not_this_plugin is None:
self.layouts.unmaximize_dockwidget()
else:
self.layouts.unmaximize_other_dockwidget(
plugin_instance=not_this_plugin
)

def remove_dockwidget(self, plugin):
"""
Expand Down

0 comments on commit 49a9cca

Please sign in to comment.