Mercurial > rinkhals
comparison gamelib/gameboard.py @ 292:bf271e857157
Clear tool when calling price dialog
author | Neil Muller <drnlmuller@gmail.com> |
---|---|
date | Sat, 05 Sep 2009 16:14:23 +0000 |
parents | 664bba9be40a |
children | 29e9683055dc |
comparison
equal
deleted
inserted
replaced
291:3e994b3f750d | 292:bf271e857157 |
---|---|
114 self.add_spacer(10) | 114 self.add_spacer(10) |
115 self.add_tool("Price Reference", self.show_prices) | 115 self.add_tool("Price Reference", self.show_prices) |
116 self.add_spacer(20) | 116 self.add_spacer(20) |
117 | 117 |
118 self.add_tool("Finished Day", self.day_done) | 118 self.add_tool("Finished Day", self.day_done) |
119 | |
120 self.anim_clear_tool = False # Flag to clear the tool on an anim loop | |
119 | 121 |
120 def day_done(self): | 122 def day_done(self): |
121 import engine | 123 import engine |
122 pygame.event.post(engine.START_NIGHT) | 124 pygame.event.post(engine.START_NIGHT) |
123 | 125 |
173 tbl.td(gui.Label('')) | 175 tbl.td(gui.Label('')) |
174 tbl.td(close_button) | 176 tbl.td(close_button) |
175 dialog = gui.Dialog(gui.Label('Price Reference'), tbl) | 177 dialog = gui.Dialog(gui.Label('Price Reference'), tbl) |
176 close_button.connect(gui.CLICK, dialog.close) | 178 close_button.connect(gui.CLICK, dialog.close) |
177 dialog.open() | 179 dialog.open() |
180 self.anim_clear_tool = True | |
178 | 181 |
179 update_cash_counter = mkcountupdate('cash_counter') | 182 update_cash_counter = mkcountupdate('cash_counter') |
180 update_fox_counter = mkcountupdate('killed_foxes') | 183 update_fox_counter = mkcountupdate('killed_foxes') |
181 update_chicken_counter = mkcountupdate('chicken_counter') | 184 update_chicken_counter = mkcountupdate('chicken_counter') |
182 update_egg_counter = mkcountupdate('egg_counter') | 185 update_egg_counter = mkcountupdate('egg_counter') |
207 | 210 |
208 def clear_tool(self): | 211 def clear_tool(self): |
209 self.group.value = None | 212 self.group.value = None |
210 for item in self.group.widgets: | 213 for item in self.group.widgets: |
211 item.pcls = "" | 214 item.pcls = "" |
215 self.anim_clear_tool = False | |
212 | 216 |
213 def add_counter(self, icon, label): | 217 def add_counter(self, icon, label): |
214 self.tr() | 218 self.tr() |
215 self.td(icon, width=self.rect.w/2) | 219 self.td(icon, width=self.rect.w/2) |
216 self.td(label, width=self.rect.w/2) | 220 self.td(label, width=self.rect.w/2) |
782 self.foxes = set() # Remove all the foxes | 786 self.foxes = set() # Remove all the foxes |
783 | 787 |
784 def run_animations(self): | 788 def run_animations(self): |
785 for anim in self.animations: | 789 for anim in self.animations: |
786 anim.animate() | 790 anim.animate() |
791 if self.toolbar.anim_clear_tool: | |
792 self.toolbar.clear_tool() | |
787 | 793 |
788 def move_foxes(self): | 794 def move_foxes(self): |
789 """Move the foxes. | 795 """Move the foxes. |
790 | 796 |
791 We return True if there are no more foxes to move or all the | 797 We return True if there are no more foxes to move or all the |