e5e351ce50d51e836a7c8846f2cb0bf9dbeb54d5
[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                 "generic_background": "radiobackground_01.png",
16                 "night_temple_background": "radiobackground_02.png",
17                 "day_temple_background": "radiobackground_03.png",
18                 "presidency_background": "radiobackground_04.png",
19                 "scriptures_background": "radiobackground_05.png",
20                 "conference": "conference.png",
21                 "magazines": "magazines.png",
22                 "more": "more.png",
23                 "mormonmessages": "mormonmessages.png",
24                 "radio": "radio.png",
25                 "scriptures": "scriptures.png",
26                 "icon": "icon.png",
27         }
28
29         def __init__(self, storePath, cachePath):
30                 self._storePath = storePath
31                 self._cachePath = cachePath
32
33         def get_surface_from_store(self, image):
34                 path = os.path.join(self._storePath, image)
35                 image = cairo.ImageSurface.create_from_png(path)
36                 return image
37
38         def get_image_from_store(self, image):
39                 path = os.path.join(self._storePath, image)
40                 image = gtk.Image()
41                 image.set_from_file(path)
42                 return image