Mercurial > boomslang
changeset 645:4aae15dedc29 pyntnclick
Pass click events on to detail window.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Sun, 12 Feb 2012 03:14:11 +0200 |
parents | 1faced4e343a |
children | edcca10b8a53 |
files | pyntnclick/gamescreen.py |
diffstat | 1 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/pyntnclick/gamescreen.py Sun Feb 12 02:27:27 2012 +0200 +++ b/pyntnclick/gamescreen.py Sun Feb 12 03:14:11 2012 +0200 @@ -87,6 +87,8 @@ # self.game.current_scene.draw(surface, self) def mouse_down(self, event, widget): + if self.game.current_detail: + return self.detail.mouse_down(event, widget) self.mouse_move(event, widget) if event.button != 1: # We have a right/middle click self.game.cancel_doodah(self.screen) @@ -176,7 +178,7 @@ surface.subsurface(self.image_rect), self) super(DetailWindow, self).draw(surface) - def mouse_down(self, event): + def mouse_down(self, event, widget): self.mouse_move(event) if event.button != 1: # We have a right/middle click self.game.cancel_doodah(self.screen) @@ -193,8 +195,13 @@ self.game.current_detail.mouse_move(self.global_to_local(pos)) def show_message(self, message, style=None): - self.parent.show_message(message, style) - self.invalidate() + # self.parent.show_message(message, style) + # self.invalidate() + print message + + def global_to_local(self, pos): + x, y = pos + return (x - self.rect.left, y - self.rect.top) class ToolBar(Widget):