Make dockarea.restoreState behavior for extrra docks be configurable
This commit is contained in:
parent
b6f9516678
commit
e8128fa5e2
|
@ -208,7 +208,7 @@ class DockArea(Container, QtGui.QWidget, DockDrop):
|
||||||
childs.append(self.childState(obj.widget(i)))
|
childs.append(self.childState(obj.widget(i)))
|
||||||
return (obj.type(), childs, obj.saveState())
|
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.
|
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
|
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
|
in the dock area will cause an exception to be raised. This behavior
|
||||||
can be changed by setting *missing* to 'ignore' or 'create'.
|
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
|
## 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
|
## 4) Add any remaining docks to a float
|
||||||
for d in docks.values():
|
for d in docks.values():
|
||||||
a = self.addTempArea()
|
if extra == 'float':
|
||||||
a.addDock(d, 'below')
|
a = self.addTempArea()
|
||||||
# self.moveDock(d, 'below', None)
|
a.addDock(d, 'below')
|
||||||
|
else:
|
||||||
|
self.moveDock(d, extra, None)
|
||||||
|
|
||||||
#print "\nKill old containers:"
|
#print "\nKill old containers:"
|
||||||
## 5) kill old containers
|
## 5) kill old containers
|
||||||
|
|
Loading…
Reference in New Issue
Block a user