Repository: spyder-ide/spyder

Issue:
Not able to change layouts after resetting
## Description of your problem

After a `spyder --reset`, when opening spyder for the first time, not able to change the layout  under `View -> Windows Layout`.

**What steps will reproduce the problem?**

1. spyder --reset
2. open spyder 
3. go into View -> Windows Layout and select another layout -OR- use the toggle keys to try to change to another layout.

**What is the expected output? What do you see instead?**
I expect the layout to change, but instead nothing happens.

**Please provide any additional information below**


## Versions and main components

* Spyder Version:  3.2.6.dev0
* Python Version: 3.6.4
* Qt Version: 5.6.2
* PyQt Version: 5.6
* Operating system:  Ubuntu 16.04


## Dependencies

Please go to the menu entry `Help > Optional Dependencies` (or
`Help > Dependencies`), press the button `Copy to clipboard`
and paste the contents below:



Discussion:

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -1410,7 +1410,8 @@ def set_window_settings(self, hexstate, window_size, prefs_dialog_size,
             self.setWindowState(Qt.WindowMaximized)
         self.setUpdatesEnabled(True)
 
-    def save_current_window_settings(self, prefix, section='main'):
+    def save_current_window_settings(self, prefix, section='main',
+                                     none_state=False):
         """Save current window settings with *prefix* in
         the userconfig-based configuration, under *section*"""
         win_size = self.window_size
@@ -1424,8 +1425,11 @@ def save_current_window_settings(self, prefix, section='main'):
         pos = self.window_position
         CONF.set(section, prefix+'position', (pos.x(), pos.y()))
         self.maximize_dockwidget(restore=True)# Restore non-maximized layout
-        qba = self.saveState()
-        CONF.set(section, prefix+'state', qbytearray_to_str(qba))
+        if none_state:
+            CONF.set(section, prefix + 'state', None)
+        else:
+            qba = self.saveState()
+            CONF.set(section, prefix + 'state', qbytearray_to_str(qba))
         CONF.set(section, prefix+'statusbar',
                     not self.statusBar().isHidden())
 
@@ -1463,15 +1467,14 @@ def setup_layout(self, default=False):
 
             for index, name, in enumerate(order):
                 prefix = 'layout_{0}/'.format(index)
-                self.save_current_window_settings(prefix, section)
-                CONF.set(section, prefix+'state', None)        
+                self.save_current_window_settings(prefix, section,
+                                                  none_state=True)
 
             # store the initial layout as the default in spyder
             prefix = 'layout_default/'
             section = 'quick_layouts'
-            self.save_current_window_settings(prefix, section)
+            self.save_current_window_settings(prefix, section, none_state=True)
             self.current_quick_layout = 'default'
-            CONF.set(section, prefix+'state', None)
             
             # Regenerate menu
             self.quick_layout_set_menu()


Test patch: