Enable bug

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Enable bug

Henrik Rudstrom
Hi, 
Had some wierd behaviour when i have nested resizable containers in enable:
when using padding, only for the first child container the correct bounds are created, subsequent child containers only update the bounds with their inner bounds.
see attached example.


found the likely perpetrator in container.py (see comments):

    def _calc_bounding_box(self):
        """
        Returns a 4-tuple (x,y,x2,y2) of the bounding box of all our contained
        components.  Expressed as coordinates in our local coordinate frame.
        """
        if len(self._components) == 0:
            return (0.0, 0.0, 0.0, 0.0)
        else:
#here the outer values are correctly used
            comp = self._components[0]
            ll_x = comp.outer_x 
            ll_y = comp.outer_y
            ur_x = comp.outer_x2
            ur_y = comp.outer_y2

        for component in self._components[1:]:

# for the rest the inner values are used
# should be changed to their outer counterparts

            if component.x < ll_x:
                ll_x = component.x
            if component.x2 > ur_x:
                ur_x = component.x2
            if component.y < ll_y:
                ll_y = component.y
            if component.y2 > ur_y:
                ur_y = component.y2
        return (ll_x, ll_y, ur_x, ur_y)


Henrik

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev

nested_test.py (6K) Download Attachment