comparison gamelib/gameboard.py @ 492:e8430f93b23a

toggling select/move can now be initiated from no selected tool and in any toolbar where select/move is allowed
author Adrianna Pińska <adrianna.pinska@gmail.com>
date Wed, 25 Nov 2009 22:15:29 +0000
parents 8308bef91864
children ee883d390ff0
comparison
equal deleted inserted replaced
491:75ef6ea3b7a6 492:e8430f93b23a
263 263
264 def use_tool(self, e): 264 def use_tool(self, e):
265 if not self.day: 265 if not self.day:
266 return 266 return
267 if e.button == 3: # Right button 267 if e.button == 3: # Right button
268 if self.selected_tool == constants.TOOL_PLACE_ANIMALS: 268 if self.toolbar.MOVE_SELECT_PERMITTED:
269 self.set_selected_tool(constants.TOOL_SELECT_CHICKENS, cursors.cursors["select"]) 269 if self.selected_tool != constants.TOOL_SELECT_CHICKENS:
270 if self.toolbar.IS_DEFAULT: 270 self.set_selected_tool(constants.TOOL_SELECT_CHICKENS, cursors.cursors["select"])
271 self.toolbar.toggle_select_on() 271 if self.toolbar.IS_DEFAULT:
272 elif self.selected_tool == constants.TOOL_SELECT_CHICKENS: 272 self.toolbar.toggle_select_on()
273 self.set_selected_tool(constants.TOOL_PLACE_ANIMALS, cursors.cursors["chicken"]) 273 elif self.selected_tool == constants.TOOL_SELECT_CHICKENS:
274 if self.toolbar.IS_DEFAULT: 274 self.set_selected_tool(constants.TOOL_PLACE_ANIMALS, cursors.cursors["chicken"])
275 self.toolbar.toggle_move_on() 275 if self.toolbar.IS_DEFAULT:
276 self.toolbar.toggle_move_on()
276 return 277 return
277 elif e.button == 2: # Middle button 278 elif e.button == 2: # Middle button
278 self.reset_states() 279 self.reset_states()
279 self.unselect_all() 280 self.unselect_all()
280 elif e.button != 1: # Left button 281 elif e.button != 1: # Left button