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

Modified Files:
        area.py info_area.py listing_area.py skin_dischi1.py 
        tvlisting_area.py 
Log Message:
misc cleanups

Index: area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/area.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** area.py     11 Mar 2003 20:38:47 -0000      1.20
--- area.py     13 Mar 2003 21:02:03 -0000      1.21
***************
*** 28,31 ****
--- 28,34 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.21  2003/03/13 21:02:03  dischi
+ # misc cleanups
+ #
  # Revision 1.20  2003/03/11 20:38:47  dischi
  # some speed ups
***************
*** 145,148 ****
--- 148,160 ----
  
  
+ 
+ default_font = xml_skin.XML_font('none')
+ default_font.name = config.OSD_DEFAULT_FONTNAME
+ default_font.size = config.OSD_DEFAULT_FONTSIZE
+ default_font.h = config.OSD_DEFAULT_FONTSIZE
+ default_font.shadow.visible = 0
+ 
+ 
+ 
  class Screen:
      """
***************
*** 240,247 ****
  
                  elif o[0] == 'text':
!                     ( text, font, x, y, width, height, align_h, align_v,
                        mode, ellipses ) = o[1:]
!                     ### FIXME: font calc height
!                     if self.in_update(x, y, x+width+10, osd.height,
                                        self.updatelist['background'] + \
                                        self.updatelist['content']):
--- 252,258 ----
  
                  elif o[0] == 'text':
!                     ( text, font, x, y, width, height, update_height, align_h, 
align_v,
                        mode, ellipses ) = o[1:]
!                     if self.in_update(x, y, x+width+10, y+update_height,
                                        self.updatelist['background'] + \
                                        self.updatelist['content']):
***************
*** 258,262 ****
  
  
!             
  class Skin_Area:
      """
--- 269,275 ----
  
  
! 
! 
! 
  class Skin_Area:
      """
***************
*** 312,316 ****
          
          area = self.area_val
-         self.settings = settings
          if area:
              visible = area.visible
--- 325,328 ----
***************
*** 472,475 ****
--- 484,488 ----
          """
          redraw = self.redraw
+         self.settings = settings
  
          if widget_type == 'player':
***************
*** 577,581 ****
--- 590,604 ----
              
  
+     def get_font(self, name):
+         """
+         return the font object from the settings with that name. If not found,
+         print an error message and return the default font
+         """
+         if self.settings.font.has_key(name):
+             return self.settings.font[name]
+         print '*** font <%s> not found' % name
+         return default_font
  
+     
      def drawroundbox(self, x, y, width, height, rect, redraw=TRUE):
          """
***************
*** 619,624 ****
                  align_v = 'top'
  
!         self.screen.draw('content', ('text', text, font, x, y, width, height, 
align_h,
!                                      align_v, mode, ellipses ))
  
          if return_area:
--- 642,651 ----
                  align_v = 'top'
  
!         height2 = height
!         if height2 == -1:
!             height2 = font.h + 10
! 
!         self.screen.draw('content', ('text', text, font, x, y, width, height, 
height2,
!                                      align_h, align_v, mode, ellipses ))
  
          if return_area:
***************
*** 627,634 ****
                                         align_h = align_h, align_v = align_v,
                                         mode=mode, ellipses=ellipses, 
layer=self.dummy_layer)
-         height2 = height
-         if height2 == -1:
-             height2 = osd.stringsize('Arj', font=font.name, ptsize=font.size)[1] + 10
- 
          self.content_objects += [ ( 'text', x, y, width, height2, height, text, 
font, align_h,
                                    align_v, mode, ellipses ) ]
--- 654,657 ----

Index: info_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/info_area.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** info_area.py        11 Mar 2003 20:38:48 -0000      1.5
--- info_area.py        13 Mar 2003 21:02:04 -0000      1.6
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.6  2003/03/13 21:02:04  dischi
+ # misc cleanups
+ #
  # Revision 1.5  2003/03/11 20:38:48  dischi
  # some speed ups
***************
*** 98,106 ****
              val = content.types['default']
  
!         if not settings.font.has_key(content.font):
!             print '*** font <%s> not found' % content.font
!             return
! 
!         font = settings.font[content.font]
  
          table = [ [], [] ]
--- 101,105 ----
              val = content.types['default']
  
!         font = self.get_font(content.font)
  
          table = [ [], [] ]
***************
*** 157,161 ****
          x0 = content.x
  
!         y_spacing = osd.stringsize('Arj', font=font.name, ptsize=font.size)[1] * 1.1
              
          w = 0
--- 156,160 ----
          x0 = content.x
  
!         y_spacing = font.h * 1.1
              
          w = 0

Index: listing_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/listing_area.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** listing_area.py     7 Mar 2003 22:54:11 -0000       1.6
--- listing_area.py     13 Mar 2003 21:02:05 -0000      1.7
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.7  2003/03/13 21:02:05  dischi
+ # misc cleanups
+ #
  # Revision 1.6  2003/03/07 22:54:11  dischi
  # First version of the extended menu with image support. Try the music menu
***************
*** 151,171 ****
              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, content.width, 
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)
  
          elif content.type == 'image':
--- 154,167 ----
              for t in possible_types:
                  ct = possible_types[t]
!                 font = self.get_font(ct.font)
  
                  rh = 0
                  rw = 0
                  if ct.rectangle:
!                     rw, rh, r = self.get_item_rectangle(ct.rectangle, content.width, 
font.h)
                      hskip = min(hskip, r.x)
                      vskip = min(vskip, r.y)
  
!                 items_h = max(items_h, font.h, rh)
  
          elif content.type == 'image':
***************
*** 259,269 ****
                      val = content.types['default']
                  
!             if not settings.font.has_key(val.font):
!                 if content.type == 'text':
!                     print '*** font <%s> not found' % val.font
!                     break
! 
!             else:
!                 font = settings.font[val.font]
  
  
--- 255,259 ----
                      val = content.types['default']
                  
!             font = self.get_font(val.font)
  
  
***************
*** 280,295 ****
  
              if content.type == 'text':
-                 font_w, font_h = osd.stringsize('Arj', font=font.name, 
ptsize=font.size)
                  if choice.icon:
                      image = osd.loadbitmap(choice.icon)
                      if image:
!                         image = pygame.transform.scale(image, (font_h, font_h))
                          self.draw_image(image, (x0, y0))
!                         icon_x = font_h + content.spacing
                  else:
                      icon_x = 0
  
                  if val.rectangle:
!                     r = self.get_item_rectangle(val.rectangle, width, font_h)[2]
                      self.drawroundbox(x0 + hskip + r.x + icon_x, y0 + vskip + r.y,
                                        r.width - icon_x, r.height, r)
--- 270,284 ----
  
              if content.type == 'text':
                  if choice.icon:
                      image = osd.loadbitmap(choice.icon)
                      if image:
!                         image = pygame.transform.scale(image, (font.h, font.h))
                          self.draw_image(image, (x0, y0))
!                         icon_x = font.h + content.spacing
                  else:
                      icon_x = 0
  
                  if val.rectangle:
!                     r = self.get_item_rectangle(val.rectangle, width, font.h)[2]
                      self.drawroundbox(x0 + hskip + r.x + icon_x, y0 + vskip + r.y,
                                        r.width - icon_x, r.height, r)
***************
*** 324,328 ****
                  
          self.last_choices = (menu.selected, copy.copy(menuw.menu_items))
- 
- 
-         
--- 313,314 ----

Index: skin_dischi1.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/skin_dischi1.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** skin_dischi1.py     13 Mar 2003 19:57:08 -0000      1.35
--- skin_dischi1.py     13 Mar 2003 21:02:05 -0000      1.36
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.36  2003/03/13 21:02:05  dischi
+ # misc cleanups
+ #
  # Revision 1.35  2003/03/13 19:57:08  dischi
  # add font height information to font
***************
*** 147,161 ****
  
  
- #
- # We have five areas, all inherit from Skin_Area (file area.py)
- #
- # Screen_Area   (this file)
- # Title_Area    (this file)
- # View_Area     (view_area.py)
- # Listing_Area  (listing_area.py)
- # Info_Area     (not implemented yet)
- 
  from area import Skin_Area
  from area import Screen
  
  from listing_area import Listing_Area
--- 150,156 ----
  
  
  from area import Skin_Area
  from area import Screen
+ from area import default_font
  
  from listing_area import Listing_Area
***************
*** 165,168 ****
--- 160,164 ----
  
  
+ 
  class Screen_Area(Skin_Area):
      """
***************
*** 227,236 ****
  
          self.text = text
! 
!         if not self.settings.font.has_key(content.font):
!             print '*** font <%s> not found' % content.font
!             return
! 
!         self.write_text(text, self.settings.font[content.font], content, mode='hard')
  
  
--- 223,227 ----
  
          self.text = text
!         self.write_text(text, self.get_font(content.font), content, mode='hard')
  
  
***************
*** 243,251 ****
  ###############################################################################
  
- XML_SKIN_DIRECTORY = 'skins/dischi1'
- 
  class Skin:
! 
      def __init__(self):
          self.display_style = 0
          self.force_redraw = TRUE
--- 234,244 ----
  ###############################################################################
  
  class Skin:
!     """
!     main skin class
!     """
!     
      def __init__(self):
+         self.XML_SKIN_DIRECTORY = 'skins/dischi1'
          self.display_style = 0
          self.force_redraw = TRUE
***************
*** 266,270 ****
          if not self.settings.load(config.SKIN_XML_FILE):
              print "skin not found, using fallback skin"
!             self.settings.load("%s/blue1_big.xml" % XML_SKIN_DIRECTORY)
          
          for dir in config.cfgfilepath:
--- 259,263 ----
          if not self.settings.load(config.SKIN_XML_FILE):
              print "skin not found, using fallback skin"
!             self.settings.load("%s/blue1_big.xml" % self.XML_SKIN_DIRECTORY)
          
          for dir in config.cfgfilepath:
***************
*** 281,288 ****
              if font.shadow.visible:
                  font.h += font.shadow.y
!             
!     # Parse XML files with additional settings
!     # TODO: parse also parent directories
      def LoadSettings(self, dir, copy_content = 1):
          if copy_content:
              settings = copy.copy(self.settings)
--- 274,284 ----
              if font.shadow.visible:
                  font.h += font.shadow.y
! 
! 
!     
      def LoadSettings(self, dir, copy_content = 1):
+         """
+         return an object with new skin settings
+         """
          if copy_content:
              settings = copy.copy(self.settings)
***************
*** 292,295 ****
--- 288,292 ----
          if dir and os.path.isfile(os.path.join(dir, "skin.xml")):
              settings.load(os.path.join(dir, "skin.xml"), copy_content)
+ 
              # add the height to each font
              for font_name in settings.font:
***************
*** 302,305 ****
--- 299,303 ----
          elif dir and os.path.isfile(dir):
              settings.load(dir, copy_content)
+ 
              # add the height to each font
              for font_name in settings.font:
***************
*** 312,318 ****
  
  
      def GetSkins(self):
          ret = []
!         for skin in util.match_files(XML_SKIN_DIRECTORY, ['xml']):
              name  = os.path.splitext(os.path.basename(skin))[0]
              if '%s.png' % os.path.splitext(skin)[0]:
--- 310,320 ----
  
  
+ 
      def GetSkins(self):
+         """
+         return a list of all possible skins with name, image and filename
+         """
          ret = []
!         for skin in util.match_files(self.XML_SKIN_DIRECTORY, ['xml']):
              name  = os.path.splitext(os.path.basename(skin))[0]
              if '%s.png' % os.path.splitext(skin)[0]:
***************
*** 324,335 ****
      
          
-     # Got DISPLAY event from menu
      def ToggleDisplayStyle(self, menu):
          self.display_style = not self.display_style
          return 1
  
      def GetDisplayStyle(self):
          return self.display_style
  
      def GetPopupBoxStyle(self, menu=None):
          """
--- 326,355 ----
      
          
      def ToggleDisplayStyle(self, menu):
+         """
+         Toggle display style
+         """
          self.display_style = not self.display_style
          return 1
  
+ 
      def GetDisplayStyle(self):
+         """
+         return current display style
+         """
          return self.display_style
  
+ 
+     def get_font(self, name):
+         """
+         return the font object from the settings with that name. If not found,
+         print an error message and return the default font
+         """
+         if self.settings.font.has_key(name):
+             return self.settings.font[name]
+         print '*** font <%s> not found' % name
+         return default_font
+ 
+ 
      def GetPopupBoxStyle(self, menu=None):
          """
***************
*** 378,405 ****
          color   = layout.content.color
  
!         if not settings.font.has_key(layout.content.font):
!             print '*** font <%s> not found' % layout.content.font
!             font = None
!         else:
!             font = settings.font[layout.content.font]
                  
          if layout.content.types.has_key('default'):
              button_default = copy.copy(layout.content.types['default'])
  
-             if not settings.font.has_key(button_default.font):
-                 print '*** font <%s> not found' % button_default.font
-                 button_default.font = None
-             else:
-                 button_default.font = settings.font[button_default.font]
- 
-             
          if layout.content.types.has_key('selected'):
              button_selected = copy.copy(layout.content.types['selected'])
! 
!             if not settings.font.has_key(button_selected.font):
!                 print '*** font <%s> not found' % button_selected.font
!                 button_selected.font = None
!             else:
!                 button_selected.font = settings.font[button_selected.font]
  
          return (background, spacing, color, font, button_default, button_selected)
--- 398,410 ----
          color   = layout.content.color
  
!         font = self.get_font(layout.content.font)
                  
          if layout.content.types.has_key('default'):
              button_default = copy.copy(layout.content.types['default'])
+             button_default.font = self.get_font(button_default.font)
  
          if layout.content.types.has_key('selected'):
              button_selected = copy.copy(layout.content.types['selected'])
!             button_selected.font = self.get_font(button_selected.font)
  
          return (background, spacing, color, font, button_default, button_selected)
***************
*** 453,456 ****
--- 458,466 ----
  
      def items_per_page(self, (type, object)):
+         """
+         returns the number of items per menu page
+         (cols, rows) for normal menu and
+         rows         for the tv menu
+         """
          if not object:
              osd.drawstring('INTERNAL ERROR, NO MENU!', 100, osd.height/2)
***************
*** 485,488 ****
--- 495,504 ----
  
      def draw(self, (type, object)):
+         """
+         draw the object.
+         object may be a menu widget, a table for the tv menu are an audio item for
+         the audio player
+         """
+ 
          if type == 'menu':
              menuw = object

Index: tvlisting_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/tvlisting_area.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tvlisting_area.py   8 Mar 2003 19:54:41 -0000       1.2
--- tvlisting_area.py   13 Mar 2003 21:02:08 -0000      1.3
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/13 21:02:08  dischi
+ # misc cleanups
+ #
  # Revision 1.2  2003/03/08 19:54:41  dischi
  # make it look nicer
***************
*** 105,113 ****
                          selected_font, default_val, default_font
          
-         for font in (label_font, head_font, selected_font, default_font): 
-             font.h = osd.stringsize('Ajg', font.name, font.size)[1]
-             if font.shadow.visible:
-                 font.h += font.shadow.y
- 
          font_h = max(selected_font.h, default_font.h, label_font.h)
  
--- 108,111 ----




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to