# HG changeset patch # User Neil Muller # Date 1316303157 -7200 # Node ID 8604b8d660f6ee9707682e5f738f108b2a2376d7 # Parent 0ffc9adfb9650bb1eb2d62ddc5ca180cf109ad3c Add fontsize keyword to messagebox diff -r 0ffc9adfb965 -r 8604b8d660f6 mamba/widgets/messagebox.py --- a/mamba/widgets/messagebox.py Sun Sep 18 01:45:10 2011 +0200 +++ b/mamba/widgets/messagebox.py Sun Sep 18 01:45:57 2011 +0200 @@ -1,23 +1,28 @@ +from mamba.constants import FONT_SIZE from mamba.widgets.base import Box from mamba.widgets.text import TextWidget, TextButton class MessageBox(Box): - def __init__(self, rect, text, post_callback=None, color='red'): + def __init__(self, rect, text, post_callback=None, color='red', + fontsize=FONT_SIZE): super(MessageBox, self).__init__(rect) self.text = text + self.font_size = fontsize self.post_callback = post_callback self.color = color self.prepare() self.modal = True def prepare(self): - cont = TextWidget((0, 0), "Press [OK] or Enter to continue") + cont = TextWidget((0, 0), "Press [OK] or Enter to continue", + fontsize=self.font_size) widgets = [] width = cont.rect.width for line in self.text.split('\n'): - message = TextWidget((0, 0), line, color=self.color) + message = TextWidget((0, 0), line, color=self.color, + fontsize=self.font_size) widgets.append(message) width = max(width, message.rect.width) widgets.append(cont)