# HG changeset patch # User Neil Muller # Date 1282990220 -7200 # Node ID 63e702d93e0eb59a3def490c92efa29c0c51eff7 # Parent 40dd77f71e117c878ae287531e54cd710564c306 Call detail enter and leave hooks diff -r 40dd77f71e11 -r 63e702d93e0e gamelib/gamescreen.py --- a/gamelib/gamescreen.py Sat Aug 28 09:37:21 2010 +0200 +++ b/gamelib/gamescreen.py Sat Aug 28 12:10:20 2010 +0200 @@ -106,11 +106,13 @@ w, h = self.state.set_current_detail(detail) self.detail.set_image_rect(Rect(0, 0, w, h)) self.add_centered(self.detail) + self.state.do_enter_detail() self.parent.cursor_highlight(False) def clear_detail(self): """Hide the detail view""" self.remove(self.detail) + self.state.do_leave_detail() self.state.set_current_detail(None) diff -r 40dd77f71e11 -r 63e702d93e0e gamelib/state.py --- a/gamelib/state.py Sat Aug 28 09:37:21 2010 +0200 +++ b/gamelib/state.py Sat Aug 28 12:10:20 2010 +0200 @@ -164,6 +164,14 @@ def interact_detail(self, pos): return self.current_detail.interact(self.tool, pos) + def do_enter_detail(self): + if self.current_detail: + self.current_detail.enter() + + def do_leave_detail(self): + if self.current_detail: + self.current_detail.leave() + def animate(self): if not self.do_check: return self.current_scene.animate()