Mercurial > rinkhals
changeset 483:25e8c57189c3
toggling move/select from subtoolbar no longer crashes
author | Adrianna Pińska <adrianna.pinska@gmail.com> |
---|---|
date | Wed, 25 Nov 2009 21:17:45 +0000 |
parents | cab751de93cc |
children | d3381e722839 |
files | gamelib/gameboard.py gamelib/toolbar.py |
diffstat | 2 files changed, 14 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/gamelib/gameboard.py Wed Nov 25 20:44:28 2009 +0000 +++ b/gamelib/gameboard.py Wed Nov 25 21:17:45 2009 +0000 @@ -266,14 +266,16 @@ if e.button == 3: # Right button if self.selected_tool == constants.TOOL_PLACE_ANIMALS: self.set_selected_tool(constants.TOOL_SELECT_CHICKENS, cursors.cursors["select"]) - self.toolbar._select_tool.group.value = self.toolbar._select_tool.value - self.toolbar._move_tool.pcls = "" - self.toolbar._select_tool.pcls = "down" + if self.toolbar.IS_DEFAULT: + self.toolbar._select_tool.group.value = self.toolbar._select_tool.value + self.toolbar._move_tool.pcls = "" + self.toolbar._select_tool.pcls = "down" elif self.selected_tool == constants.TOOL_SELECT_CHICKENS: self.set_selected_tool(constants.TOOL_PLACE_ANIMALS, cursors.cursors["chicken"]) - self.toolbar._move_tool.group.value = self.toolbar._move_tool.value - self.toolbar._select_tool.pcls = "" - self.toolbar._move_tool.pcls = "down" + if self.toolbar.IS_DEFAULT: + self.toolbar._move_tool.group.value = self.toolbar._move_tool.value + self.toolbar._select_tool.pcls = "" + self.toolbar._move_tool.pcls = "down" return elif e.button != 1: # Left button return
--- a/gamelib/toolbar.py Wed Nov 25 20:44:28 2009 +0000 +++ b/gamelib/toolbar.py Wed Nov 25 21:17:45 2009 +0000 @@ -61,6 +61,9 @@ return update_counter class BaseToolBar(gui.Table): + + IS_DEFAULT = False + def __init__(self, gameboard, **params): gui.Table.__init__(self, **params) self.group = gui.Group(name='base_toolbar', value=None) @@ -264,6 +267,9 @@ return width, height class DefaultToolBar(BaseToolBar): + + IS_DEFAULT = True + def __init__(self, gameboard, **params): BaseToolBar.__init__(self, gameboard, **params) self.group = gui.Group(name='default_toolbar', value=None)