From a6a98a750f0cce8a86f1247fd86c760551d73625 Mon Sep 17 00:00:00 2001 From: Ray Date: Thu, 18 Jun 2009 14:11:53 -0400 Subject: [PATCH] Clean up changes to use 0-52 card encoding. --- pyfpdb/Mucked.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pyfpdb/Mucked.py b/pyfpdb/Mucked.py index 12da2a97..8ae6bc60 100755 --- a/pyfpdb/Mucked.py +++ b/pyfpdb/Mucked.py @@ -76,18 +76,19 @@ class Aux_Window: for j in range(0, 13): for i in range(0, 4): - temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42) - pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0) - card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = temp_pb + card_images[Card.cardFromValueSuit(ranks[j], suits[i])] = self.cropper(pb, i, j) temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42) # also pick out a card back and store in [0] - j = 13 - i = 2 - pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0) - card_images[0] = temp_pb + card_images[0] = self.cropper(pb, 2, 13) return(card_images) # cards are 30 wide x 42 high + def cropper(self, pb, i, j): + """Crop out a card image given an FTP deck and the i, j position.""" + temp_pb = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, pb.get_has_alpha(), pb.get_bits_per_sample(), 30, 42) + pb.copy_area(30*j, 42*i, 30, 42, temp_pb, 0, 0) + return temp_pb + def split_cards(self, card): if card == 'xx': return ('B', 'S') return (card[0], card[1].upper())