Author: duncan
Date: Thu Dec 28 13:46:29 2006
New Revision: 8845

Modified:
   branches/rel-1/freevo/src/directory.py
   branches/rel-1/freevo/src/item.py
   branches/rel-1/freevo/src/menu.py
   branches/rel-1/freevo/src/util/mediainfo.py
   branches/rel-1/freevo/src/video/videoitem.py

Log:
Added __str__ and __repr__ functions

Modified: branches/rel-1/freevo/src/directory.py
==============================================================================
--- branches/rel-1/freevo/src/directory.py      (original)
+++ branches/rel-1/freevo/src/directory.py      Thu Dec 28 13:46:29 2006
@@ -174,6 +174,23 @@
             self.create_metainfo()
 
 
+    def __str__(self):
+        s = '\ndirectory:DirItem:s:'
+        s += ' name=%r' % self.name
+        s += ' dir=%r' % self.dir
+        s += ' info=%r' % self.info
+        #s += ' dir(self)=%r' % dir(self)
+        return s
+
+
+    def __repr__(self):
+        s = '\ndirectory:DirItem:r:'
+        s += ' name=%r' % self.name
+        s += ' dir=%r' % self.dir
+        s += ' info=%r' % self.info
+        #s += ' dir(self)=%r' % dir(self)
+        return s
+
 
     def set_fxd_file(self, file):
         """

Modified: branches/rel-1/freevo/src/item.py
==============================================================================
--- branches/rel-1/freevo/src/item.py   (original)
+++ branches/rel-1/freevo/src/item.py   Thu Dec 28 13:46:29 2006
@@ -174,6 +174,22 @@
                 self.image = util.getimage(os.path.join(imagedir, skin_type))
         
 
+    def __str__(self):
+        s = '\nitem:Item:s:'
+        s += ' name=%r' % self.name
+        s += ' info=%r' % self.info
+        s += ' dir(self)=%r' % dir(self)
+        return s
+
+
+    def __repr__(self):
+        s = '\nitem:Item:r:'
+        s += ' name=%r' % self.name
+        s += ' info=%r' % self.info
+        #s += ' dir(self)=%r' % dir(self)
+        return s
+
+
     def set_url(self, url, info=True, search_image=True):
         """
         Set a new url to the item and adjust all attributes depending

Modified: branches/rel-1/freevo/src/menu.py
==============================================================================
--- branches/rel-1/freevo/src/menu.py   (original)
+++ branches/rel-1/freevo/src/menu.py   Thu Dec 28 13:46:29 2006
@@ -67,13 +67,13 @@
         return the event as string
         """
         result = '"'+self.name+'"'
-        if hasattr(self, 'action'): result += ' action=%s' % self.action
-        if hasattr(self, 'arg'):    result += ' arg=%s' % self.arg[0]
-        if hasattr(self, 'type'):   result += ' type=%s' % self.type
-        if hasattr(self, 'image'):  result += ' image=%s' % self.image
-        if hasattr(self, 'icon'):   result += ' icon=%s' % self.icon
-        #if hasattr(self, 'parent'):  result += ' parent=%s' % self.parent
-        if hasattr(self, 'skin_type'):  result += ' skin_type=%s' % 
self.skin_type
+        if hasattr(self, 'action')     result += ' action=%s' % self.action
+        if hasattr(self, 'arg') and self.arg: result += ' arg=%s' % self.arg[0]
+        if hasattr(self, 'type'):      result += ' type=%s' % self.type
+        if hasattr(self, 'image'):     result += ' image=%s' % self.image
+        if hasattr(self, 'icon'):      result += ' icon=%s' % self.icon
+        if hasattr(self, 'skin_type'): result += ' skin_type=%s' % 
self.skin_type
+        #if hasattr(self, 'parent'):    result += ' parent=%s' % self.parent
         return result
 
 

Modified: branches/rel-1/freevo/src/util/mediainfo.py
==============================================================================
--- branches/rel-1/freevo/src/util/mediainfo.py (original)
+++ branches/rel-1/freevo/src/util/mediainfo.py Thu Dec 28 13:46:29 2006
@@ -414,7 +414,29 @@
             self.metadata  = {}
         self.dicts     = ( self.mmdata, self.variables, self.metadata )
 
-        
+
+    def __str__(self):
+        s = '\nutil:mediainfo:Info:s:'
+        s += ' filename=%r' % self.filename
+        s += ' disc=%r' % self.disc
+        s += ' variables=%r' % self.variables
+        s += ' mmdata=%r' % self.mmdata
+        s += ' metadata=%r' % self.metadata
+        s += ' dir(self)=%r' % dir(self)
+        return s
+
+
+    def __repr__(self):
+        s = '\nutil:mediainfo:Info:r:'
+        s += ' filename=%r' % self.filename
+        s += ' disc=%r' % self.disc
+        s += ' variables=%r' % self.variables
+        s += ' mmdata=%r' % self.mmdata
+        s += ' metadata=%r' % self.metadata
+        #s += ' dir(self)=%r' % dir(self)
+        return s
+
+
     def __getitem__(self, key):
         """
         get the value of 'key'
@@ -576,7 +598,6 @@
     """
     return mmpython disc information for the media
     """
-    print media.devicename
     type, id = mmpython.cdrom.status(media.devicename)
     if not id:
         # bad disc, e.g. blank disc

Modified: branches/rel-1/freevo/src/video/videoitem.py
==============================================================================
--- branches/rel-1/freevo/src/video/videoitem.py        (original)
+++ branches/rel-1/freevo/src/video/videoitem.py        Thu Dec 28 13:46:29 2006
@@ -48,6 +48,7 @@
 from event import *
 
 class VideoItem(Item):
+
     def __init__(self, url, parent, info=None, parse=True):
         self.autovars = [ ('deinterlace', 0) ]
         Item.__init__(self, parent)
@@ -122,6 +123,22 @@
                 self.mplayer_options = discset_informations[fid]
 
         
+    def __str__(self):
+        s = '\nvideo:videoitem:VideoItem:Info:s:'
+        s += ' name=%r' % self.name
+        s += ' filename=%r' % self.filename
+        s += ' dir(self)=%r' % dir(self)
+        return s
+
+
+    def __repr__(self):
+        s = '\nvideo:videoitem:VideoItem:Info:r:'
+        s += ' name=%r' % self.name
+        s += ' filename=%r' % self.filename
+        #s += ' dir(self)=%r' % dir(self)
+        return s
+
+
     def set_url(self, url, info=True):
         """
         Sets a new url to the item. Always use this function and not set 'url'

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to