conduit r1206 - in trunk: . conduit conduit/datatypes conduit/modules conduit/modules/FspotModule test/python-tests
- From: jstowers svn gnome org
- To: svn-commits-list gnome org
- Subject: conduit r1206 - in trunk: . conduit conduit/datatypes conduit/modules conduit/modules/FspotModule test/python-tests
- Date: Sun, 13 Jan 2008 06:32:12 +0000 (GMT)
Author: jstowers
Date: Sun Jan 13 06:32:10 2008
New Revision: 1206
URL: http://svn.gnome.org/viewvc/conduit?rev=1206&view=rev
Log:
Pickle improvements
Modified:
trunk/ChangeLog
trunk/conduit/TypeConverter.py
trunk/conduit/datatypes/Audio.py
trunk/conduit/datatypes/DataType.py
trunk/conduit/datatypes/Photo.py
trunk/conduit/datatypes/Video.py
trunk/conduit/modules/FspotModule/FspotDbusModule.py
trunk/conduit/modules/PhotoConverterModule.py
trunk/test/python-tests/TestCoreDatatypes.py
Modified: trunk/conduit/TypeConverter.py
==============================================================================
--- trunk/conduit/TypeConverter.py (original)
+++ trunk/conduit/TypeConverter.py Sun Jan 13 06:32:10 2008
@@ -4,6 +4,7 @@
Copyright: John Stowers, 2006
License: GPLv2
"""
+import traceback
import logging
log = logging.getLogger("TypeConverter")
@@ -192,6 +193,7 @@
to = self.convertables[from_type][to_type](data, **args)
newdata = self._retain_info_in_conversion(fromdata=data, todata=to)
except Exception:
+ log.debug(traceback.format_exc())
raise Exceptions.ConversionError(from_type, to_type)
else:
return data
@@ -202,6 +204,7 @@
to = self.convertables[from_type][to_type](data, **args)
newdata = self._retain_info_in_conversion(fromdata=data, todata=to)
except Exception:
+ log.debug(traceback.format_exc())
raise Exceptions.ConversionError(from_type, to_type)
else:
raise Exceptions.ConversionDoesntExistError(from_type, to_type)
Modified: trunk/conduit/datatypes/Audio.py
==============================================================================
--- trunk/conduit/datatypes/Audio.py (original)
+++ trunk/conduit/datatypes/Audio.py Sun Jan 13 06:32:10 2008
@@ -13,11 +13,11 @@
def __init__(self, URI, **kwargs):
File.File.__init__(self, URI, **kwargs)
- def get_artist(self):
+ def get_audio_artist(self):
return None
- def get_album(self):
+ def get_audio_album(self):
return None
- def get_duration(self):
+ def get_audio_duration(self):
return None
Modified: trunk/conduit/datatypes/DataType.py
==============================================================================
--- trunk/conduit/datatypes/DataType.py (original)
+++ trunk/conduit/datatypes/DataType.py Sun Jan 13 06:32:10 2008
@@ -165,6 +165,7 @@
data['mtime'] = self.get_mtime()
data['uid'] = self.get_UID()
data['open_uri'] = self.get_open_URI()
+ data['tags'] = self.get_tags()
return data
def __setstate__(self, data):
@@ -174,3 +175,5 @@
self.set_mtime(data['mtime'])
self.set_UID(data['uid'])
self.set_open_URI(data['open_uri'])
+ self.set_tags(data['tags'])
+
Modified: trunk/conduit/datatypes/Photo.py
==============================================================================
--- trunk/conduit/datatypes/Photo.py (original)
+++ trunk/conduit/datatypes/Photo.py Sun Jan 13 06:32:10 2008
@@ -19,7 +19,7 @@
File.File.__init__(self, URI, **kwargs)
self.pb = None
- def get_pixbuf(self):
+ def get_photo_pixbuf(self):
"""
Defer actually getting the pixbuf till as
late as possible, as it is really only needed for
@@ -30,11 +30,18 @@
self.pb = gtk.gdk.pixbuf_new_from_file(self.get_local_uri())
return self.pb
- def get_size(self):
+ def get_photo_size(self):
"""
Returns the pb size, width, height
"""
- self.get_pixbuf()
- return self.pb.get_width(),self.pb.get_height()
+ self.get_photo_pixbuf()
+ return self.pb.get_width(),self.pb.get_height()
+
+ def __getstate__(self):
+ return File.File.__getstate__(self)
+
+ def __setstate__(self, data):
+ self.pb = None
+ File.File.__setstate__(self, data)
Modified: trunk/conduit/datatypes/Video.py
==============================================================================
--- trunk/conduit/datatypes/Video.py (original)
+++ trunk/conduit/datatypes/Video.py Sun Jan 13 06:32:10 2008
@@ -15,10 +15,10 @@
def __init__(self, URI, **kwargs):
File.File.__init__(self, URI, **kwargs)
- def get_duration(self):
+ def get_video_duration(self):
return None
- def get_size(self):
+ def get_video_size(self):
return None,None
Modified: trunk/conduit/modules/FspotModule/FspotDbusModule.py
==============================================================================
--- trunk/conduit/modules/FspotModule/FspotDbusModule.py (original)
+++ trunk/conduit/modules/FspotModule/FspotDbusModule.py Sun Jan 13 06:32:10 2008
@@ -86,7 +86,7 @@
return the list of photo id's
"""
Image.ImageTwoWay.get_all(self)
- return list (str(photo_id) for photo_id in self.photos)
+ return [str(photo_id) for photo_id in self.photos]
def get(self, LUID):
"""
@@ -95,8 +95,10 @@
Image.ImageTwoWay.get(self, LUID)
properties = self.photo_remote.GetPhotoProperties (LUID)
- photouri = properties['Uri']
- tags = properties['Tags'].split(',')
+
+ #FIXME: Oh python-dbus, why wont you marshall dbus.String to str...
+ photouri = str(properties['Uri'])
+ tags = str(properties['Tags']).split(',')
f = Photo.Photo(URI=photouri)
f.set_UID(LUID)
@@ -125,7 +127,6 @@
self.tag_remote.GetTagByName (tag)
except:
self.tag_remote.CreateTag (fspot_tag)
-
tags.append (tag)
# import the photo
Modified: trunk/conduit/modules/PhotoConverterModule.py
==============================================================================
--- trunk/conduit/modules/PhotoConverterModule.py (original)
+++ trunk/conduit/modules/PhotoConverterModule.py Sun Jan 13 06:32:10 2008
@@ -44,7 +44,7 @@
"""
import gtk.gdk
- pb = photo.get_pixbuf()
+ pb = photo.get_photo_pixbuf()
out_file = photo.to_tempfile()
if doResize:
@@ -70,7 +70,7 @@
#resize if necessary
if newSize != NO_RESIZE:
- w,h = photo.get_size()
+ w,h = photo.get_photo_size()
width,height = Utils.get_proportional_resize(
desiredW=int(newSize.split('x')[0]),
desiredH=int(newSize.split('x')[1]),
Modified: trunk/test/python-tests/TestCoreDatatypes.py
==============================================================================
--- trunk/test/python-tests/TestCoreDatatypes.py (original)
+++ trunk/test/python-tests/TestCoreDatatypes.py Sun Jan 13 06:32:10 2008
@@ -17,6 +17,7 @@
"text" : new_text,
"setting" : new_setting,
"test" : new_test_datatype,
+ "photo" : new_photo,
}
for t,func in TYPES.items():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]