Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS8
-rw-r--r--activity/activity.info2
-rw-r--r--tasetup.py11
3 files changed, 19 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 6376a43..14cb6eb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+23
+
+* caching images
+
+22
+
+* added POT file
+
21
* added ru
diff --git a/activity/activity.info b/activity/activity.info
index 4435a86..b172a47 100644
--- a/activity/activity.info
+++ b/activity/activity.info
@@ -1,6 +1,6 @@
[Activity]
name = Turtle Art
-activity_version = 21
+activity_version = 23
license = MIT
service_name = org.laptop.TurtleArtActivity
class = TurtleArtActivity.TurtleArtActivity
diff --git a/tasetup.py b/tasetup.py
index 33ed561..8609928 100644
--- a/tasetup.py
+++ b/tasetup.py
@@ -187,4 +187,13 @@ def setup_tool(tw,x,y,name):
return who
def load_image(path, dir, file):
- return gtk.gdk.pixbuf_new_from_file(os.path.join(path,dir,file+'.svg'))
+ from sugar.activity import activity
+
+ # first try to open the cached image
+ # if you fail, open the .svg file and cache the result
+ try: return gtk.gdk.pixbuf_new_from_file(os.path.join(activity.get_activity_root(),"data",file+'.png'))
+ except:
+ foo = gtk.gdk.pixbuf_new_from_file(os.path.join(path,dir,file+'.svg'))
+ foo.save(os.path.join(activity.get_activity_root(),"data",file+'.png'), "png")
+ return foo
+