Mercurial > boomslang
changeset 696:b773e9f42ba3 pyntnclick
Better tool/detail canceling.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 14 Feb 2012 16:02:13 +0200 |
parents | 20f65f716048 |
children | 4bf13af26d6a |
files | pyntnclick/gamescreen.py pyntnclick/state.py |
diffstat | 2 files changed, 5 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/pyntnclick/gamescreen.py Tue Feb 14 16:27:49 2012 +0200 +++ b/pyntnclick/gamescreen.py Tue Feb 14 16:02:13 2012 +0200 @@ -132,7 +132,7 @@ def mouse_down(self, event, widget): if event.button != 1: - self.game.cancel_doodah(self.screen) + self.game.set_tool(None) def select(self, tool): self.game.set_tool(tool) @@ -175,7 +175,10 @@ def mouse_down(self, event, widget): self.mouse_move(event, widget) if event.button != 1: # We have a right/middle click - self.game.cancel_doodah(self.screen) + if self.game.tool: + self.game.set_tool(None) + elif self.is_detail: + self.close(event, widget) else: pos = self.global_to_local(event.pos) result = self.scene.interact(self.game.tool, pos) @@ -275,7 +278,6 @@ ToolBar((0, rect.height), self.gd, self)) self.inventory = self.toolbar.inventory - self.game.change_scene self.gd.running = True def game_event_inventory(self, data):
--- a/pyntnclick/state.py Tue Feb 14 16:27:49 2012 +0200 +++ b/pyntnclick/state.py Tue Feb 14 16:02:13 2012 +0200 @@ -173,15 +173,6 @@ def set_tool(self, item): self.tool = item - def cancel_doodah(self, screen): - if self.tool: - self.set_tool(None) - - # XXX: Needs to be tweaked to work with the new - # scene stuff - #elif self.current_detail: - # screen.state_widget.clear_detail() - def animate(self): if not self.do_check: return self.current_scene.animate()