Hook up shift glyph
[naja.git] / naja / widgets / text.py
index 1d9732e4ced817da97dbdb9207107a59c84394cb..302d2370f3fdf7d85d11c88c754f57c3b9e72102 100644 (file)
@@ -22,6 +22,8 @@ MARKUP_MAP = {
     'BLUE': ('glyphs/key.png', PALETTE.BLUE),
     'CLOCKWISE': ('glyphs/clockwise.png', None),
     'ANTICLOCKWISE': ('glyphs/anticlockwise.png', None),
+    'SHIFT_LEFT': ('glyphs/shift_left.png', None),
+    'SHIFT_RIGHT': ('glyphs/shift_right.png', None),
 
     'HEALTH_NOCOLOUR': ('glyphs/health.png', None),
     'WINTOKEN_NOCOLOUR': ('glyphs/win.png', None),
@@ -133,6 +135,8 @@ class TextBoxWidget(TextWidget):
                                                        PALETTE.BLACK))
         self.box_width = kwargs.pop('box_width', 0)
 
+        self.full_width = kwargs.pop('full_width', True)
+
         super(TextBoxWidget, self).__init__(*args, **kwargs)
 
     def lines(self, image_map):
@@ -219,6 +223,9 @@ class TextBoxWidget(TextWidget):
             width = max(width, line_rect.width + self.padding * 2)
             height += line_rect.height
 
+        if self.full_width:
+            width = max(width, self.box_width)
+
         self.surface = pygame.surface.Surface((width, height),
                                               pygame.locals.SRCALPHA)
         self.surface.fill(self.bg_colour)