From e8128fa5e284fe65f0c19e403284c147d46b8206 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Sun, 3 Sep 2017 20:14:50 -0700 Subject: [PATCH] Make dockarea.restoreState behavior for extrra docks be configurable --- pyqtgraph/dockarea/DockArea.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pyqtgraph/dockarea/DockArea.py b/pyqtgraph/dockarea/DockArea.py index 560495ce..a55d6bb0 100644 --- a/pyqtgraph/dockarea/DockArea.py +++ b/pyqtgraph/dockarea/DockArea.py @@ -208,7 +208,7 @@ class DockArea(Container, QtGui.QWidget, DockDrop): childs.append(self.childState(obj.widget(i))) return (obj.type(), childs, obj.saveState()) - def restoreState(self, state, missing='error'): + def restoreState(self, state, missing='error', extra='bottom'): """ Restore Dock configuration as generated by saveState. @@ -218,6 +218,10 @@ class DockArea(Container, QtGui.QWidget, DockDrop): By default, docks that are described in *state* but do not exist in the dock area will cause an exception to be raised. This behavior can be changed by setting *missing* to 'ignore' or 'create'. + + Extra docks that are in the dockarea but that are not mentioned in + *state* will be added to the bottom of the dockarea, unless otherwise + specified by the *extra* argument. """ ## 1) make dict of all docks and list of existing containers @@ -238,9 +242,11 @@ class DockArea(Container, QtGui.QWidget, DockDrop): ## 4) Add any remaining docks to a float for d in docks.values(): - a = self.addTempArea() - a.addDock(d, 'below') - # self.moveDock(d, 'below', None) + if extra == 'float': + a = self.addTempArea() + a.addDock(d, 'below') + else: + self.moveDock(d, extra, None) #print "\nKill old containers:" ## 5) kill old containers