2
# This file is not used at the moment. It just consists of the ramblings
3
# of an insane man. -- pzw 3/2/06
6
class Anchor(HasTraits):
10
# The AlignmentGroup this anchor belongs to
11
group = Instance("AnchorGroup")
13
# Shadow trait for position
16
def align(self, anchor_or_element, A, B):
18
Pins this element's position to the position of the given anchor
19
The relationship of this anchor's position relative to its
20
group's position can be expressed as::
22
self.position = A*group.position + B
24
if isinstance(anchor_or_element, AnchorGroup):
25
self.group = anchor_or_element
28
# Create a new anchor group
29
self.group = AnchorGroup()
33
"""Removes this element from its anchor group"""
36
def _get_position(self):
39
def _set_position(self, pos):
40
if self.group is not None:
41
self.group.position = pos
47
class AnchorGroup(Anchor):
49
anchors = List(Anchor)
51
def add(self, anchor):
54
def remove(self, anchor):
58
class LayoutContext(HasTraits):
60
anchors = List(Anchors)
63
class LayoutElement(HasTraits):
65
frame = Instance(LayoutContext)