comparison gamelib/gamegui.py @ 240:af86a207d8d2

more layout tweaking
author Neil Muller <drnlmuller@gmail.com>
date Sun, 13 May 2012 00:13:46 +0200
parents 212bfbb96055
children 0bc8592ee28c
comparison
equal deleted inserted replaced
239:3731b3ca3b48 240:af86a207d8d2
328 def _make_inventory(self): 328 def _make_inventory(self):
329 for widget in self._inventory: 329 for widget in self._inventory:
330 self.remove_child(widget) 330 self.remove_child(widget)
331 self._inventory = [] 331 self._inventory = []
332 x = 10 332 x = 10
333 y = 110 + self.description.rect.height 333 y = 100 + self.description.rect.height
334 # collections.Counter is python 2.7. This is a bother 334 # collections.Counter is python 2.7. This is a bother
335 equipment = sorted(set(self.parent.equipment), key=lambda x: x.NAME) 335 equipment = sorted(set(self.parent.equipment), key=lambda x: x.NAME)
336 for equip in equipment: 336 for equip in equipment:
337 count = self.parent.equipment.count(equip) 337 count = self.parent.equipment.count(equip)
338 widget = TextLabel((x, y, 700, 15), '%s x %s' 338 widget = TextLabel((x, y, 700, 15), '%s x %s'
347 def _make_equip_widgets(self): 347 def _make_equip_widgets(self):
348 for widget in self._equip: 348 for widget in self._equip:
349 self.remove_child(widget) 349 self.remove_child(widget)
350 self._equip = [] 350 self._equip = []
351 x = 0 351 x = 0
352 y = max(250, 130 + self.description.rect.height + 352 y = max(240, 100 + self.description.rect.height +
353 18 * len(self._inventory) // 3) 353 18 * (len(self._inventory) // 3 + 1))
354 available = self.game.get_available_equipment() 354 available = self.game.get_available_equipment()
355 for equip in sorted(self.game.get_all_equipment(), 355 for equip in sorted(self.game.get_all_equipment(),
356 key=lambda x: x.NAME): 356 key=lambda x: x.NAME):
357 copies = self.parent.equipment.count(equip) 357 copies = self.parent.equipment.count(equip)
358 widget = EquipWidget(equip, (x, y), self, copies, 358 widget = EquipWidget(equip, (x, y), self, copies,