code: def quick_layout_switch(self, index):
          
          section = 'quick_layouts'
  
          try:
              settings = self.load_window_settings('layout_{}/'.format(index),
                                                   section=section)
              (hexstate, window_size, prefs_dialog_size, pos, is_maximized,
               is_fullscreen) = settings
  
              # The defaults layouts will always be regenerated unless there was
              # an overwrite, either by rewriting with same name, or by deleting
              # and then creating a new one
              if hexstate is None:
                  # The value for hexstate shouldn't be None for a custom saved
                  # layout (ie, where the index is greater than the number of
                  # defaults).  See issue 6202.
                  if index != 'default' and index >= self.DEFAULT_LAYOUTS:
                      QMessageBox.critical(
                              self, _("Warning"),
                              _("Error opening the custom layout.  Please close"
                                " Spyder and try again.  If the issue persists,"
                                " then you must use 'Reset to Spyder default' "
                                "from the layout menu."))
                      return
                  self.setup_default_layouts(index, settings)
          except cp.NoOptionError:
              QMessageBox.critical(self, _("Warning"),
                                   _("Quick switch layout #%s has not yet "
                                     "been defined.") % str(index))
              return
              # TODO: is there any real use in calling the previous layout
              # setting?
              # self.previous_layout_settings = self.get_window_settings()
          self.set_window_settings(*settings)
          self.current_quick_layout = index
  
          # make sure the flags are correctly set for visible panes
          for plugin in (self.widgetlist + self.thirdparty_plugins):
              action = plugin.toggle_view_action
              action.setChecked(plugin.dockwidget.isVisible())
docs: Switch to quick layout number *index*