Fix TextBoxWidget centering to work with TextWidget centering.
authorSimon Cross <hodgestar@gmail.com>
Fri, 16 May 2014 23:38:38 +0000 (01:38 +0200)
committerSimon Cross <hodgestar@gmail.com>
Fri, 16 May 2014 23:38:38 +0000 (01:38 +0200)
naja/widgets/text.py

index 587cb3c675cbb03f3395f3a90a9fa6befc41a5ea..1d9732e4ced817da97dbdb9207107a59c84394cb 100644 (file)
@@ -132,7 +132,6 @@ class TextBoxWidget(TextWidget):
         self.border_colour = convert_colour(kwargs.pop('border_colour',
                                                        PALETTE.BLACK))
         self.box_width = kwargs.pop('box_width', 0)
-        self.centre = kwargs.pop('centre', False)
 
         super(TextBoxWidget, self).__init__(*args, **kwargs)
 
@@ -227,10 +226,9 @@ class TextBoxWidget(TextWidget):
 
         x, y = self.padding, self.padding
         for line_surface in rendered_lines:
-            if self.centre and self.box_width:
+            if self.centre:
                 x = (width - line_surface.get_rect().width) / 2
                 x += self.padding
-                print x, width, line_surface.get_rect().width
             self.surface.blit(line_surface, (x, y))
             y += line_surface.get_rect().height
         for pos, img in image_map.items():