changeset 671:b27b5c6c54e8 pyntnclick

Use constants for font location
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 12 Feb 2012 18:24:22 +0200
parents fe7023750b20
children 55d5d384fc16
files pyntnclick/constants.py pyntnclick/gamescreen.py pyntnclick/tools/rect_drawer.py
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/pyntnclick/constants.py	Sun Feb 12 18:00:18 2012 +0200
+++ b/pyntnclick/constants.py	Sun Feb 12 18:24:22 2012 +0200
@@ -26,6 +26,8 @@
     debug = _get_debug()
 
     font = 'Vera.ttf'
+    bold_font = 'VeraBd.ttf'
+    mono_font = 'Monospace.ttf'
     font_size = 16
     text_color = 'black'
     label_padding = 10
--- a/pyntnclick/gamescreen.py	Sun Feb 12 18:00:18 2012 +0200
+++ b/pyntnclick/gamescreen.py	Sun Feb 12 18:24:22 2012 +0200
@@ -257,8 +257,8 @@
         self.left = self.rect.left
 
         self.menu_button = self.add_tool(
-            0, TextButton, gd, "Menu", fontname="VeraBd.ttf", color="red",
-            padding=2, border=0)
+            0, TextButton, gd, "Menu", fontname=gd.constants.bold_font,
+            color="red", padding=2, border=0)
         self.menu_button.add_callback(MOUSEBUTTONDOWN, self.menu_callback)
 
         hand_image = gd.resource.get_image('items', 'hand.png')
--- a/pyntnclick/tools/rect_drawer.py	Sun Feb 12 18:00:18 2012 +0200
+++ b/pyntnclick/tools/rect_drawer.py	Sun Feb 12 18:24:22 2012 +0200
@@ -85,7 +85,7 @@
         self.current_image = None
         self.place_image_menu = None
         self.close_button = LabelWidget(pygame.Rect((0, 0), (200, 100)),
-                gd, 'Close', fontname='Vera.ttf', fontsize=20)
+                gd, 'Close', fontname=constants.bold_font, fontsize=20)
         self.close_button.fg_color = (0, 0, 0)
         self.close_button.bg_color = (0, 0, 0)
         self.draw_rects = True
@@ -528,7 +528,7 @@
     def __init__(self, rect, gd, app_image):
         self.app_image = app_image
         super(ModeLabel, self).__init__(rect,
-                gd, 'Mode : ', fontname='VeraBd.ttf',
+                gd, 'Mode : ', fontname=constants.bold_font,
                 fontsize=15, color=pygame.color.Color(128, 0, 255))
 
     def draw_all(self, surface):
@@ -540,7 +540,7 @@
     rect = pygame.rect.Rect(0, 0, constants.menu_width,
             constants.menu_button_height)
     rect.move_ip(805, ypos)
-    button = TextButton(rect, gd, text, fontname='Vera.ttf', fontsize=12,
+    button = TextButton(rect, gd, text, fontname=constants.font, fontsize=12,
             color=pygame.color.Color(255, 255, 0), border=1, padding=3)
     button.add_callback('clicked', action)
     return button