1 import conduit
2
3 import conduit.datatypes.File as File
4 import conduit.utils as Utils
5
6 PRESET_ENCODINGS = {
7 "jpeg":{'formats':'image/jpeg','default-format':'image/jpeg'},
8 "png":{'formats':'image/png','default-format':'image/png'}
9 }
10
12 """
13 @returns: True if the given mimetype string represents an image file
14 """
15 if mimetype.startswith("image/"):
16 return True
17 else:
18 return False
19
21 """
22 A Small wrapper around a Pixbuf
23 """
24
25 _name_ = "file/photo"
26
28 File.File.__init__(self, URI, **kwargs)
29 self.pb = None
30 self._caption = None
31
33 """
34 Defer actually getting the pixbuf till as
35 late as possible, as it is really only needed for
36 conversion
37 """
38 import gtk.gdk
39 if self.pb == None:
40 self.pb = gtk.gdk.pixbuf_new_from_file(self.get_local_uri())
41 return self.pb
42
49
51 """
52 @returns: the photo's caption
53 """
54 return self._caption
55
57 self._caption = caption
58
65
70
75