Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLive System User <liveuser@localhost.localdomain>2009-02-26 03:17:26 (GMT)
committer Live System User <liveuser@localhost.localdomain>2009-02-26 03:17:26 (GMT)
commite0085fa68f82c5dd5c0320e4cd8a49c128a0adbc (patch)
treefb4793494d2c142076ed7892020d7c04d5f5be84
parentc6619e0bec3cb53fdb42f35cb26b24fbbb2cdfce (diff)
Resolution independent medal images.
-rw-r--r--mainscreen.py4
-rw-r--r--medalscreen.py13
2 files changed, 10 insertions, 7 deletions
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)