# HG changeset patch # User Neil Muller # Date 1329039934 -7200 # Node ID edcca10b8a538a4f2ad1a849d8e8f7035a841ef0 # Parent 4aae15dedc2994d91eb0e9ba18348505f49db35b Return of the centred detail views diff -r 4aae15dedc29 -r edcca10b8a53 pyntnclick/gamescreen.py --- a/pyntnclick/gamescreen.py Sun Feb 12 03:14:11 2012 +0200 +++ b/pyntnclick/gamescreen.py Sun Feb 12 11:45:34 2012 +0200 @@ -125,8 +125,11 @@ def show_detail(self, detail): self.clear_detail() detail_obj = self.game.set_current_detail(detail) - self.detail.set_image_rect(Rect((0, 0), detail_obj.get_detail_size())) self.add(self.detail) + detail_rect = Rect((0, 0), detail_obj.get_detail_size()) + # Centre the widget + detail_rect.center = self.rect.center + self.detail.set_image_rect(detail_rect) self.game.do_enter_detail() def clear_detail(self): @@ -165,7 +168,6 @@ def set_image_rect(self, rect): bw = self.border_width self.image_rect = rect - self.image_rect.topleft = (bw, bw) self.rect = rect.inflate(bw * 2, bw * 2) self.close.rect.midbottom = rect.midbottom