Updating icons
[watersofshiloah] / src / imagestore.py
1 import os
2
3 import cairo
4 import gtk
5
6
7 class ImageStore(object):
8
9         STORE_LOOKUP = {
10                 "next": "next.png",
11                 "prev": "prev.png",
12                 "pause": "pause.png",
13                 "play": "play.png",
14                 "stop": "stop.png",
15
16                 "radio_header": "radio_header.png",
17                 "conference_background": "conference_bg.png",
18                 "magazine_background": "magazine_bg.png",
19                 "scriptures_background": "scripture_bg.png",
20
21                 "conferences": "conference.png",
22                 "magazines": "magazines.png",
23                 "more": "more.png",
24                 "mormonmessages": "mormonmessages.png",
25                 "radio": "radio.png",
26                 "scriptures": "scriptures.png",
27                 "icon": "icon.png",
28         }
29
30         def __init__(self, storePath, cachePath):
31                 self._storePath = storePath
32                 self._cachePath = cachePath
33
34         def get_surface_from_store(self, image):
35                 path = os.path.join(self._storePath, image)
36                 image = cairo.ImageSurface.create_from_png(path)
37                 return image
38
39         def get_image_from_store(self, image):
40                 path = os.path.join(self._storePath, image)
41                 image = gtk.Image()
42                 image.set_from_file(path)
43                 return image
44
45         def get_pixbuf_from_store(self, image):
46                 path = os.path.join(self._storePath, image)
47                 return gtk.gdk.pixbuf_new_from_file(path)