~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/spriteutils.py

  • Committer: Edwin Grubbs
  • Date: 2010-02-08 19:44:03 UTC
  • mto: This revision was merged to the branch mainline in revision 10304.
  • Revision ID: edwin.grubbs@canonical.com-20100208194403-3dxlidz0txt72pa2
Handle repeat-x for sprites.

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
        positions = {}
99
99
        for index, sprite in enumerate(self.sprites):
100
100
            try:
101
 
                combined_image.paste(sprite['image'], (0, y))
 
101
                position = [0, y]
 
102
                combined_image.paste(sprite['image'], tuple(position))
 
103
                # An icon in a vertically combined image can be repeated
 
104
                # horizontally, but we have to repeat it in the combined
 
105
                # image so that we don't repeat white space.
 
106
                if sprite['rule'].style.backgroundRepeat == 'repeat-x':
 
107
                    width = sprite['image'].size[0]
 
108
                    for x_position in range(width, max_width, width):
 
109
                        position[0] = x_position
 
110
                        combined_image.paste(sprite['image'], tuple(position))
102
111
            except:
103
112
                print >> sys.stderr, (
104
113
                    "Error with image file %s" % sprite['filename'])