Skip to content

Commit

Permalink
persist linked state with the dock layout
Browse files Browse the repository at this point in the history
  • Loading branch information
sccolbert committed Jun 17, 2013
1 parent 259cfa0 commit adc9dec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions enaml/layout/dock_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class dockitem(Atom):
#: if the dock item is a floating item.
maximized = Bool(False)

#: Whether or not the item is linked with its proximal neighbors.
#: This only has an effect if the dock item is a floating item.
linked = Bool(False)

def __init__(self, name, **kwargs):
""" Initialize an item.
Expand Down Expand Up @@ -231,6 +235,10 @@ class dockarea(Atom):
#: The name of the dock item that is maximized in the dock area.
maximized_item = Unicode()

#: Whether or not the area is linked with its proximal neighbors.
#: This only has an effect if the dock area is a floating area.
linked = Bool(False)

#: The child layout node for the area.
child = Coerced(_areanode)

Expand Down
4 changes: 4 additions & 0 deletions enaml/qt/docking/dock_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ def save_layout(self):
item.maximized_item = maxed.objectName()
else:
item = save_layout(frame)
item.linked = frame.isLinked()
item.maximized = frame.isMaximized()
if frame.isMaximized():
geo = frame.normalGeometry()
Expand Down Expand Up @@ -380,6 +381,7 @@ def popuplate_area(area, layout):
popuplate_area(win_area, item)
win_area.installEventFilter(self._area_filter)
self._dock_frames.append(target)
self._proximity_handler.addFrame(target)
targets.append((target, item))

for target, item in targets:
Expand All @@ -388,6 +390,8 @@ def popuplate_area(area, layout):
rect = ensure_on_screen(rect)
target.setGeometry(rect)
target.show()
if item.linked:
target.setLinked(True)
if item.maximized:
target.showMaximized()

Expand Down

0 comments on commit adc9dec

Please sign in to comment.