changeset 543:8604b8d660f6

Add fontsize keyword to messagebox
author Neil Muller <drnlmuller@gmail.com>
date Sun, 18 Sep 2011 01:45:57 +0200
parents 0ffc9adfb965
children 13d02d1f5ae0
files mamba/widgets/messagebox.py
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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)