202
202
fixed_height_children = []
203
203
# For fixed height children and layouting
204
reserved_height = self.spacing * (len(self.packed_children) - 1) * \
204
if len(self.packed_children) > 0:
205
reserved_height = self.spacing * (len(self.packed_children) - 1) * \
208
reserved_height = 0.0
207
210
# Discover fixed height children and update the reserved height
208
for child in self.packed_children:
211
for child in self.packed_children:
209
212
if child.size_ratio < 0 or \
210
213
(child.minimum_height > 0 and child.natural_height == 0):
211
214
fixed_height_children.append(child)
218
221
# Total height excluding reserved height
219
222
free_height = self.get_heightu() - reserved_height
220
# Height for variable height children
223
# Height for variable width children
221
224
var_height_child_count = len(self.packed_children) - \
222
225
len(fixed_height_children)
223
226
var_child_height = free_height
229
232
for child in self.packed_children:
230
233
current_y += child.get_heightu() * child.v_offset
231
child.natural_y = current_y
232
if child not in fixed_height_children:
233
child.natural_height = var_child_height
234
if self.get_heightu() > 0:
235
child.natural_y = current_y / self.get_heightu()
236
if child not in fixed_height_children:
237
child.natural_height = var_child_height / self.get_heightu()
234
238
child._update_layout()
239
current_y += child.get_heightu()
235
240
current_y += child.get_heightu() * child.v_offset
236
241
current_y += self.get_heightu() * self.spacing
238
"""fixed_height_children = []
240
reserved_height = 0.0 # For fixed height children
241
for child in self.packed_children:
242
if child.size_ratio < 0 or \
243
(child.minimum_height > 0 and child.natural_height == 0):
244
fixed_height_children.append(child)
245
child._update_layout()
246
reserved_height += child.get_heightu() + (child.v_offset * self.get_heightu() * 2.0)
248
if self.get_heightu() > 0: # Account for zero width
249
reserved_height = reserved_height * 1.0 / self.get_heightu()
250
available_height = 1.0 - reserved_height
252
max_width = self.minimum_width
253
for child in self.packed_children:
254
child.set_natural_y(current_y)
255
if child not in fixed_height_children:
256
child_height = available_height / (len(self.packed_children) - \
257
len(fixed_height_children))
258
child.set_natural_height(child_height)
259
child._update_layout()
260
if child.get_width() + (child.h_offset * self.get_width() * 2) > max_width:
261
max_width = child.get_width() + (child.h_offset * self.get_width() * 2)
262
if self.get_heightu() > 0:
263
current_y += child.get_heightu() * 1.0 / self.get_heightu()
264
current_y += self.spacing
266
self.minimum_width = max_width
268
super(VBox, self)._update_layout()"""
270
243
def get_item(self, i):
271
244
""" Retrieve natural y for packed item i """