Mercurial > sypikslang
comparison gamelib/gamegui.py @ 212:16ce5ed563c9
Change science buttons
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 12 May 2012 20:17:28 +0200 |
parents | eb4516169b3c |
children | 0a441ded8a83 |
comparison
equal
deleted
inserted
replaced
211:ba7c0953853b | 212:16ce5ed563c9 |
---|---|
122 self.parent = parent | 122 self.parent = parent |
123 super(ScienceWidget, self).__init__( | 123 super(ScienceWidget, self).__init__( |
124 pos, science.get_image_name(), self.make_text(), font_small) | 124 pos, science.get_image_name(), self.make_text(), font_small) |
125 | 125 |
126 def make_text(self): | 126 def make_text(self): |
127 name = self.science.NAME[:4] | 127 #name = self.science.NAME[:4] |
128 name = self.science.NAME | |
128 text = '%s: %d' % (name, self.science.points) | 129 text = '%s: %d' % (name, self.science.points) |
129 if self.points > 0: | 130 if self.points > 0: |
130 text = "%s + %d" % (text, self.points) | 131 text = "%s + %d" % (text, self.points) |
131 return text | 132 return text |
132 | 133 |
575 for science in self.game.lab.science: | 576 for science in self.game.lab.science: |
576 if science.SCIENCE_TYPE == 'schematic': | 577 if science.SCIENCE_TYPE == 'schematic': |
577 widget = ScienceWidget(science, (x, y), self) | 578 widget = ScienceWidget(science, (x, y), self) |
578 self.add_child(widget) | 579 self.add_child(widget) |
579 self._sciences.append(widget) | 580 self._sciences.append(widget) |
580 x += 200 | 581 x += widget.WIDTH + 10 |
581 if x >= WIDTH: | 582 if x >= WIDTH: |
582 x = 0 | 583 x = 0 |
583 y += 100 | 584 y += widget.HEIGHT + 5 |
584 | 585 |
585 def end_turn(self): | 586 def end_turn(self): |
586 # Drop back to the research screen | 587 # Drop back to the research screen |
587 PopWindow.post() | 588 PopWindow.post() |
588 self.lab.update() | 589 self.lab.update() |
645 for science in self.game.lab.science: | 646 for science in self.game.lab.science: |
646 if science.SCIENCE_TYPE == 'research': | 647 if science.SCIENCE_TYPE == 'research': |
647 widget = ScienceWidget(science, (x, y), self) | 648 widget = ScienceWidget(science, (x, y), self) |
648 self.add_child(widget) | 649 self.add_child(widget) |
649 self._sciences.append(widget) | 650 self._sciences.append(widget) |
650 x += 200 | 651 x += widget.WIDTH + 10 |
651 if x >= WIDTH: | 652 if x >= WIDTH: |
652 x = 0 | 653 x = 0 |
653 y += 100 | 654 y += widget.HEIGHT + 5 |
654 | 655 |
655 def update_widgets(self): | 656 def update_widgets(self): |
656 self._make_science_widgets() | 657 self._make_science_widgets() |
657 | 658 |
658 def restore_selection(self, old_selection): | 659 def restore_selection(self, old_selection): |