Adding a home icon
[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                 "home": "home.png",
16                 "loading": "loading.gif",
17
18                 "radio_header": "radio_header.png",
19                 "conference_background": "conference_bg.png",
20                 "magazine_background": "magazine_bg.png",
21                 "scriptures_background": "scripture_bg.png",
22
23                 "conferences": "conference.png",
24                 "magazines": "magazines.png",
25                 "more": "more.png",
26                 "mormonmessages": "mormonmessages.png",
27                 "radio": "radio.png",
28                 "scriptures": "scriptures.png",
29                 "icon": "icon.png",
30         }
31
32         def __init__(self, storePath, cachePath):
33                 self._storePath = storePath
34                 self._cachePath = cachePath
35
36         def get_surface_from_store(self, imageName):
37                 path = os.path.join(self._storePath, imageName)
38                 image = cairo.ImageSurface.create_from_png(path)
39                 return image
40
41         def get_image_from_store(self, imageName):
42                 path = os.path.join(self._storePath, imageName)
43                 image = gtk.Image()
44                 image.set_from_file(path)
45                 return image
46
47         def set_image_from_store(self, image, imageName):
48                 path = os.path.join(self._storePath, imageName)
49                 image.set_from_file(path)
50                 return image
51
52         def get_pixbuf_from_store(self, imageName):
53                 path = os.path.join(self._storePath, imageName)
54                 return gtk.gdk.pixbuf_new_from_file(path)
55
56         def get_pixbuf_animation_from_store(self, imageName):
57                 path = os.path.join(self._storePath, imageName)
58                 return gtk.gdk.PixbufAnimation(path)