Update of /cvsroot/freevo/freevo/skins/dischi1
In directory sc8-pr-cvs1:/tmp/cvs-serv23691

Modified Files:
        blue1_big.xml info_area.py 
Log Message:
Added mp3 player view area. You can set the infos you want to see in the
skin. @VAR@ means insert a variable from the item object here, \t means
next col (currently only two cols are supported). I don't like the
delimiter @@ and \t, but I don't have a better idea (&var; doesn't work
because pyXML want's to replace it)


Index: blue1_big.xml
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/blue1_big.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** blue1_big.xml       5 Mar 2003 22:13:37 -0000       1.9
--- blue1_big.xml       6 Mar 2003 21:45:23 -0000       1.10
***************
*** 168,172 ****
        <rectangle size="0" bgcolor="0x80000000" radius="10" width="max"/>
        </background>
!       <content x="50" type="text" spacing="10"/>
      </layout>
  
--- 168,181 ----
        <rectangle size="0" bgcolor="0x80000000" radius="10" width="max"/>
        </background>
!       <content x="55" y="10" height="max-20" width="max-75" type="text"
!       spacing="10" font="white">
!       Title:   [EMAIL PROTECTED]@
!       Artist:  [EMAIL PROTECTED]@
!       Album:   [EMAIL PROTECTED]@ (@year@)
!       Track:   [EMAIL PROTECTED]@
! 
!       Length:  [EMAIL PROTECTED]@
!       Elapsed: [EMAIL PROTECTED]@
!       </content>
      </layout>
  

Index: info_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/info_area.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** info_area.py        5 Mar 2003 21:55:21 -0000       1.1
--- info_area.py        6 Mar 2003 21:45:24 -0000       1.2
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.2  2003/03/06 21:45:24  dischi
+ # Added mp3 player view area. You can set the infos you want to see in the
+ # skin. @VAR@ means insert a variable from the item object here, \t means
+ # next col (currently only two cols are supported). I don't like the
+ # delimiter @@ and \t, but I don't have a better idea (&var; doesn't work
+ # because pyXML want's to replace it)
+ #
  # Revision 1.1  2003/03/05 21:55:21  dischi
  # empty info area
***************
*** 39,42 ****
--- 46,51 ----
  from skin_utils import *
  
+ import re
+ 
  TRUE  = 1
  FALSE = 0
***************
*** 49,53 ****
--- 58,68 ----
      def __init__(self, parent, screen):
          Skin_Area.__init__(self, 'info', screen)
+         self.re_space    = re.compile('^\t *(.*)')
+         self.re_var      = re.compile('@[a-z_]*@')
+         self.re_table    = re.compile('^(.*)\\\\t(.*)')
  
+         self.last_item   = None
+         self.auto_update = []
+         self.table       = []
  
      def update_content_needed(self):
***************
*** 55,59 ****
          check if the content needs an update
          """
!         return FALSE
          
  
--- 70,74 ----
          check if the content needs an update
          """
!         return self.auto_update or (self.last_item != self.item)
          
  
***************
*** 62,65 ****
          update the info area
          """
!         pass
!     
--- 77,165 ----
          update the info area
          """
!         settings  = self.settings
!         layout    = self.layout
!         area      = self.area_val
!         content   = self.calc_geometry(layout.content, copy_object=TRUE)
!         item      = self.item
! 
!         if not settings.font.has_key(content.font):
!             print '*** font <%s> not found' % content.font
!             return
! 
!         font = settings.font[content.font]
! 
!         table = [ [], [] ]
!         self.auto_update = []
! 
!         for line in content.cdata.encode('Latin-1').split('\n'):
!             m = self.re_space.match(line)
!             if m:
!                 line = m.groups(1)[0]
! 
!             has_vars       = FALSE 
!             autoupdate     = ''
!             vars_exists    = FALSE
! 
!             for m in self.re_var.findall(line):
!                 has_vars = TRUE
!                 repl = ''
!                 if hasattr(item, m[1:-1]):
!                     if m[1:-1] == 'year':
!                         if not item.year:
!                             repl = ''
!                         else:
!                             repl = str(item.year)
!                     elif m[1:-1] == 'length':
!                         if not item.length:
!                             repl = ''
!                         else:
!                             repl = '%d:%02d' % (int(item.length / 60),
!                                                 int(item.length % 60))
!                     elif m[1:-1] == 'elapsed':
!                         autoupdate = 'elapsed'
!                         repl = '%d:%02d' % (int(item.elapsed / 60),
!                                             int(item.elapsed % 60))
!                     else:
!                         repl = str(eval('item.%s' % m[1:-1]))
! 
!                 if repl:
!                     line = re.sub(m, repl, line)
!                     vars_exists = TRUE
!                 else:
!                     line = re.sub(m, '', line)
! 
!             if ((not has_vars) or vars_exists) and (line or table[0]):
!                 m = self.re_table.match(line)
!                 if m:
!                     table[0] += [ m.groups(1)[0] ]
!                     table[1] += [ m.groups(2)[1] ]
!                     if autoupdate:
!                         self.auto_update += [ ( autoupdate, len(table[0]) - 1) ]
!                 else:
!                     table[0] += [ line ]
!                     table[1] += [ ' ' ]
! 
!         x0 = content.x
! 
!         y_spacing = osd.stringsize('Arj', font=font.name, ptsize=font.size)[1] * 1.1
!             
!         for col in table:
!             w = 0
!             txt = ''
! 
!             for row in col:
!                 w = max(w, osd.stringsize(row, font=font.name, ptsize=font.size)[0])
!                 if x0 + w > content.x + content.width:
!                     w = content.x + content.width - x0
! 
!             y0 = content.y
!             for row in col:
!                 if row:
!                     self.write_text(row, font, content, x=x0, y=y0, width= w + 10,
!                                     height=-1, mode='hard')
!                 y0 += y_spacing
!                 
!             x0 += w + content.spacing
! 
!         self.last_item = self.item
!         self.table = table




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to