Repository: spyder-ide/spyder

Issue:
Windows layout does not work properly
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description
While trying to get rid of Python 3.8 deprecation warnings, I realized that floats between 0 and 1 were passed to a function accepting integers. Trying out changing the windows layout, made me realize that it is not working properly. See clip below, especially for Matlab it is clear.
![windowlayoutissues](https://user-images.githubusercontent.com/8114497/61597758-67a99080-ac14-11e9-9e7f-f3762bc56e11.gif)

The problems are: 

As the values are casted to ints, most of them are zero so everything is of the same size.
Using `--debug` reveals the following warning:
`QMainWidget::resizeDocks: all sizes need to be larger than 0` (as can be seen in the beginning of the clip in the terminal).

Changing a layout automatically maximized the window (which maybe is a design choice since it is the same in Spyder 3)

A solution is to simply enter integer values for the ratios, so scale them with e.g 100. I have done that. However, I do not really know if this solves everything as I haven't figured out if this will work with the save feature. (It seems like saved layouts are based on the non-maximized window size, so maybe this is a hint that it is working and it is simply to rescale the ratios.) If someone can shed light on this I can provide a PR. (I tried to read the code, but didn't fully manage to figure out how things were saved and restored.) Seems better than to provide a PR that may be incorrect...

(Somewhat surprisingly, the outline pane in the Spyder layout has about the correct format when added.)

### What steps reproduce the problem?

1. Switch window layout

### What is the expected output? What do you see instead?
At least that the windows layout follows the specified ratios. Ideally, the window shouldn't change maximization status.

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 4.0.0.dev0
* Python version: 3.7.3
* Qt version: 5.9.6
* PyQt version: 5.9.2
* Operating System name/version: Windows 10

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```
pygments >=2.0    :  2.4.2 (OK)
qdarkstyle >=2.6.4:  2.7 (OK)
sphinx >=0.6.6    :  2.1.2 (OK)
pyls >=0.27.0     :  0.27.0 (OK)
nbconvert >=4.0   :  5.5.0 (OK)
pandas >=0.13.1   :  0.24.2 (OK)
numpy >=1.7       :  1.16.4 (OK)
sympy >=0.7.3     :  1.4 (OK)
cython >=0.21     :  0.29.11 (OK)
qtconsole >=4.5.0 :  4.5.1 (OK)
IPython >=4.0     :  7.5.0 (OK)
matplotlib >=2.0.0:  3.1.0 (OK)
pylint >=0.25     :  2.3.1 (OK)
```



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
@@ -1630,8 +1630,8 @@ def setup_default_layouts(self, index, settings):
         # Layout definition
         # --------------------------------------------------------------------
         # Layouts are organized by columns, each column is organized by rows.
-        # Widths have to add 1.0 (except if hidden), height per column has to
-        # add 1.0 as well
+        # Widths have to accumulate to 100 (except if hidden), height per
+        # column has to accumulate to 100 as well
 
         # Spyder Default Initial Layout
         s_layout = {
@@ -1647,14 +1647,14 @@ def setup_default_layouts(self, index, settings):
                   helper, explorer_file, finder] + plugins,
                  [console_int, console_ipy, history]]        # Row 1
                 ],
-            'width fraction': [0.05,            # Column 0 width
-                               0.55,            # Column 1 width
-                               0.05,            # Column 2 width
-                               0.45],           # Column 3 width
-            'height fraction': [[1.0],          # Column 0, row heights
-                                [1.0],          # Column 1, row heights
-                                [1.0],          # Column 2, row heights
-                                [0.46, 0.54]],  # Column 3, row heights
+            'width fraction': [ 5,            # Column 0 width
+                               55,            # Column 1 width
+                                5,            # Column 2 width
+                               45],           # Column 3 width
+            'height fraction': [[100],          # Column 0, row heights
+                                [100],          # Column 1, row heights
+                                [100],          # Column 2, row heights
+                                [46, 54]],  # Column 3, row heights
             'hidden widgets': [outline] + global_hidden_widgets,
             'hidden toolbars': [],
         }
@@ -1671,10 +1671,10 @@ def setup_default_layouts(self, index, settings):
                  [explorer_file, explorer_project,    # Row 1
                   help_plugin, helper]]
                 ],
-            'width fraction': [0.55,            # Column 0 width
-                               0.45],           # Column 1 width
-            'height fraction': [[0.55, 0.45],   # Column 0, row heights
-                                [0.55, 0.45]],  # Column 1, row heights
+            'width fraction': [55,            # Column 0 width
+                               45],           # Column 1 width
+            'height fraction': [[55, 45],   # Column 0, row heights
+                                [55, 45]],  # Column 1, row heights
             'hidden widgets': [outline] + global_hidden_widgets,
             'hidden toolbars': [],
         }
@@ -1692,12 +1692,12 @@ def setup_default_layouts(self, index, settings):
                 [[explorer_variable, plots, finder] + plugins,
                  [history, help_plugin, helper]]
                 ],
-            'width fraction': [0.10,            # Column 0 width
-                               0.45,            # Column 1 width
-                               0.45],           # Column 2 width
-            'height fraction': [[0.55, 0.45],   # Column 0, row heights
-                                [0.55, 0.45],   # Column 1, row heights
-                                [0.55, 0.45]],  # Column 2, row heights
+            'width fraction': [10,            # Column 0 width
+                               45,            # Column 1 width
+                               45],           # Column 2 width
+            'height fraction': [[55, 45],   # Column 0, row heights
+                                [55, 45],   # Column 1, row heights
+                                [55, 45]],  # Column 2, row heights
             'hidden widgets': global_hidden_widgets,
             'hidden toolbars': [],
         }
@@ -1711,8 +1711,8 @@ def setup_default_layouts(self, index, settings):
                   explorer_project, help_plugin, explorer_variable, plots,
                   history, outline, finder, helper] + plugins]
                 ],
-            'width fraction': [1.0],            # Column 0 width
-            'height fraction': [[0.55, 0.45]],  # Column 0, row heights
+            'width fraction': [100],            # Column 0 width
+            'height fraction': [[55, 45]],  # Column 0, row heights
             'hidden widgets': [outline] + global_hidden_widgets,
             'hidden toolbars': [],
         }
@@ -1727,10 +1727,10 @@ def setup_default_layouts(self, index, settings):
                   explorer_project, help_plugin, explorer_variable, plots,
                   history, outline, finder, helper] + plugins]
                 ],
-            'width fraction': [0.55,      # Column 0 width
-                               0.45],     # Column 1 width
-            'height fraction': [[1.0],    # Column 0, row heights
-                                [1.0]],   # Column 1, row heights
+            'width fraction': [55,      # Column 0 width
+                               45],     # Column 1 width
+            'height fraction': [[100],    # Column 0, row heights
+                                [100]],   # Column 1, row heights
             'hidden widgets': [outline] + global_hidden_widgets,
             'hidden toolbars': []
         }


Test patch: