Apoptose dock area when temporary window is closed#3134
Apoptose dock area when temporary window is closed#3134j9ac9k merged 2 commits intopyqtgraph:masterfrom
Conversation
After the fix for pyqtgraph#2887 was introduced floating temp areas were not removed anymore when it was closed. This lead to a TypeError when calling saveState and then restoreState, because it tried to restore half-present floating windows. Also introduced regression tests for pyqtgraph#2887 and pyqtgraph#3125 as well as another potential failure case discovered while trying to fix the issue. Fixes pyqtgraph#3125
propagate was set to False to prevent the unintended collapse of a container tree with a single dock in a container. But this lead to temporary areas closing anymore. Instead, the removal of superfluous or empty containers is now only triggered by calling apoptose on the container if one of these cases is really present. A unit test where this problem was discovered is added.
|
I found another case where preventing the propagation of apoptose calls leads to temporary areas not being closed and therefore breaking restoreState functionality. |
|
Thank you @UsYer for this PR, and patching up the dock functionality. This part of the library doesn't get as much attention as others, so it's always refreshing to know contributors are using it and even better, making contributions to fix it up. I apologize for the long duration from when you made this PR to me following up, life just gets in the way... Anyway, merging! |
|
Thanks for reviewing and merging the PR. |
After the fix for #2887 was introduced floating temp areas were not removed anymore when it was closed.
This lead to a TypeError when calling saveState and then restoreState, because it tried to restore half-present floating windows.
Now the apoptose method of the temporary area of the floating window is called explicitly in its closeEvent method.
This leads to a duplicate call to dock_area.apoptose only in the case when a floating window is closed by calling restoreState on the original dock area. In that case an exception would be raised be removeArea, because the temporary dock_area was alread removed,
This is handled by setting the reference to the original dock area to None in the dock_areas apoptose method, which breaks the cycle.
Introduced regression tests for #2887 and #3125 as well as another potential failure case discovered while trying to fix the issue.
Fixes #3125