Update of /cvsroot/freevo/freevo/src/image
In directory sc8-pr-cvs1:/tmp/cvs-serv25647
Modified Files:
imageitem.py viewer.py
Removed Files:
bins.py exif.py
Log Message:
added to mmpython support, removed old stuff
Index: imageitem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/image/imageitem.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** imageitem.py 6 Apr 2003 21:12:57 -0000 1.9
--- imageitem.py 2 Jul 2003 20:10:28 -0000 1.10
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.10 2003/07/02 20:10:28 dischi
+ # added to mmpython support, removed old stuff
+ #
# Revision 1.9 2003/04/06 21:12:57 dischi
# o Switched to the new main skin
***************
*** 44,106 ****
import viewer
! import bins
! import exif
from item import Item
- tags_check = { 'date': [ 'Image DateTime','DateTime','EXIF'],
- 'width': [ 'EXIF ExifImageWidth','ExifImageWidth','EXIF'],
- 'height': [ 'EXIF ExifImageLength','ExifImageLength','EXIF'],
- 'exp': [ 'EXIF ExposureTime','ExposureTime','EXIF'],
- 'light': [ 'EXIF LightSource','LightSource','EXIF'],
- 'flash': [ 'EXIF Flash','Flash','EXIF'],
- 'make': [ 'Image Make','Make','EXIF'],
- 'model': [ 'Image Model','Model','EXIF'],
- 'software':[ 'Image Software','Software','EXIF']
- }
class ImageItem(Item):
def __init__(self, filename, parent, name = None, duration = 0):
! Item.__init__(self, parent)
self.type = 'image'
self.filename = filename
self.image = filename
-
- # variables only for ImageItem
self.duration = duration
! self.binsdesc = {}
! self.binsexif = {}
!
! # This should check for bins compatable info
! if os.path.isfile(filename + '.xml'):
! try:
! binsinfo = bins.get_bins_desc(filename)
! self.binsdesc = binsinfo['desc']
! self.binsexif = binsinfo['exif']
! except:
! pass
# set name
if name:
self.name = name
! elif self.binsdesc.has_key('title'):
! self.name = self.binsdesc['title']
! else:
self.name = util.getname(filename)
self.image_viewer = viewer.get_singleton()
! self.exiftags = None
!
def copy(self, obj):
"""
! Special copy value ImageItem
"""
Item.copy(self, obj)
if obj.type == 'image':
self.duration = obj.duration
! self.binsdesc = obj.binsdesc
! self.exiftags = obj.exiftags
-
def sort(self, mode=None):
"""
--- 47,87 ----
import viewer
! import mmpython
from item import Item
class ImageItem(Item):
def __init__(self, filename, parent, name = None, duration = 0):
! if parent and parent.media:
! url = 'cd://%s:%s:%s' % (parent.media.devicename, parent.media.mountdir,
! filename[len(parent.media.mountdir)+1:])
! else:
! url = filename
!
! Item.__init__(self, parent, mmpython.parse(url))
self.type = 'image'
self.filename = filename
self.image = filename
self.duration = duration
!
# set name
if name:
self.name = name
! elif not self.name:
self.name = util.getname(filename)
self.image_viewer = viewer.get_singleton()
!
def copy(self, obj):
"""
! Special copy value VideoItems
"""
Item.copy(self, obj)
if obj.type == 'image':
self.duration = obj.duration
!
def sort(self, mode=None):
"""
***************
*** 143,173 ****
- def getattr(self, attr):
- """
- return the specific attribute as string or an empty string
- """
- if self.exiftags == None:
- f = open(self.filename, 'r')
- self.exiftags = exif.process_file(f)
- f.close()
-
- if attr in tags_check:
- b = ''
- e = ''
- if self.binsexif.has_key(tags_check[attr][1]):
- b = str(self.binsexif[tags_check[attr][1]])
- if self.exiftags.has_key(tags_check[attr][0]):
- e = str(self.exiftags[tags_check[attr][0]])
-
- if tags_check[attr][2] == 'EXIF':
- if e:
- return e
- return b
- if b:
- return b
- return e
-
- if attr in self.binsdesc:
- return str(self.binsdesc[attr])
-
- return Item.getattr(self, attr)
--- 124,125 ----
Index: viewer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/image/viewer.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** viewer.py 28 May 2003 15:03:15 -0000 1.24
--- viewer.py 2 Jul 2003 20:10:28 -0000 1.25
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.25 2003/07/02 20:10:28 dischi
+ # added to mmpython support, removed old stuff
+ #
# Revision 1.24 2003/05/28 15:03:15 dischi
# small bugfixes
***************
*** 19,26 ****
# handle image loading failures
#
- # Revision 1.21 2003/04/24 19:56:34 dischi
- # comment cleanup for 1.3.2-pre4
- #
- #
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
--- 22,25 ----
***************
*** 54,65 ****
import config # Configuration file.
import osd # The OSD class, used to communicate with the OSD daemon
- import rc
import event as em
! import exif
from gui.GUIObject import GUIObject
from gui.AlertBox import AlertBox
-
DEBUG = config.DEBUG
--- 53,63 ----
import config # Configuration file.
import osd # The OSD class, used to communicate with the OSD daemon
import event as em
! import objectcache
! import rc
from gui.GUIObject import GUIObject
from gui.AlertBox import AlertBox
DEBUG = config.DEBUG
***************
*** 69,73 ****
osd = osd.get_singleton() # Create the OSD object
- rc_app_bkp = None
--- 67,70 ----
***************
*** 100,107 ****
self.alertbox = None # AlertBox active
self.app_mode = 'image'
!
def view(self, item, zoom=0, rotation=0):
- global rc_app_bkp
filename = item.filename
--- 97,104 ----
self.alertbox = None # AlertBox active
self.app_mode = 'image'
! self.bitmapcache = objectcache.ObjectCache(3, desc='viewer')
!
def view(self, item, zoom=0, rotation=0):
filename = item.filename
***************
*** 111,130 ****
self.filename = filename
self.rotation = rotation
- if not rotation and 'Orientation' in item.binsexif:
- i_orientation = item.binsexif['Orientation']
- if i_orientation == 'right_top':
- self.rotation=-90.0
- elif i_orientation == 'right_bottom':
- self.rotation=-180.0
- elif i_orientation == 'left_top':
- self.rotation=0
- elif i_orientation == 'left_bottom':
- self.rotation=-270.0
if filename and len(filename) > 0:
! image = osd.loadbitmap(filename)
else:
# Using Container-Image
! image = item.loadimage( )
rc.app(self)
--- 108,117 ----
self.filename = filename
self.rotation = rotation
if filename and len(filename) > 0:
! image = osd.loadbitmap(filename, cache=self.bitmapcache)
else:
# Using Container-Image
! image = item.loadimage()
rc.app(self)
***************
*** 133,137 ****
osd.clearscreen(color=osd.COL_BLACK)
osd.update()
! self.alertbox = AlertBox(parent=self, text="Can't Open Image\n'%s'" %
(filename))
self.alertbox.show()
return
--- 120,125 ----
osd.clearscreen(color=osd.COL_BLACK)
osd.update()
! self.alertbox = AlertBox(parent=self,
! text="Can't Open Image\n'%s'" % (filename))
self.alertbox.show()
return
***************
*** 245,249 ****
def cache(self, fileitem):
# cache the next image (most likely we need this)
! osd.bitmapsize(fileitem.filename)
--- 233,237 ----
def cache(self, fileitem):
# cache the next image (most likely we need this)
! osd.loadbitmap(fileitem.filename, cache=self.bitmapcache)
***************
*** 270,274 ****
elif event == em.STOP:
! rc.app(rc_app_bkp)
signal.alarm(0)
self.fileitem.eventhandler(event)
--- 258,262 ----
elif event == em.STOP:
! rc.app(None)
signal.alarm(0)
self.fileitem.eventhandler(event)
***************
*** 287,291 ****
osd.clearscreen(color=osd.COL_BLACK)
! if event.arg == 'right':
self.rotation = (self.rotation + 270) % 360
else:
--- 275,279 ----
osd.clearscreen(color=osd.COL_BLACK)
! if event.arg == 'left':
self.rotation = (self.rotation + 270) % 360
else:
***************
*** 362,378 ****
# This is where we add a caption. Only if playlist is empty
# May need to check the caption too?
! if not self.fileitem.binsdesc.has_key('title'):
! osdstring = ["Title: " + self.fileitem.name]
! else:
! osdstring = []
# Here we set up the tags that we want to put in the display
# Using the following fields
! # 0 - Title - Goes befor the field
! # 1 - ExifTag - Field to look for in Exif strings
! # 2 - BinsTag - Field to look for in Bins Strings
! # 3 - Priority - BINS or EXIF which should we use.
! tags_check = [['Title: ','NOTAG','title','BINS'],
! ['Description: ','NOTAG','description','BINS']
! ]
--- 350,360 ----
# This is where we add a caption. Only if playlist is empty
# May need to check the caption too?
! osdstring = ["Title: " + self.fileitem.name]
!
# Here we set up the tags that we want to put in the display
# Using the following fields
! tags_check = [['Title: ','name'],
! ['Description: ','description']
! ]
***************
*** 382,441 ****
# create an array with Exif tags as above
osdstring = []
! tags_check = [ ['Date:','Image DateTime','DateTime','EXIF'],
! ['W:','EXIF ExifImageWidth','ExifImageWidth','EXIF'],
! ['H:','EXIF ExifImageLength','ExifImageLength','EXIF'],
! ['Exp:','EXIF ExposureTime','ExposureTime','EXIF'],
! ['F/','EXIF FNumber','FNumber','EXIF'],
! ['FL:','EXIF FocalLength','FocalLength','EXIF'],
! ['ISO:','EXIF ISOSpeedRatings','ISOSpeedRatings','EXIF'],
! ['Meter:','EXIF MeteringMode','MeteringMode','EXIF'],
! ['Light:','EXIF LightSource','LightSource','EXIF'],
! ['Flash:','EXIF Flash','Flash','EXIF'],
! ['Make:','Image Make','Make','EXIF'],
! ['Model:','Image Model','Model','EXIF'],
! ['Software:','Image Software','Software','EXIF']
]
!
! # Grab the exif tags from the image we alread have them from
! # the bins file XXX Should this be done in the image item stage?
! f = open(self.filename, 'r')
! tags = exif.process_file(f)
! f.close()
for strtag in tags_check:
! exifname = strtag[1]
! binsname = strtag[2]
! exiftitle = strtag[0]
! priority = strtag[3]
! exifstr = ''
! binsstr = ''
!
! # grab the Exif tag if it exists
! if tags.has_key(exifname):
! exifstr = '%s %s' % (exiftitle,tags[exifname])
! # Grab the bins exif tag if it exists
! if self.fileitem.binsexif.has_key(binsname):
! binsstr = '%s %s' % (exiftitle,
! self.fileitem.binsexif[binsname])
! # Grab the bins desc if it exists and overwrite
! # the bins exif version
! if self.fileitem.binsdesc.has_key(binsname):
! binsstr = '%s %s' % (exiftitle,
! self.fileitem.binsdesc[binsname])
!
! if priority == 'BINS':
! if binsstr != '':
! osdstring.append(binsstr)
! elif exifstr != '':
! osdstring.append(exifstr)
! if priority == 'EXIF':
! if exifstr != '':
! osdstring.append(exifstr)
! elif binsstr != '':
! osdstring.append(binsstr)
!
!
!
# If after all that there is nothing then tell the users that
--- 364,389 ----
# create an array with Exif tags as above
osdstring = []
! tags_check = [ ['Date:','date'],
! ['W:','width'],
! ['H:','height'],
! ['Model:','hardware'],
! ['Software:', 'software']
]
! # FIXME: add this informations to mmpython:
!
! # ['Exp:','EXIF ExposureTime','ExposureTime','EXIF'],
! # ['F/','EXIF FNumber','FNumber','EXIF'],
! # ['FL:','EXIF FocalLength','FocalLength','EXIF'],
! # ['ISO:','EXIF ISOSpeedRatings','ISOSpeedRatings','EXIF'],
! # ['Meter:','EXIF MeteringMode','MeteringMode','EXIF'],
! # ['Light:','EXIF LightSource','LightSource','EXIF'],
! # ['Flash:','EXIF Flash','Flash','EXIF'],
! # ['Make:','Image Make','Make','EXIF'],
for strtag in tags_check:
! i = self.fileitem.getattr(strtag[1])
! if i:
! osdstring.append('%s %s' % (strtag[0], i))
# If after all that there is nothing then tell the users that
***************
*** 478,482 ****
for line in range(len(prt_line)):
h=osd.height - (40 + config.OVERSCAN_Y + ((len(prt_line) - line - 1) *
30))
! osd.drawstring(prt_line[line], 15 + config.OVERSCAN_X, h,
fgcolor=osd.COL_ORANGE)
--- 426,431 ----
for line in range(len(prt_line)):
h=osd.height - (40 + config.OVERSCAN_Y + ((len(prt_line) - line - 1) *
30))
! osd.drawstring(prt_line[line], 15 + config.OVERSCAN_X, h,
! fgcolor=osd.COL_ORANGE)
--- bins.py DELETED ---
--- exif.py DELETED ---
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog