Mercurial > boomslang
comparison gamelib/gamescreen.py @ 97:60770ca02c1a
Fix message dialog mouse cursor freezing.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 24 Aug 2010 07:51:42 +0200 |
parents | 350ce4ebe122 |
children | 367b1c9c3c6d |
comparison
equal
deleted
inserted
replaced
96:397c5ff1528f | 97:60770ca02c1a |
---|---|
46 | 46 |
47 def unselect(self): | 47 def unselect(self): |
48 self.state.set_tool(None) | 48 self.state.set_tool(None) |
49 | 49 |
50 | 50 |
51 class MessageDialog(BoomLabel): | 51 class MessageDialog(BoomLabel, CursorWidget): |
52 | 52 |
53 def __init__(self, text, wrap_width, **kwds): | 53 def __init__(self, text, wrap_width, **kwds): |
54 CursorWidget.__init__(self) | |
54 paras = text.split("\n\n") | 55 paras = text.split("\n\n") |
55 text = "\n".join([textwrap.fill(para, wrap_width) for para in paras]) | 56 text = "\n".join([textwrap.fill(para, wrap_width) for para in paras]) |
56 Label.__init__(self, text, **kwds) | 57 Label.__init__(self, text, **kwds) |
57 self.set_margin(5) | 58 self.set_margin(5) |
58 self.border_width = 1 | 59 self.border_width = 1 |
59 self.border_color = (0, 0, 0) | 60 self.border_color = (0, 0, 0) |
60 self.bg_color = (127, 127, 127) | 61 self.bg_color = (127, 127, 127) |
61 self.fg_color = (0, 0, 0) | 62 self.fg_color = (0, 0, 0) |
63 | |
64 def draw(self, surface): | |
65 BoomLabel.draw(self, surface) | |
66 CursorWidget.draw(self, surface) | |
62 | 67 |
63 def mouse_down(self, event): | 68 def mouse_down(self, event): |
64 self.dismiss() | 69 self.dismiss() |
65 | 70 |
66 | 71 |