Author: duncan
Date: Wed Aug 22 16:02:13 2007
New Revision: 9841
Log:
The image viewer and the skins seem not to correctly handle the exif metadata
This should fix these errors and use IMAGEVIEWER_REVERSED_IMAGES correctly
Modified:
branches/rel-1/freevo/src/image/imageitem.py
branches/rel-1/freevo/src/image/viewer.py
branches/rel-1/freevo/src/skins/main/skin_utils.py
Modified: branches/rel-1/freevo/src/image/imageitem.py
==============================================================================
--- branches/rel-1/freevo/src/image/imageitem.py (original)
+++ branches/rel-1/freevo/src/image/imageitem.py Wed Aug 22 16:02:13 2007
@@ -42,8 +42,11 @@
class ImageItem(Item):
- def __init__(self, url, parent, name = None, duration =
config.IMAGEVIEWER_DURATION):
- #print "__init__(self, url, parent, name=%s, duration=%s)" % (name,
duration)
+ def __init__(self, url, parent, name=None,
duration=config.IMAGEVIEWER_DURATION):
+ """
+ Default constructor for an image item
+ """
+ #_debug_("__init__(self, url, parent, name=%s, duration=%s)" % (name,
duration), 2)
self.type = 'image'
self.autovars = [ ( 'rotation', 0 ) ]
Item.__init__(self, parent)
@@ -59,10 +62,10 @@
def __getitem__(self, key):
- #print "__getitem__(self=%s, key=%s)" % (self.filename, key)
"""
- return the specific attribute as string or an empty string
+ returns the specific attribute as string or an empty string
"""
+ _debug_("__getitem__(self=%s, key=%s)" % (self.filename, key), 2)
if key == "geometry":
if self['width'] and self['height']:
return '%sx%s' % (self['width'], self['height'])
@@ -77,40 +80,41 @@
except:
pass
+ print "__getitem__(self=%s, key=%s, res=%r)" % (self.filename, key,
Item.__getitem__(self, key))
return Item.__getitem__(self, key)
def sort(self, mode=None):
- #print "sort(self, mode=%s)" % (mode)
"""
Returns the string how to sort this item
"""
+ _debug_("sort(self, mode=%s)" % (mode), 2)
if mode == 'date':
return u'%s%s' % (os.stat(self.filename).st_ctime,
Unicode(self.filename))
return Unicode(self.filename)
def actions(self):
- #print "actions(self)"
"""
return a list of possible actions on this item.
"""
+ _debug_("actions(self)", 2)
return [ ( self.view, _('View Image') ) ]
def cache(self):
- #print "cache(self)"
"""
caches (loads) the next image
"""
+ _debug_("cache(self)", 2)
viewer.get_singleton().cache(self)
def view(self, arg=None, menuw=None):
- #print "view(self, arg=%s, menuw=%s)" % (arg, menuw)
"""
view the image
"""
+ _debug_("view(self, arg=%s, menuw=%s)" % (arg, menuw), 2)
if not self.menuw:
self.menuw = menuw
self.parent.current_item = self
Modified: branches/rel-1/freevo/src/image/viewer.py
==============================================================================
--- branches/rel-1/freevo/src/image/viewer.py (original)
+++ branches/rel-1/freevo/src/image/viewer.py Wed Aug 22 16:02:13 2007
@@ -81,17 +81,20 @@
def free_cache(self):
- #print 'free_cache(self)'
"""
free the current cache to save memory
"""
+ _debug_('free_cache(self)', 2)
self.bitmapcache = util.objectcache.ObjectCache(3, desc='viewer')
if self.parent and self.free_cache in self.parent.show_callbacks:
self.parent.show_callbacks.remove(self.free_cache)
def view(self, item, zoom=0, rotation=0):
- #print 'view(self, item, zoom=%s, rotation=%s)' % (zoom, rotation)
+ '''
+ view an image
+ '''
+ _debug_('view(self, item, zoom=%s, rotation=%s)' % (zoom, rotation), 2)
if zoom:
self.app_mode = 'image_zoom'
else:
@@ -106,7 +109,10 @@
item.menuw.show_callbacks.append(self.free_cache)
self.filename = filename
- self.rotation = rotation
+ if config.IMAGEVIEWER_REVERSED_IMAGES:
+ self.rotation = 360 - rotation
+ else:
+ self.rotation = rotation
if filename and len(filename) > 0:
image = self.osd.loadbitmap(filename, cache=self.bitmapcache)
@@ -184,7 +190,6 @@
bbw = min(max((width / 3) * scale, self.osd.width), width) /
scale
bbh = min(max((height / 3) * scale, self.osd.height), height)
/ scale
-
# calculate the beginning of the bounding box
bbx = max(0, bbcx - bbw/2)
bby = max(0, bbcy - bbh/2)
@@ -197,8 +202,6 @@
else:
new_w, new_h = bbw * scale, bbh * scale
-
-
else:
if self.rotation % 180:
height, width = width, height
@@ -246,8 +249,7 @@
bbx += zoom[1]
bby += zoom[2]
- if (last_image and self.last_image[0] != item and
- config.IMAGEVIEWER_BLEND_MODE != None):
+ if (last_image and self.last_image[0] != item and
config.IMAGEVIEWER_BLEND_MODE):
screen = self.osd.screen.convert()
screen.fill((0,0,0,0))
screen.blit(self.osd.zoomsurface(image, scale, bbx, bby, bbw, bbh,
Modified: branches/rel-1/freevo/src/skins/main/skin_utils.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/skin_utils.py (original)
+++ branches/rel-1/freevo/src/skins/main/skin_utils.py Wed Aug 22 16:02:13 2007
@@ -105,27 +105,20 @@
orientation = tags['Image Orientation']
_debug_('%s orientation=%s' % (item['name'], tags['Image
Orientation']))
if str(orientation) == "Rotated 90 CCW":
- if config.IMAGEVIEWER_REVERSED_IMAGES:
- item['rotation'] = 90
- else:
- item['rotation'] = 270
+ item['rotation'] = 270
elif str(orientation) == "Rotated 180":
item['rotation'] = 180
elif str(orientation) == "Rotated 90 CW":
- if config.IMAGEVIEWER_REVERSED_IMAGES:
- item['rotation'] = 270
- else:
- item['rotation'] = 90
+ item['rotation'] = 90
except Exception, e:
- pass
+ _debug_('%s' % (e), config.DINFO)
if image and item['rotation']:
# pygame reverses the image rotation
if config.IMAGEVIEWER_REVERSED_IMAGES:
- rotation = item['rotation']
- else:
rotation = 360 - item['rotation']
- _debug_('%s rotation=%s->%s' % (item['name'], item['rotation'],
rotation))
+ else:
+ rotation = item['rotation']
image = pygame.transform.rotate(image, rotation)
if not image:
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog