conduit r1363 - in trunk: . conduit/dataproviders conduit/datatypes conduit/modules/FspotModule



Author: thomasvm
Date: Mon Mar 10 18:59:33 2008
New Revision: 1363
URL: http://svn.gnome.org/viewvc/conduit?rev=1363&view=rev

Log:
2008-03-09  Matt Brown  <matt mattb net nz>:
	* conduit/dataproviders/Image.py:
	* conduit/datatypes/Photo.py: 
	* conduit/modules/FspotModule/FspotModule.py: Add caption support 
	to photo datatype and Image dataprovider. Modify F-Spot provider to
	set captions on images retrived from F-Spot. Fixes #521194


Modified:
   trunk/ChangeLog
   trunk/conduit/dataproviders/Image.py
   trunk/conduit/datatypes/Photo.py
   trunk/conduit/modules/FspotModule/FspotModule.py

Modified: trunk/conduit/dataproviders/Image.py
==============================================================================
--- trunk/conduit/dataproviders/Image.py	(original)
+++ trunk/conduit/dataproviders/Image.py	Mon Mar 10 18:59:33 2008
@@ -12,11 +12,12 @@
     and keep the _upload_info method on the ImageSink retain
     its api
     """
-    def __init__ (self, url, mimeType, name=None, tags=None):
+    def __init__ (self, url, mimeType, name=None, tags=None, caption=None):
         self.url = url
         self.mimeType = mimeType
         self.name = name
         self.tags = tags
+        self.caption = caption
 
 class ImageSink(DataProvider.DataSink):
     """
@@ -118,8 +119,9 @@
         photoURI = photo.get_local_uri()
         mimeType = photo.get_mimetype()
         tags = photo.get_tags ()
+        caption = photo.get_caption()
 
-        uploadInfo = UploadInfo(photoURI, mimeType, originalName, tags)
+        uploadInfo = UploadInfo(photoURI, mimeType, originalName, tags, caption)
        
         #Check if we have already uploaded the photo
         if LUID != None:

Modified: trunk/conduit/datatypes/Photo.py
==============================================================================
--- trunk/conduit/datatypes/Photo.py	(original)
+++ trunk/conduit/datatypes/Photo.py	Mon Mar 10 18:59:33 2008
@@ -27,6 +27,7 @@
     def __init__(self, URI, **kwargs):
         File.File.__init__(self, URI, **kwargs)
         self.pb = None
+        self._caption = None
 
     def get_photo_pixbuf(self):
         """
@@ -45,12 +46,27 @@
         """
         self.get_photo_pixbuf()
         return self.pb.get_width(),self.pb.get_height()
+
+    def get_caption(self):
+        """
+        @returns: the photo's caption
+        """
+        return self._caption
+
+    def set_caption(self, caption):
+        """
+        Sets the tags of the datatype
+        """
+        self._caption = caption
         
     def __getstate__(self):
-        return File.File.__getstate__(self)
+        data = File.File.__getstate__(self)
+        data["caption"] = self._caption
+        return data
 
     def __setstate__(self, data):
         self.pb = None
+        self._caption = data["caption"]
         File.File.__setstate__(self, data)
 
 

Modified: trunk/conduit/modules/FspotModule/FspotModule.py
==============================================================================
--- trunk/conduit/modules/FspotModule/FspotModule.py	(original)
+++ trunk/conduit/modules/FspotModule/FspotModule.py	Mon Mar 10 18:59:33 2008
@@ -119,6 +119,7 @@
         f.set_UID(LUID)
         f.set_open_URI(photouri)
         f.set_tags(tags)
+        f.set_caption(str(properties['Description']))
         return f
 
     def _upload_photo (self, uploadInfo):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]