From: <umg...@us...> - 2007-06-22 15:30:39
|
Revision: 439 http://svn.sourceforge.net/pybridge/?rev=439&view=rev Author: umgangee Date: 2007-06-22 08:30:41 -0700 (Fri, 22 Jun 2007) Log Message: ----------- Use cardstyle/background specified by user in preferences, relocate translatable bridge elements to vocabulary module. Modified Paths: -------------- trunk/pybridge/pybridge/ui/canvas.py trunk/pybridge/pybridge/ui/cardarea.py Modified: trunk/pybridge/pybridge/ui/canvas.py =================================================================== --- trunk/pybridge/pybridge/ui/canvas.py 2007-06-22 15:26:18 UTC (rev 438) +++ trunk/pybridge/pybridge/ui/canvas.py 2007-06-22 15:30:41 UTC (rev 439) @@ -20,15 +20,16 @@ import cairo import pybridge.environment as env +from config import config class CairoCanvas(gtk.DrawingArea): - """Provides a simple canvas layer for . - - Overlapping items. - """ + """Provides a simple canvas layer for the display of graphics.""" - background_path = env.find_pixmap('baize.png') + # TODO: enhance documentation. + + background_path = config['Appearance'].get('Background', + env.find_pixmap('baize.png')) background = cairo.ImageSurface.create_from_png(background_path) pattern = cairo.SurfacePattern(background) pattern.set_extend(cairo.EXTEND_REPEAT) @@ -89,7 +90,8 @@ """ @param id: unique identifier for source. @param source: if specified, ImageSurface. - @param xy: if specified, tuple providing (x, y) coords for source in backing. + @param xy: if specified, tuple providing (x, y) coords for source + in backing. @param z_index: if specified, integer. @param opacity: if specified, integer in range 0 to 1. """ Modified: trunk/pybridge/pybridge/ui/cardarea.py =================================================================== --- trunk/pybridge/pybridge/ui/cardarea.py 2007-06-22 15:26:18 UTC (rev 438) +++ trunk/pybridge/pybridge/ui/cardarea.py 2007-06-22 15:30:41 UTC (rev 439) @@ -23,6 +23,8 @@ import pybridge.environment as env from canvas import CairoCanvas +from config import config +from vocabulary import * from pybridge.bridge.card import Card from pybridge.bridge.symbols import Direction, Rank, Suit @@ -36,10 +38,7 @@ # The red-black-red-black ordering convention. RED_BLACK = [Suit.Diamond, Suit.Club, Suit.Heart, Suit.Spade] -DIRECTION_SYMBOLS = {Direction.North : _('North'), Direction.East : _('East'), - Direction.South : _('South'), Direction.West : _('West') } - class CardArea(CairoCanvas): """This widget is a graphical display of tricks and hands of cards. @@ -47,7 +46,8 @@ """ # Load card mask. - card_mask_path = env.find_pixmap('bonded.png') + card_mask_file = config['Appearance'].get('CardStyle', 'bonded.png') + card_mask_path = env.find_pixmap(card_mask_file) card_mask = cairo.ImageSurface.create_from_png(card_mask_path) font_description = pango.FontDescription('Sans Bold 10') @@ -205,9 +205,9 @@ layout = pango.Layout(self.create_pango_context()) layout.set_font_description(self.font_description) if name is None: - layout.set_text('%s' % DIRECTION_SYMBOLS[position]) + layout.set_text('%s' % DIRECTION_NAMES[position]) else: - layout.set_text('%s: %s' % (DIRECTION_SYMBOLS[position], name)) + layout.set_text('%s: %s' % (DIRECTION_NAMES[position], name)) # Create an ImageSurface respective to dimensions of text. width, height = layout.get_pixel_size() @@ -264,7 +264,6 @@ self.set_trick(trick) - def set_trick(self, trick): """Sets the current trick. Draws representation of current trick to context. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |