From e0085fa68f82c5dd5c0320e4cd8a49c128a0adbc Mon Sep 17 00:00:00 2001 From: Live System User Date: Thu, 26 Feb 2009 03:17:26 +0000 Subject: Resolution independent medal images. --- diff --git a/mainscreen.py b/mainscreen.py index 6c3735a..c459ac4 100644 --- a/mainscreen.py +++ b/mainscreen.py @@ -183,8 +183,10 @@ class MainScreen(gtk.VBox): 'silver': 'images/silver-medal.svg', 'gold': 'images/gold-medal.svg' } + + medal_size = int(2.0 * sugar.graphics.style.GRID_CELL_SIZE) medalpixbuf = gtk.gdk.pixbuf_new_from_file(images[medal_type]) - medalpixbuf = medalpixbuf.scale_simple(200, 200, gtk.gdk.INTERP_BILINEAR) + medalpixbuf = medalpixbuf.scale_simple(medal_size, medal_size, gtk.gdk.INTERP_BILINEAR) medalimage = gtk.Image() medalimage.set_from_pixbuf(medalpixbuf) diff --git a/medalscreen.py b/medalscreen.py index 45d0124..42833bf 100644 --- a/medalscreen.py +++ b/medalscreen.py @@ -23,9 +23,11 @@ import gobject, pygtk, gtk, pango # Import Sugar UI modules. import sugar.activity.activity -from sugar.graphics import * +import sugar.graphics.style class MedalScreen(gtk.EventBox): + MEDAL_SIZE = int(4.5 * sugar.graphics.style.GRID_CELL_SIZE) + def __init__(self, medal, activity): gtk.EventBox.__init__(self) @@ -36,14 +38,13 @@ class MedalScreen(gtk.EventBox): # Load the image. medal_type = medal['type'] - bundle = sugar.activity.activity.get_bundle_path() images = { - 'bronze': bundle+'/images/bronze-medal.svg', - 'silver': bundle+'/images/silver-medal.svg', - 'gold': bundle+'/images/gold-medal.svg' + 'bronze': 'images/bronze-medal.svg', + 'silver': 'images/silver-medal.svg', + 'gold': 'images/gold-medal.svg' } medalpixbuf = gtk.gdk.pixbuf_new_from_file(images[medal_type]) - medalpixbuf = medalpixbuf.scale_simple(350, 350, gtk.gdk.INTERP_BILINEAR) + medalpixbuf = medalpixbuf.scale_simple(MedalScreen.MEDAL_SIZE, MedalScreen.MEDAL_SIZE, gtk.gdk.INTERP_BILINEAR) medalimage = gtk.Image() medalimage.set_from_pixbuf(medalpixbuf) -- cgit v0.9.1