Beispiel #1
0
    def _allocate(self, width, height):
        Container._allocate(self, width, height)
        style = self._style
        p = style.padding
        content_size = [
            self._size_allocation[0] - p[2] - p[3],
            self._size_allocation[1] - p[0] - p[1]
        ]
        x, y = self.x + p[2], self.y - p[0]
        children = [child for child in self._children if not child._deleted]
        children_nx = [child for child in children if not child._expand[1]]
        children_x = [child for child in children if child._expand[1]]

        free = content_size[1] - self._spacing * (len(children) - 1)
        free -= reduce(add, [child._minimum_size[1] for child in children_nx]
                       or [0])
        extra = free - reduce(
            add, [child.size_request[1] for child in children_x] or [0])
        extra = extra / float(len(children_x))
        if len(children_x):
            common_size = free / float(len(children_x))
        for child in children:
            if not self._homogeneous or not child._expand[1]:
                size = child.size_request[1]
                if child._expand[1]:
                    size += extra
            else:
                size = common_size
            child._position = [x, y]
            child._allocate(content_size[0], size)
            y -= size + self._spacing
Beispiel #2
0
    def _allocate(self, width, height):
        Container._allocate(self, width, height)
        style = self._style
        p = style.padding
        content_size = [self._size_allocation[0]-p[2]-p[3],
                        self._size_allocation[1]-p[0]-p[1]]
        x, y = self.x + p[2], self.y - p[0]
        children = [child for child in self._children if not child._deleted]
        children_nx = [child for child in children if not child._expand[0]]
        children_x = [child for child in children if child._expand[0]]

        free = content_size[0] - self._spacing*(len(children)-1)
        free -= reduce(add,[child._minimum_size[0]
                            for child in children_nx] or [0])        
        extra = free - reduce(add,[child.size_request[0]
                                   for child in children_x] or [0])
        child_extra = extra/float(len(children_x))

        if len(children_x):
            common_size = free / float(len(children_x))
        for child in children:
            if not self._homogeneous or not child._expand[0]:
                size = child.size_request[0]
                if child._expand[0]:
                    size +=  child_extra
            else:
                size = common_size
            child._position=[x,y]
            child._allocate(size,content_size[1])
            x += size + self._spacing
Beispiel #3
0
    def _allocate(self, width, height):
        ''' Set size allocation.

        **Parameters**
            `width` : int
                Width in pixels
            `height` : int
                Height  in pixels
        '''

        Container._allocate(self, width, height)
        style = self._style
        p = style.padding
        content_size = [
            self._size_allocation[0] - p[2] - p[3],
            self._size_allocation[1] - p[0] - p[1]
        ]
        x, y = self.x + p[2], self.y - p[0]
        children = [child for child in self._children if not child._deleted]
        children_nx = [child for child in children if not child._expand[0]]
        children_x = [child for child in children if child._expand[0]]

        free = content_size[0] - self._spacing * (len(children) - 1)
        free -= reduce(add, [child._minimum_size[0] for child in children_nx]
                       or [0])
        extra = free - reduce(
            add, [child.size_request[0] for child in children_x] or [0])
        child_extra = extra / float(len(children_x))

        if len(children_x):
            common_size = free / float(len(children_x))
        for child in children:
            if not self._homogeneous or not child._expand[0]:
                size = child.size_request[0]
                if child._expand[0]:
                    size += child_extra
            else:
                size = common_size
            child._position = [x, y]
            child._allocate(size, content_size[1])
            x += size + self._spacing
Beispiel #4
0
    def _allocate(self, width, height):
        ''' Set size allocation.

        **Parameters**
            `width` : int
                Width in pixels
            `height` : int
                Height  in pixels
        '''



        Container._allocate(self, width, height)
        style = self._style
        p = style.padding
        content_size = [self._size_allocation[0]-p[2]-p[3],
                        self._size_allocation[1]-p[0]-p[1]]
        x, y = self.x + p[2], self.y - p[0]
        children = [child for child in self._children if not child._deleted]
        children_nx = [child for child in children if not child._expand[1]]
        children_x = [child for child in children if child._expand[1]]

        free = content_size[1] - self._spacing*(len(children)-1)
        free -= reduce(add,[child._minimum_size[1]
                            for child in children_nx] or [0])        
        extra = free - reduce(add,[child.size_request[1]
                                   for child in children_x] or [0])
        extra = extra/float(len(children_x))
        if len(children_x):
            common_size = free / float(len(children_x))
        for child in children:
            if not self._homogeneous or not child._expand[1]:
                size = child.size_request[1]
                if child._expand[1]:
                    size +=  extra
            else:
                size = common_size
            child._position=[x,y]
            child._allocate(content_size[0], size)
            y -= size + self._spacing