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

Modified Files:
        blue1_big.xml skin_dischi1.py xml_skin.py 
Added Files:
        area.py listing.py 
Log Message:
New version of the new skin. It still looks the same (except that icons
are working now), but the internal structure has changed. Now it will
be easier to do the next steps.


--- NEW FILE: area.py ---
#if 0
# -----------------------------------------------------------------------
# area.py - An area for the Freevo skin
# -----------------------------------------------------------------------
# $Id: area.py,v 1.1 2003/02/25 22:56:00 dischi Exp $
#
# Notes: WIP
# Todo:        
#
# -----------------------------------------------------------------------
# $Log: area.py,v $
# Revision 1.1  2003/02/25 22:56:00  dischi
# New version of the new skin. It still looks the same (except that icons
# are working now), but the internal structure has changed. Now it will
# be easier to do the next steps.
#
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al. 
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
#endif


import copy

import osd
import xml_skin


# Create the OSD object
osd = osd.get_singleton()

# Set to 1 for debug output
DEBUG = 1

TRUE = 1
FALSE = 0


class Skin_Area:
    def __init__(self, name):
        self.area_name = name
        self.alpha     = None           # alpha layer for rectangles
        self.screen    = None           # backup of the final screen
        self.area_val  = None
        self.redraw    = TRUE
        self.depends   = ()
        self.bg        = [ None, None ]
        self.layout    = None
        
    def draw(self, settings, menuw):
        menu = menuw.menustack[-1]

        self.redraw = FALSE
        for d in self.depends:
            self.redraw = d.redraw or self.redraw
        
        dep_redraw = self.redraw
        self.redraw = self.init_vars(settings, menu.item_types)

        # we need to redraw the area we want to draw in
        if not dep_redraw and self.redraw and self.bg[0]:
            osd.screen.blit(self.bg[0][0], self.bg[0][1:])
        self.draw_background()

        # dependencies haven't changed
        if not self.redraw:
            # no update needed: return
            if not self.update_content_needed(settings, menuw):
                return

            # restore the background
            osd.screen.blit(self.bg[1], (self.area_val.x, self.area_val.y))

        self.update_content(settings, menuw)
        

    def calc_geometry(self, object, copy_object=0, fit_area=1):
        if copy_object:
            object = copy.deepcopy(object)
            
        try:
            if object.width[:3] == 'max':
                object.width = self.area_val.width + int(object.width[3:])
        except TypeError:
            pass
        
        try:
            if object.height[:3] == 'max':
                object.height = self.area_val.height + int(object.height[3:])
        except TypeError:
            pass

        if fit_area:
            object.x += self.area_val.x
            object.y += self.area_val.y

        if not object.width:
            object.width = self.area_val.width

        if not object.height:
            object.height = self.area_val.height

        return object

        
    def init_vars(self, settings, display_type):
        redraw = self.redraw
        
        if settings.menu.has_key(display_type):
            area_val = settings.menu[display_type][0]
        else:
            area_val = settings.menu['default'][0]

        area_val = eval('area_val.%s' % self.area_name)
        
        if (not self.area_val) or area_val != self.area_val:
            self.area_val = area_val
            redraw = TRUE
            
        if not settings.layout.has_key(area_val.layout):
            print '*** layout <%s> not found' % area_val.layout
            return FALSE

        old_layout = self.layout
        self.layout = settings.layout[area_val.layout]

        if old_layout and old_layout != self.layout:
            redraw = TRUE

        return redraw
        


    def draw_background(self):
        if not self.redraw:
            return

        area = self.area_val

        self.bg = [ [ None, area.x, area.y ], None ]
        self.bg[0][0] = osd.createlayer(area.width, area.height)
        self.bg[0][0].blit(osd.screen, (0,0), (area.x, area.y,
                                               area.x + area.width,
                                               area.y + area.height))

        self.alpha = None
        for bg in copy.deepcopy(self.layout.background):
            if isinstance(bg, xml_skin.XML_image):
                self.calc_geometry(bg)
                image = osd.loadbitmap(bg.filename)
                osd.screen.blit(image, (bg.x, bg.y))
            elif isinstance(bg, xml_skin.XML_rectangle):
                self.calc_geometry(bg, fit_area=FALSE)
                if not self.alpha:
                    self.alpha = osd.createlayer(area.width, area.height)
                    # clear surface
                    self.alpha.fill((0,0,0,0))
                osd.drawroundbox(bg.x, bg.y, bg.x+bg.width, bg.y+bg.height, bg.bgcolor,
                                 bg.size, bg.color, bg.radius, layer=self.alpha)

        if self.alpha:
            osd.screen.blit(self.alpha, (area.x, area.y))

        if hasattr(self, 'bg'):
            self.bg[1] = osd.createlayer(area.width, area.height)
            self.bg[1].blit(osd.screen, (0,0), (area.x, area.y,
                                                area.x + area.width,
                                                area.y + area.height))



    def drawroundbox(self, x, y, width, height, rect):
        area = self.area_val
        if self.alpha:
            osd.screen.blit(self.bg[0][0], (x, y), (x-area.x, y-area.y, width, height))
            a = osd.createlayer(width, height)
            a.blit(self.alpha, (0,0), (x - area.x, y - area.y, width, height))

            osd.drawroundbox(0, 0, width, height,
                             color = rect.bgcolor, border_size=rect.size,
                             border_color=rect.color, radius=rect.radius, layer=a)
            osd.screen.blit(a, (x, y))
        else:
            osd.drawroundbox(x, y, x+width, y+height,
                             color = rect.bgcolor, border_size=rect.size,
                             border_color=rect.color, radius=rect.radius)

        
    # Draws a text inside a frame based on the settings in the XML file
    def write_text(self, text, font, area, x=-1, y=-1, width=None, height=None,
                   mode='hard', ellipses='...'):
    
        if x == -1: x = area.x
        if y == -1: y = area.y

        if width == None:
            width  = area.width
        if height == None:
            height = area.height

        if font.shadow.visible:
            osd.drawstringframed(text, x+font.shadow.x, y+font.shadow.y,
                                 width, height, font.shadow.color, None,
                                 font=font.name, ptsize=font.size,
                                 mode=mode, ellipses=ellipses)
        osd.drawstringframed(text, x, y, width, height, font.color, None,
                             font=font.name, ptsize=font.size,
                             mode=mode, ellipses=ellipses)



    

--- NEW FILE: listing.py ---
#if 0
# -----------------------------------------------------------------------
# listing.py - A listing area for the Freevo skin
# -----------------------------------------------------------------------
# $Id: listing.py,v 1.1 2003/02/25 22:56:00 dischi Exp $
#
# Notes: WIP
# Todo:        
#
# -----------------------------------------------------------------------
# $Log: listing.py,v $
# Revision 1.1  2003/02/25 22:56:00  dischi
# New version of the new skin. It still looks the same (except that icons
# are working now), but the internal structure has changed. Now it will
# be easier to do the next steps.
#
#
# -----------------------------------------------------------------------
# Freevo - A Home Theater PC framework
# Copyright (C) 2002 Krister Lagerstrom, et al. 
# Please see the file freevo/Docs/CREDITS for a complete list of authors.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MER-
# CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# -----------------------------------------------------------------------
#endif


import copy

import osd
import util

from area import Skin_Area

# Create the OSD object
osd = osd.get_singleton()

# Set to 1 for debug output
DEBUG = 1

TRUE = 1
FALSE = 0


class Skin_Listing(Skin_Area):
    def __init__(self, parent):
        Skin_Area.__init__(self, 'listing')
        self.last_choices = ( None, None )
        self.depends = ( parent.screen_area, )

    def get_item_rectangle(self, rectangle, item_w, item_h):
        r = copy.copy(rectangle)
        
        if not r.width:
            r.width = item_w
        else:
            try:
                if r.width[:3] == 'max':
                    r.width = item_w + int(r.width[3:])
            except TypeError:
                pass
            
        if not r.height:
            r.height = item_h
        else:
            try:
                if r.height[:3] == 'max':
                    r.height = item_h + int(r.height[3:])
            except TypeError:
                pass
            

        if r.x < 0:
            item_w -= r.x

        if r.y < 0:
            item_h -= r.y

        return max(item_w, r.width), max(item_h, r.height), r
    

    def get_items_geometry(self, settings, menu):
        # store the old values in case we are called by ItemsPerMenuPage
        backup = ( self.area_val, self.layout)
        
        self.init_vars(settings, menu.item_types)

        layout    = self.layout
        area      = self.area_val
        content   = self.calc_geometry(layout.content, copy_object=TRUE)

        hspace = area.width
        vspace = area.height

        items_w = area.width
        items_h = 0

        possible_types = {}

        hskip = 0
        vskip = 0
        for i in menu.choices:
            if hasattr(i, 'display_type') and i.display_type and \
               content.types.has_key(i.display_type):
                possible_types[i.display_type] = content.types[i.display_type]
            else:
                possible_types['default'] = content.types['default']

            if hasattr(i, 'display_type') and i.display_type and \
               content.types.has_key('%s selected' % i.display_type):
                possible_types['%s selected' % i.display_type] = \
                                   content.types['%s selected' % i.display_type]
            else:
                possible_types['selected'] = content.types['selected']
                
        # get the max height of a text item
        for t in possible_types:
            ct = possible_types[t]

            if not settings.font.has_key(ct.font):
                print '*** font <%s> not found' % ct.font
                break

            font = settings.font[ct.font]
            font_w, font_h = osd.stringsize('Arj', font=font.name, ptsize=font.size)

            rh = 0
            rw = 0
            if ct.rectangle:
                rw, rh, r = self.get_item_rectangle(ct.rectangle, font_w, font_h)
                hskip = min(hskip, r.x)
                vskip = min(vskip, r.y)
                
            items_h = max(items_h, font_h, rh)
            items_w = max(items_w, font_w, rw)

        # restore
        self.area_val, self.layout = backup

        # return cols, rows, item_w, item_h
        return (content.width/items_w, content.height/items_h,
                items_w, items_h, -hskip, -vskip)


    def update_content_needed(self, settings, menuw):
        menu = menuw.menustack[-1]
        if self.last_choices[0] != menu.selected:
            return TRUE

        i = 0
        for choice in menuw.menu_items:
            if self.last_choices[1][i] != choice:
                return TRUE
            i += 1
                
    def update_content(self, settings, menuw):
        menu = menuw.menustack[-1]

        layout    = self.layout
        area      = self.area_val
        content   = self.calc_geometry(layout.content, copy_object=TRUE)

        cols, rows, hspace, vspace, hskip, vskip = \
              self.get_items_geometry(settings, menu)

        x0 = area.x + content.spacing
        y0 = area.y + content.spacing

        width  = content.width - 2 * content.spacing

        for choice in menuw.menu_items:
            if choice == menu.selected:
                if content.types.has_key('% selected' % choice.type):
                    val = content.types['% selected' % choice.type]
                else:
                    val = content.types['selected']
            else:
                if content.types.has_key(choice.type):
                    val = content.types[choice.type]
                else:
                    val = content.types['default']
                
            if not settings.font.has_key(val.font):
                print '*** font <%s> not found' % val.font
                break

            font = settings.font[val.font]


            text = choice.name
            if not text:
                text = "unknown"

            if choice.type == 'playlist':
                text = 'PL: %s' % text

            if content.type == 'text':
                font_w, font_h = osd.stringsize('Arj', font=font.name, 
ptsize=font.size)
                if choice.icon:
                    osd.drawbitmap(util.resize(choice.icon, font_h, font_h), x0, y0)
                    icon_x = font_h + content.spacing
                else:
                    icon_x = 0

                if val.rectangle:
                    None, None, r = self.get_item_rectangle(val.rectangle, width, 
font_h)
                    if hskip + r.x + r.width > width:
                        r.width = width - hskip - r.y
                    self.drawroundbox(x0 + hskip + r.x + icon_x, y0 + vskip + r.y,
                                      r.width - icon_x, r.height, r)
                                  
                    
                self.write_text(text, font, area, x=x0 + hskip + icon_x, y=y0 + vskip,
                                width=width-icon_x, height=-1, mode='hard')

            else:
                print 'no support for content type %s' % content.type

            y0 += vspace

        self.last_choices = (menu.selected, copy.copy(menuw.menu_items))


        

Index: blue1_big.xml
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/blue1_big.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** blue1_big.xml       23 Feb 2003 18:42:20 -0000      1.1
--- blue1_big.xml       25 Feb 2003 22:56:00 -0000      1.2
***************
*** 45,49 ****
        <view layout="view0" visible="no"/>
        <listing layout="list_main" visible="yes">
!       <area x="230" y="120" width="320" height="390"/> 
        </listing>
      </menu>
--- 45,49 ----
        <view layout="view0" visible="no"/>
        <listing layout="list_main" visible="yes">
!       <area x="230" y="120" width="380" height="390"/> 
        </listing>
      </menu>
***************
*** 65,71 ****
      <!-- default listing area -->
      <layout label="list0">
!       <content font="font_list" type="text" spacing="10">
!       <selection visible="yes" font="font_list_selected" bgcolor="0xa0000000"
!         size="0" spacing="5"/>
        </content>
      </layout>
--- 65,74 ----
      <!-- default listing area -->
      <layout label="list0">
!       <content type="text" spacing="10">
!       <item type="default" font="font_list"/>
!       <item type="selected" font="font_list_selected">
!         <rectangle bgcolor="0xa0000000" size="0" x="-5" y="-3" width="max+10"
!           height="max+6"/>
!       </item>
        </content>
      </layout>
***************
*** 73,79 ****
      <!-- main menu listing area -->
      <layout label="list_main">
!       <content font="font_main" type="text" spacing="10">
!       <selection visible="yes" font="font_main_selected" bgcolor="0xa0000000"
!         size="0" spacing="5"/>
        </content>
      </layout>
--- 76,85 ----
      <!-- main menu listing area -->
      <layout label="list_main">
!       <content type="text" spacing="20">
!       <item type="default" font="font_main"/>
!       <item type="selected" font="font_main_selected">
!         <rectangle bgcolor="0xa0000000" size="0" y="-5" x="-10"
!           width="max+20" height="max+10"/>
!       </item>
        </content>
      </layout>

Index: skin_dischi1.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/skin_dischi1.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** skin_dischi1.py     23 Feb 2003 18:42:20 -0000      1.18
--- skin_dischi1.py     25 Feb 2003 22:56:00 -0000      1.19
***************
*** 10,13 ****
--- 10,18 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.19  2003/02/25 22:56:00  dischi
+ # New version of the new skin. It still looks the same (except that icons
+ # are working now), but the internal structure has changed. Now it will
+ # be easier to do the next steps.
+ #
  # Revision 1.18  2003/02/23 18:42:20  dischi
  # Current status of my skin redesign. Currently only the background and
***************
*** 78,85 ****
  
  
- PADDING=5   # Padding/spacing between items
- 
- ###############################################################################
- 
  # Set up the mixer
  mixer = mixer.get_singleton()
--- 83,86 ----
***************
*** 88,351 ****
  rc = rc.get_singleton()
  
- ###############################################################################
- 
- 
- 
- # Draws a text inside a frame based on the settings in the XML file
- def write_text(text, font, area, x=-1, y=-1, width=None, height=None,
-                mode='hard', ellipses='...'):
-     
-     if x == -1: x = area.x
-     if y == -1: y = area.y
- 
-     if width == None:
-         width  = area.width
-     if height == None:
-         height = area.height
- 
-     if font.shadow.visible:
-         osd.drawstringframed(text, x+font.shadow.x, y+font.shadow.y,
-                              width, height, font.shadow.color, None,
-                              font=font.name, ptsize=font.size,
-                              mode=mode, ellipses=ellipses)
-     osd.drawstringframed(text, x, y, width, height, font.color, None,
-                          font=font.name, ptsize=font.size,
-                          mode=mode, ellipses=ellipses)
- 
- 
- 
- 
- ###############################################################################
- 
- class Skin_Area:
-     def __init__(self, name):
-         self.area_name = name
-         self.alpha     = None           # alpha layer for rectangles
-         self.screen    = None           # backup of the final screen
-         self.area_val  = None
-         self.redraw    = TRUE
- 
-     def calc_geometry(self, object, copy_object=0, fit_area=1):
-         if copy_object:
-             object = copy.deepcopy(object)
-             
-         try:
-             if object.width[:3] == 'max':
-                 object.width = self.area_val.width + int(object.width[3:])
-         except TypeError:
-             pass
-         
-         try:
-             if object.height[:3] == 'max':
-                 object.height = self.area_val.height + int(object.height[3:])
-         except TypeError:
-             pass
- 
-         if fit_area:
-             object.x += self.area_val.x
-             object.y += self.area_val.y
- 
-         if not object.width:
-             object.width = self.area_val.width
- 
-         if not object.height:
-             object.height = self.area_val.height
- 
-         return object
- 
-         
-     def init_vars(self, settings, display_type):
-         dep_redraw = self.redraw
-         
-         if settings.menu.has_key(display_type):
-             area_val = settings.menu[display_type][0]
-         else:
-             area_val = settings.menu['default'][0]
- 
-         area_val = eval('area_val.%s' % self.area_name)
-         
-         if (not self.area_val) or area_val != self.area_val:
-             self.area_val = area_val
-             self.redraw = TRUE
-             
-         if not settings.layout.has_key(area_val.layout):
-             print '*** layout <%s> not found' % area_val.layout
-             return 0
- 
-         if not self.redraw:
-             return
-         
-         self.layout = settings.layout[area_val.layout]
- 
-         # we need to redraw the area we want to draw in
-         if not dep_redraw and self.redraw and hasattr(self, 'bg'):
-             osd.screen.blit(self.bg[0][0], self.bg[0][1:])
  
  
-     def draw_background(self):
-         if not self.redraw:
-             return
- 
-         area = self.area_val
  
!         if hasattr(self, 'bg') and hasattr(self, 'depends'):
!             self.bg = [ [ None, area.x, area.y ], None ]
!             self.bg[0][0] = osd.createlayer(area.width, area.height)
!             self.bg[0][0].blit(osd.screen, (0,0), (area.x, area.y,
!                                                    area.x + area.width,
!                                                    area.y + area.height))
!                 
!         self.alpha = None
!         for bg in copy.deepcopy(self.layout.background):
!             if isinstance(bg, xml_skin.XML_image):
!                 self.calc_geometry(bg)
!                 image = osd.loadbitmap(bg.filename)
!                 osd.screen.blit(image, (bg.x, bg.y))
!             elif isinstance(bg, xml_skin.XML_rectangle):
!                 self.calc_geometry(bg, fit_area=FALSE)
!                 if not self.alpha:
!                     self.alpha = osd.createlayer(area.width, area.height)
!                     # clear surface
!                     self.alpha.fill((0,0,0,0))
!                 osd.drawroundbox(bg.x, bg.y, bg.x+bg.width, bg.y+bg.height, 
bg.bgcolor,
!                                  bg.size, bg.color, bg.radius, layer=self.alpha)
! 
!         if self.alpha:
!             osd.screen.blit(self.alpha, (area.x, area.y))
! 
!         if hasattr(self, 'bg'):
!             self.bg[1] = osd.createlayer(area.width, area.height)
!             self.bg[1].blit(osd.screen, (0,0), (area.x, area.y,
!                                                 area.x + area.width,
!                                                 area.y + area.height))
! 
! 
! 
!     def drawroundbox(self, x, y, width, height, rect):
!         area = self.area_val
!         if self.alpha:
!             osd.screen.blit(self.bg[0][0], (x, y), (x-area.x, y-area.y, width, 
height))
!             a = osd.createlayer(width, height)
!             a.blit(self.alpha, (0,0), (x - area.x, y - area.y, width, height))
  
!             osd.drawroundbox(0, 0, width, height,
!                              color = rect.bgcolor, border_size=rect.size,
!                              border_color=rect.color, radius=rect.radius, layer=a)
!             osd.screen.blit(a, (x, y))
!         else:
!             osd.drawroundbox(x, y, x+width, y+height,
!                              color = rect.bgcolor, border_size=rect.size,
!                              border_color=rect.color, radius=rect.radius)
  
-         
-     
- ###############################################################################
-         
  class Skin_Screen(Skin_Area):
      def __init__(self, parent):
          Skin_Area.__init__(self, 'screen')
  
!     def __call__(self, settings, menuw):
!         menu = menuw.menustack[-1]
! 
!         self.redraw = FALSE
!         self.init_vars(settings, menu.item_types)
!         self.draw_background()
! 
! ###############################################################################
! 
! 
! class Skin_Listing(Skin_Area):
!     def __init__(self, parent):
!         Skin_Area.__init__(self, 'listing')
!         self.bg = [ None, None ]
!         self.last_choices = ( None, None )
!         self.depends = ( parent.screen_area, )
!         
!     def __call__(self, settings, menuw):
!         menu = menuw.menustack[-1]
! 
!         self.redraw = FALSE
!         for d in self.depends:
!             self.redraw = d.redraw or self.redraw
! 
!         self.init_vars(settings, menu.item_types)
! 
!         layout    = self.layout
!         area      = self.area_val
!         content   = self.calc_geometry(layout.content, copy_object=TRUE)
!         selection = content.selection
! 
!         self.draw_background()
!         menu_redraw = self.redraw
!         
!         if not settings.font.has_key(content.font):
!             print '*** font <%s> not found' % content.font
!             return 0
! 
!         font1 = settings.font[content.font]
! 
!         if not settings.font.has_key(selection.font):
!             print '*** font <%s> not found' % selection.font
!             font2 = font1
!         else:
!             font2 = settings.font[selection.font]
! 
!         if not self.redraw:
!             self.redraw = self.last_choices[0] != menu.selected
!             
!         if not self.redraw:
!             i = 0
!             for choice in menuw.menu_items:
!                 if self.last_choices[1][i] != choice:
!                     self.redraw = TRUE
!                     break
!                 i += 1
!                 
!         if not self.redraw:
!             return
! 
!         if not menu_redraw:
!             osd.screen.blit(self.bg[1], (area.x, area.y))
! 
!         x0 = content.x + selection.spacing
!         y0 = content.y + selection.spacing
! 
!         width  = content.width - 2* selection.spacing
! 
!         for choice in menuw.menu_items:
!             font = font1
!             if choice == menu.selected:
!                 font = font2
! 
! 
!             text = choice.name
!             if not text:
!                 print "no text to display ... strange. Use default"
!                 text = "unknown"
! 
!             if choice.type == 'playlist':
!                 text = 'PL: %s' % text
  
!             font_w, font_h = osd.stringsize(text, font=font.name, ptsize=font.size)
!             spacing = font_h + content.spacing     
!         
!             if choice == menu.selected and selection.visible:
!                 self.drawroundbox(x0 - selection.spacing,
!                                   y0 - selection.spacing,
!                                   2*selection.spacing + width,
!                                   2*selection.spacing + font_h,
!                                   selection)
!                                   
!                     
!             write_text(text, font, area, x=x0, y=y0, width=width,
!                        height=-1, mode='hard')
  
-             y0 += spacing
  
!         self.last_choices = (menu.selected, copy.copy(menuw.menu_items))
  
  
-         
  ###############################################################################
  # Skin main functions
--- 89,121 ----
  rc = rc.get_singleton()
  
  
  
  
! #
! # We have five areas, all inherit from Skin_Area (file area.py)
! #
! # Skin_Screen   (this file)
! # Skin_Title    (not implemented yet)
! # Skin_Listing  (listing.py)
! # Skin_View     (not implemented yet)
! # Skin_Info     (not implemented yet)
  
! from area import Skin_Area
! from listing import Skin_Listing
  
  class Skin_Screen(Skin_Area):
      def __init__(self, parent):
          Skin_Area.__init__(self, 'screen')
  
!     def update_content_needed(self, settings, menuw):
!         return FALSE
  
!     def update_content(self, settings, menuw):
!         pass
  
  
! ###############################################################################
  
  
  ###############################################################################
  # Skin main functions
***************
*** 419,427 ****
              return (0,0)
  
          # hack for the main menu to fit all in one screen
          if not menu.packrows:
!             return (5,1)
!         
!         return (5, 1)
          
  
--- 189,203 ----
              return (0,0)
  
+         if menu.skin_settings:
+             settings = menu.skin_settings
+         else:
+             settings = self.settings
+ 
          # hack for the main menu to fit all in one screen
          if not menu.packrows:
!             menu.item_types = 'main'
! 
!         rows, cols = self.listing_area.get_items_geometry(settings, menu)[:2]
!         return (cols, rows)
          
  
***************
*** 471,475 ****
          for a in self.area_names:
              area = eval('self.%s_area' % a)
!             area(settings, menuw)
  
          osd.update()
--- 247,251 ----
          for a in self.area_names:
              area = eval('self.%s_area' % a)
!             area.draw(settings, menuw)
  
          osd.update()

Index: xml_skin.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/xml_skin.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** xml_skin.py 23 Feb 2003 18:42:20 -0000      1.9
--- xml_skin.py 25 Feb 2003 22:56:00 -0000      1.10
***************
*** 10,13 ****
--- 10,18 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.10  2003/02/25 22:56:00  dischi
+ # New version of the new skin. It still looks the same (except that icons
+ # are working now), but the internal structure has changed. Now it will
+ # be easier to do the next steps.
+ #
  # Revision 1.9  2003/02/23 18:42:20  dischi
  # Current status of my skin redesign. Currently only the background and
***************
*** 282,286 ****
  
      def __cmp__(self, other):
!         return XML_data.__cmp__(self, other) and self.area2 == other.area2
  
      
--- 287,291 ----
  
      def __cmp__(self, other):
!         return not (not XML_data.__cmp__(self, other) and self.area2 == other.area2)
  
      
***************
*** 315,331 ****
  class XML_content(XML_data):
      def __init__(self):
!         XML_data.__init__(self, ('type', 'font', 'spacing', 'x', 'y',
                                   'width', 'height'))
!         self.selection = XML_data(('visible', 'font', 'color', 'bgcolor',
!                                    'size', 'radius', 'spacing'))
! 
      def parse(self, node, scale, current_dir):
          XML_data.parse(self, node, scale, current_dir)
          for subnode in node.children:
!             if subnode.name == u'selection':
!                 self.selection.parse(subnode, scale, current_dir)
  
-     def __cmp__(self, other):
-         return XML_data.__cmp__(self, other) and self.selection == other.selection
  
          
--- 320,342 ----
  class XML_content(XML_data):
      def __init__(self):
!         XML_data.__init__(self, ('type', 'spacing', 'x', 'y',
                                   'width', 'height'))
!         self.types = {}
!         
      def parse(self, node, scale, current_dir):
          XML_data.parse(self, node, scale, current_dir)
          for subnode in node.children:
!             if subnode.name == u'item':
!                 type = attr_str(subnode, "type", '')
!                 if type and not self.types.has_key(type):
!                     self.types[type] = XML_data(('font',))
!                     self.types[type].rectangle = None
!                 if type:
!                     self.types[type].parse(subnode, scale, current_dir)
!                     for rnode in subnode.children:
!                         if rnode.name == u'rectangle':
!                             self.types[type].rectangle = XML_rectangle()
!                             self.types[type].rectangle.parse(rnode, scale, 
current_dir)
  
  
          
***************
*** 349,353 ****
  
      def __cmp__(self, other):
!         return self.background == other.background and self.content == other.content
  
  
--- 360,364 ----
  
      def __cmp__(self, other):
!         return not (self.background == other.background and self.content == 
other.content)
  
  
***************
*** 368,372 ****
  
      def __cmp__(self, other):
!         return XML_data.__cmp__(self, other) and self.shadow == other.shadow
  
      
--- 379,383 ----
  
      def __cmp__(self, other):
!         return not (not XML_data.__cmp__(self, other) and self.shadow == 
other.shadow)
  
      




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to