# HG changeset patch # User Neil Muller # Date 1336847924 -7200 # Node ID 0a441ded8a83725562fa2895ddf763e6141ff97f # Parent d378459567bbeb6ce78c39e24108dad0e25e184e Always sort widgets, so jumping through json doesn't change the order diff -r d378459567bb -r 0a441ded8a83 gamelib/gamegui.py --- a/gamelib/gamegui.py Sat May 12 20:34:34 2012 +0200 +++ b/gamelib/gamegui.py Sat May 12 20:38:44 2012 +0200 @@ -350,7 +350,8 @@ y = max(250, 130 + self.description.rect.height + 20 * len(self._inventory) // 3) available = self.game.get_available_equipment() - for equip in self.game.get_all_equipment(): + for equip in sorted(self.game.get_all_equipment(), + key=lambda x: x.NAME): copies = self.parent.equipment.count(equip) widget = EquipWidget(equip, (x, y), self, copies, equip in available) @@ -502,7 +503,8 @@ self._missions = [] x = 0 y = 150 - for mission in self.game.get_available_missions(): + for mission in sorted(self.game.get_available_missions(), + key=lambda x: x.NAME): widget = MissionWidget(mission, (x, y), self) self._missions.append(widget) self.add_child(widget) @@ -573,7 +575,7 @@ self._sciences = [] x = 0 y = 150 - for science in self.game.lab.science: + for science in sorted(self.game.lab.science, key=lambda x: x.NAME): if science.SCIENCE_TYPE == 'schematic': widget = ScienceWidget(science, (x, y), self) self.add_child(widget) @@ -643,7 +645,7 @@ self._sciences = [] x = 0 y = 150 - for science in self.game.lab.science: + for science in sorted(self.game.lab.science, key=lambda x: x.NAME): if science.SCIENCE_TYPE == 'research': widget = ScienceWidget(science, (x, y), self) self.add_child(widget)