Repository: spyder-ide/spyder

Issue:
Shotcuts not working when pane is maximized
## Description

### What steps will reproduce the problem?

<!--- You can use Markdown here --->

When I maximize a pane, the shortcut to move to another pane (e.g., editor pane maximized -> Ctrl-Shift-I to go to the console) does not work and raises the issue reporter window.

### Traceback
```python-traceback
Traceback (most recent call last):
  File "/home/dbau/miniconda3/lib/python3.8/site-packages/spyder/api/plugins.py", line 406, in switch_to_plugin
    super(BasePluginWidget, self)._switch_to_plugin()
  File "/home/dbau/miniconda3/lib/python3.8/site-packages/spyder/plugins/base.py", line 284, in _switch_to_plugin
    self.main.maximize_dockwidget()
  File "/home/dbau/miniconda3/lib/python3.8/site-packages/spyder/app/mainwindow.py", line 1164, in __getattr__
    return super().__getattr__(attr)
AttributeError: 'MainWindow' object has no attribute 'maximize_dockwidget'
```

## Versions

* Spyder version: 5.0.0 
* Python version: 3.8.5
* Qt version: 5.12.9
* PyQt5 version: 5.12.3
* Operating System: Linux 5.4.0-70-generic

### Dependencies

```

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  1.6.0 (OK)
cookiecutter >=1.6.0          :  1.7.2 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.0.2 (OK)
IPython >=7.6.0               :  7.22.0 (OK)
jedi =0.17.2                  :  0.17.2 (OK)
jsonschema >=3.2.0            :  3.2.0 (OK)
keyring >=17.0.0              :  23.0.1 (OK)
nbconvert >=4.0               :  6.0.7 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
parso =0.7.0                  :  0.7.0 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.8.0 (OK)
pygments >=2.0                :  2.8.1 (OK)
pylint >=1.0                  :  2.7.2 (OK)
pyls >=0.36.2;<1.0.0          :  0.36.2 (OK)
pyls_black >=0.4.6            :  0.4.6 (OK)
pyls_spyder >=0.3.2           :  0.3.2 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.1.10 (OK)
qtawesome >=0.5.7             :  1.0.2 (OK)
qtconsole >=5.0.3             :  5.0.3 (OK)
qtpy >=1.5.0                  :  1.9.0 (OK)
rtree >=0.8.3                 :  0.9.7 (OK)
setuptools >=39.0.0           :  49.6.0.post20210108 (OK)
sphinx >=0.6.6                :  3.5.3 (OK)
spyder_kernels >=2.0.1,<2.1.0 :  2.0.1 (NOK)
textdistance >=4.2.0          :  4.2.1 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3;<2.0.0      :  1.0.2 (OK)
xdg >=0.26                    :  0.26 (OK)
zmq >=17                      :  22.0.3 (OK)

# Optional:
cython >=0.21                 :  0.29.21 (OK)
matplotlib >=2.0.0            :  3.3.4 (OK)
numpy >=1.7                   :  1.20.2 (OK)
pandas >=1.1.1                :  1.1.4 (OK)
scipy >=0.17.0                :  1.5.3 (OK)
sympy >=0.7.3                 :  None (NOK)
```



Discussion:
Hi @dbau thank you for the feedback! I was able to reproduce this. Will work in a fix for this :+1:

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -344,6 +344,21 @@ def last_plugin(self):
         # spyder/plugins/base::_switch_to_plugin
         return self.layouts.get_last_plugin()
 
+    def maximize_dockwidget(self, restore=False):
+        """
+        This is needed to prevent errors with the old API at
+        spyder/plugins/base::_switch_to_plugin.
+
+        See spyder-ide/spyder#15164
+
+        Parameters
+        ----------
+        restore : bool, optional
+            If the current dockwidget needs to be restored to its unmaximized
+            state. The default is False.
+        """
+        self.layouts.maximize_dockwidget(restore=restore)
+
     def switch_to_plugin(self, plugin, force_focus=None):
         """
         Switch to this plugin.


Test patch: