Update of /cvsroot/freevo/freevo/src/gui/areas
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25701/gui/areas

Modified Files:
        default_areas.py listing_area.py progress_area.py view_area.py 
Log Message:
adjust to new gui/area/area.py

Index: listing_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/listing_area.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** listing_area.py     20 Nov 2004 18:23:01 -0000      1.14
--- listing_area.py     30 Dec 2004 11:28:07 -0000      1.15
***************
*** 65,71 ****
          """
          Area.__init__(self, 'listing')
-         self.content           = []
          self.last_listing      = []
!         self.last_content_type = ''
          self.last_selection    = None
          self.last_start        = -1
--- 65,70 ----
          """
          Area.__init__(self, 'listing')
          self.last_listing      = []
!         self.last_settings_type = ''
          self.last_selection    = None
          self.last_start        = -1
***************
*** 93,97 ****
          # reset variables
          if not keep_settings:
!             self.last_content_type = ''
              self.last_selection    = None
              self.last_start        = -1
--- 92,96 ----
          # reset variables
          if not keep_settings:
!             self.last_settings_type = ''
              self.last_selection    = None
              self.last_start        = -1
***************
*** 144,167 ****
  
  
!     def __get_items_geometry(self, settings, menu, area_settings):
          """
          Get the geometry of the items. How many items per row/col, spaces
          between each item, etc
          """
!         # ok, we use settings + area_settings as key
!         # FIXME: is that ok or do we need something else?
!         key = '%s-%s-%s' % (settings, area_settings, self.layout.content.type)
!         try:
!             # returned cached information
!             return menu.listing_area_dict[key]
!         except (KeyError, AttributeError):
!             pass
  
!         content = self.calc_geometry(self.layout.content, copy_object=True)
  
!         if content.type == 'text':
!             items_w = content.width
              items_h = 0
!         elif content.type == 'image' or content.type == 'image+text':
              items_w = 0
              items_h = 0
--- 143,162 ----
  
  
!     def __get_items_geometry(self, menu):
          """
          Get the geometry of the items. How many items per row/col, spaces
          between each item, etc
          """
!         if hasattr(menu, '_skin_info_listing_area') and \
!            menu._skin_info_listing_area[0] == self.settings:
!             # return cache
!             return menu._skin_info_listing_area[1]
  
!         settings = self.settings
  
!         if settings.type == 'text':
!             items_w = settings.width
              items_h = 0
!         elif settings.type == 'image' or settings.type == 'image+text':
              items_w = 0
              items_h = 0
***************
*** 173,190 ****
              if hasattr(i, 'display_type') and i.display_type:
                  x = i.display_type
!                 if content.types.has_key(x) and not possible_types.has_key(x):
!                     possible_types[x] = content.types[x]
                  x = '%s selected' % i.display_type
!                 if content.types.has_key(x) and not possible_types.has_key(x):
!                     possible_types[x] = content.types[x]
!         if content.types.has_key('default'):
!             possible_types['default'] = content.types['default']
!         if content.types.has_key('selected'):
!             possible_types['selected'] = content.types['selected']
  
          hskip = 0
          vskip = 0
          # get the max height of a text item
!         if content.type == 'text':
              for t in possible_types:
                  ct = possible_types[t]
--- 168,185 ----
              if hasattr(i, 'display_type') and i.display_type:
                  x = i.display_type
!                 if settings.types.has_key(x) and not 
possible_types.has_key(x):
!                     possible_types[x] = settings.types[x]
                  x = '%s selected' % i.display_type
!                 if settings.types.has_key(x) and not 
possible_types.has_key(x):
!                     possible_types[x] = settings.types[x]
!         if settings.types.has_key('default'):
!             possible_types['default'] = settings.types['default']
!         if settings.types.has_key('selected'):
!             possible_types['selected'] = settings.types['selected']
  
          hskip = 0
          vskip = 0
          # get the max height of a text item
!         if settings.type == 'text':
              for t in possible_types:
                  ct = possible_types[t]
***************
*** 193,199 ****
                  rw = 0
                  if ct.rectangle:
!                     rw, rh, r = self.calc_rectangle(ct.rectangle,
!                                                     content.width,
!                                                     ct.font.height)
                      hskip = min(hskip, r.x)
                      vskip = min(vskip, r.y)
--- 188,193 ----
                  rw = 0
                  if ct.rectangle:
!                     rw, rh, r = ct.rectangle.calculate(settings.width,
!                                                        ct.font.height)
                      hskip = min(hskip, r.x)
                      vskip = min(vskip, r.y)
***************
*** 202,206 ****
                  items_h = max(items_h, ct.font.height, rh)
  
!         elif content.type == 'image' or content.type == 'image+text':
              for t in possible_types:
                  ct = possible_types[t]
--- 196,200 ----
                  items_h = max(items_h, ct.font.height, rh)
  
!         elif settings.type == 'image' or settings.type == 'image+text':
              for t in possible_types:
                  ct = possible_types[t]
***************
*** 208,221 ****
                  rw = 0
                  if ct.rectangle:
!                     if content.type == 'image+text':
                          mh = max(ct.height, int(ct.font.height * 1.1))
                      else:
                          mh = ct.height
!                     rw, rh, r = self.calc_rectangle(ct.rectangle, ct.width, 
mh)
                      hskip = min(hskip, r.x)
                      vskip = min(vskip, r.y)
  
                  addh = 0
!                 if content.type == 'image+text':
                      addh = int(ct.font.height * 1.1)
  
--- 202,215 ----
                  rw = 0
                  if ct.rectangle:
!                     if settings.type == 'image+text':
                          mh = max(ct.height, int(ct.font.height * 1.1))
                      else:
                          mh = ct.height
!                     rw, rh, r = ct.rectangle.calculate(ct.width, mh)
                      hskip = min(hskip, r.x)
                      vskip = min(vskip, r.y)
  
                  addh = 0
!                 if settings.type == 'image+text':
                      addh = int(ct.font.height * 1.1)
  
***************
*** 225,233 ****
  
          else:
!             log.warning('unknown content type %s' % content.type)
              return None
  
          # shrink width for text menus
!         width = content.width
  
          if items_w > width:
--- 219,227 ----
  
          else:
!             log.warning('unknown settings type %s' % settings.type)
              return None
  
          # shrink width for text menus
!         width = settings.width
  
          if items_w > width:
***************
*** 237,258 ****
          rows = 0
  
!         while (cols + 1) * (items_w + content.spacing) - \
!               content.spacing <= content.width:
              cols += 1
  
!         while (rows + 1) * (items_h + content.spacing) - \
!               content.spacing <= content.height:
              rows += 1
  
!         if not hasattr(menu, 'listing_area_dict'):
!             menu.listing_area_dict = {}
! 
!         info = cols, rows, items_w + content.spacing, items_h + \
!                content.spacing, -hskip, -vskip, width
!         menu.listing_area_dict[key] = info
          return info
  
  
!     def __draw_text_listing_item(self, choice, (x,y), content, val, hspace,
                                   vspace, gui_objects, width, hskip, vskip):
          """
--- 231,249 ----
          rows = 0
  
!         while (cols + 1) * (items_w + settings.spacing) - \
!               settings.spacing <= settings.width:
              cols += 1
  
!         while (rows + 1) * (items_h + settings.spacing) - \
!               settings.spacing <= settings.height:
              rows += 1
  
!         info = cols, rows, items_w + settings.spacing, items_h + \
!                settings.spacing, -hskip, -vskip, width
!         menu._skin_info_listing_area = self.settings, info
          return info
  
  
!     def __draw_text_listing_item(self, choice, (x,y), settings, val, hspace,
                                   vspace, gui_objects, width, hskip, vskip):
          """
***************
*** 263,267 ****
          icon_x = 0
          icon   = None
!         align  = val.align or content.align
          menu   = self.menu
          x_icon = 0
--- 254,258 ----
          icon_x = 0
          icon   = None
!         align  = val.align or settings.align
          menu   = self.menu
          x_icon = 0
***************
*** 331,335 ****
          #
          if val.rectangle:
!             r = self.calc_rectangle(val.rectangle, width, val.font.height)[2]
              b = self.drawbox(x + hskip + r.x + x_icon - \
                               self.settings.box_under_icon * x_icon,
--- 322,326 ----
          #
          if val.rectangle:
!             r = val.rectangle.calculate(width, val.font.height)[2]
              b = self.drawbox(x + hskip + r.x + x_icon - \
                               self.settings.box_under_icon * x_icon,
***************
*** 343,349 ****
          # special handling for tv shows
          #
!         if choice.type == 'video' and hasattr(choice,'tv_show') and \
!            choice.tv_show and (val.align=='left' or val.align=='') and \
!            (content.align=='left' or content.align==''):
              sn = choice.show_name
  
--- 334,340 ----
          # special handling for tv shows
          #
!         if choice.type == 'video' and choice.tv_show and \
!                (val.align=='left' or val.align=='') and \
!                (settings.align=='left' or settings.align==''):
              sn = choice.show_name
  
***************
*** 372,383 ****
                      self.tvs_shortname = True
  
!                 if self.all_tvs and self.tvs_shortname:
!                     tvs_w = val.font.stringsize('x') + season + episode
                  else:
!                     tvs_w = val.font.stringsize('%s x' % sn[0]) + \
!                             season + episode
                  self.last_tvs = (sn[0], tvs_w)
  
!             s = self.drawstring(' - %s' % sn[3], val.font, content,
                                  x=x + hskip + icon_x + tvs_w,
                                  y=y + vskip, width=width-icon_x-tvs_w,
--- 363,381 ----
                      self.tvs_shortname = True
  
!                 if sn[1]:
!                     if self.all_tvs and self.tvs_shortname:
!                         tvs_w = val.font.stringsize('x') + season + episode
!                     else:
!                         tvs_w = val.font.stringsize('%s x' % sn[0]) + \
!                                 season + episode
                  else:
!                     if self.all_tvs and self.tvs_shortname:
!                         tvs_w = season + episode
!                     else:
!                         tvs_w = val.font.stringsize('%s ' % sn[0]) + \
!                                 season + episode
                  self.last_tvs = (sn[0], tvs_w)
  
!             s = self.drawstring(' - %s' % sn[3], val.font, settings,
                                  x=x + hskip + icon_x + tvs_w,
                                  y=y + vskip, width=width-icon_x-tvs_w,
***************
*** 385,397 ****
                                  mode='hard')
              gui_objects.append(s)
!             s = self.drawstring(sn[2], val.font, content,
                                  x=x + hskip + icon_x + tvs_w - 100,
                                  y=y + vskip, width=100, height=-1,
                                  align_h='right', dim=False, mode='hard')
              gui_objects.append(s)
!             if self.all_tvs and self.tvs_shortname:
!                 text = '%sx' % sn[1]
              else:
!                 text = '%s %sx' % (sn[0], sn[1])
  
          #
--- 383,401 ----
                                  mode='hard')
              gui_objects.append(s)
!             s = self.drawstring(sn[2], val.font, settings,
                                  x=x + hskip + icon_x + tvs_w - 100,
                                  y=y + vskip, width=100, height=-1,
                                  align_h='right', dim=False, mode='hard')
              gui_objects.append(s)
!             if sn[1]:
!                 if self.all_tvs and self.tvs_shortname:
!                     text = '%sx' % sn[1]
!                 else:
!                     text = '%s %sx' % (sn[0], sn[1])
              else:
!                 if self.all_tvs and self.tvs_shortname:
!                     text = ''
!                 else:
!                     text = sn[0]
  
          #
***************
*** 419,423 ****
  
                  if table_text[i]:
!                     s = self.drawstring(table_text[i], val.font, content,
                                          x=table_x + x_mod, y=y + vskip,
                                          width=table_w, height=-1,
--- 423,427 ----
  
                  if table_text[i]:
!                     s = self.drawstring(table_text[i], val.font, settings,
                                          x=table_x + x_mod, y=y + vskip,
                                          width=table_w, height=-1,
***************
*** 431,441 ****
              # draw the text
              #
!             s = self.drawstring(text, val.font, content, x=x + hskip + x_icon,
                                  y=y + vskip, width=width-icon_x, height=-1,
                                  align_h=val.align, mode='hard', dim=True)
!             gui_objects.append(s)
  
  
!     def __draw_image_listing_item(self, choice, (x, y), content, val, hspace,
                                    vspace, gui_objects):
          """
--- 435,446 ----
              # draw the text
              #
!             s = self.drawstring(text, val.font, settings, x=x + hskip + 
x_icon,
                                  y=y + vskip, width=width-icon_x, height=-1,
                                  align_h=val.align, mode='hard', dim=True)
!             if s:
!                 gui_objects.append(s)
  
  
!     def __draw_image_listing_item(self, choice, (x, y), settings, val, hspace,
                                    vspace, gui_objects):
          """
***************
*** 445,449 ****
          """
          height = val.height
!         if content.type == 'image+text':
              height += int(1.1 * val.font.height)
  
--- 450,454 ----
          """
          height = val.height
!         if settings.type == 'image+text':
              height += int(1.1 * val.font.height)
  
***************
*** 459,467 ****
  
          if val.rectangle:
!             if content.type == 'image+text':
                  max_h = max(height, int(val.font.height * 1.1))
!                 r = self.calc_rectangle(val.rectangle, val.width, max_h)[2]
              else:
!                 r = self.calc_rectangle(val.rectangle, val.width, height)[2]
              b = self.drawbox(x + r.x, y + r.y, r.width, r.height, r)
              gui_objects.append(b)
--- 464,472 ----
  
          if val.rectangle:
!             if settings.type == 'image+text':
                  max_h = max(height, int(val.font.height * 1.1))
!                 r = val.rectangle.calculate(val.width, max_h)[2]
              else:
!                 r = val.rectangle.calculate(val.width, height)[2]
              b = self.drawbox(x + r.x, y + r.y, r.width, r.height, r)
              gui_objects.append(b)
***************
*** 496,501 ****
              gui_objects.append(i)
  
!         if content.type == 'image+text':
!             s = self.drawstring(choice.name, val.font, content, x=x,
                                  y=y + val.height, width=val.width, height=-1,
                                  align_h=val.align, mode='hard',
--- 501,506 ----
              gui_objects.append(i)
  
!         if settings.type == 'image+text':
!             s = self.drawstring(choice.name, val.font, settings, x=x,
                                  y=y + val.height, width=val.width, height=-1,
                                  align_h=val.align, mode='hard',
***************
*** 521,525 ****
                                   (self.__default_val.width,
                                    self.__default_val.height),
!                                  self.settings, force=False,
                                   cache=self.imagecache)
          if len(self.__cache_listing) == 1:
--- 526,530 ----
                                   (self.__default_val.width,
                                    self.__default_val.height),
!                                  self.settings.icon_dir, force=False,
                                   cache=self.imagecache)
          if len(self.__cache_listing) == 1:
***************
*** 540,544 ****
          """
          menu      = self.menu
!         content   = self.calc_geometry(self.layout.content, copy_object=True)
  
          if not len(menu.choices):
--- 545,549 ----
          """
          menu      = self.menu
!         settings   = self.settings
  
          if not len(menu.choices):
***************
*** 546,550 ****
                  self.clear()
                  t = _('This directory is empty')
!                 self.empty_listing = self.drawstring(t, content.font, content)
              return
  
--- 551,556 ----
                  self.clear()
                  t = _('This directory is empty')
!                 self.empty_listing = self.drawstring(t, settings.font,
!                                                      settings)
              return
  
***************
*** 555,578 ****
  
          cols, rows, hspace, vspace, hskip, vskip, width = \
!               self.__get_items_geometry(self.settings, menu, self.area_values)
  
          menu.rows = rows
          menu.cols = cols
  
!         if content.align == 'center':
!             x = content.x + (content.width - cols * hspace) / 2
          else:
!             x = content.x
  
!         if content.valign == 'center':
!             y = content.y + (content.height - rows * vspace) / 2
          else:
!             y = content.y
  
          current_col = 1
  
!         if content.type == 'image':
!             width  = hspace - content.spacing
!             height = vspace - content.spacing
  
          self.last_tvs      = ('', 0)
--- 561,584 ----
  
          cols, rows, hspace, vspace, hskip, vskip, width = \
!               self.__get_items_geometry(menu)
  
          menu.rows = rows
          menu.cols = cols
  
!         if settings.align == 'center':
!             x = settings.x + (settings.width - cols * hspace) / 2
          else:
!             x = settings.x
  
!         if settings.valign == 'center':
!             y = settings.y + (settings.height - rows * vspace) / 2
          else:
!             y = settings.y
  
          current_col = 1
  
!         if settings.type == 'image':
!             width  = hspace - settings.spacing
!             height = vspace - settings.spacing
  
          self.last_tvs      = ('', 0)
***************
*** 584,588 ****
          listing = menu.choices[start:end]
          self.__cache_listing = []
!         if content.type != 'text' and end < len(menu.choices):
              self.__cache_listing = menu.choices[end:end + cols * rows]
              notifier.addTimer(0, notifier.Callback(self.__cache_next_image))
--- 590,594 ----
          listing = menu.choices[start:end]
          self.__cache_listing = []
!         if settings.type != 'text' and end < len(menu.choices):
              self.__cache_listing = menu.choices[end:end + cols * rows]
              notifier.addTimer(0, notifier.Callback(self.__cache_next_image))
***************
*** 590,597 ****
          # do some checking if we have to redraw everything
          # or only update because the selection changed
!         if self.last_content_type != content.type or \
             len(listing) != len(self.last_listing) or \
             self.last_start != start or self.last_max_len != len(menu.choices):
!             self.last_content_type = content.type
              self.last_start        = start
              self.last_max_len      = len(menu.choices)
--- 596,603 ----
          # do some checking if we have to redraw everything
          # or only update because the selection changed
!         if self.last_settings_type != settings.type or \
             len(listing) != len(self.last_listing) or \
             self.last_start != start or self.last_max_len != len(menu.choices):
!             self.last_settings_type = settings.type
              self.last_start        = start
              self.last_max_len      = len(menu.choices)
***************
*** 633,645 ****
              # init the 'val' settings
              if draw_this_item:
!                 if content.types.has_key( '%s selected' % choice.type ):
!                     s_val = content.types[ '%s selected' % choice.type ]
                  else:
!                     s_val = content.types[ 'selected' ]
  
!                 if content.types.has_key( choice.type ):
!                     n_val = content.types[ choice.type ]
                  else:
!                     n_val = content.types['default']
  
                  if choice == menu.selected:
--- 639,651 ----
              # init the 'val' settings
              if draw_this_item:
!                 if settings.types.has_key( '%s selected' % choice.type ):
!                     s_val = settings.types[ '%s selected' % choice.type ]
                  else:
!                     s_val = settings.types[ 'selected' ]
  
!                 if settings.types.has_key( choice.type ):
!                     n_val = settings.types[ choice.type ]
                  else:
!                     n_val = settings.types['default']
  
                  if choice == menu.selected:
***************
*** 649,662 ****
                      self.__default_val = val
  
!             if draw_this_item and content.type == 'text':
                  # draw item for text listing
!                 self.__draw_text_listing_item(choice, (x,y), content, val,
                                                hspace, vspace, gui_objects,
                                                width, hskip, vskip)
  
!             if draw_this_item and content.type == 'image' or \
!                    content.type == 'image+text':
                  # draw item for image listing
!                 self.__draw_image_listing_item(choice, (x,y), content, val,
                                                 hspace, vspace, gui_objects)
  
--- 655,668 ----
                      self.__default_val = val
  
!             if draw_this_item and settings.type == 'text':
                  # draw item for text listing
!                 self.__draw_text_listing_item(choice, (x,y), settings, val,
                                                hspace, vspace, gui_objects,
                                                width, hskip, vskip)
  
!             if draw_this_item and settings.type == 'image' or \
!                    settings.type == 'image+text':
                  # draw item for image listing
!                 self.__draw_image_listing_item(choice, (x,y), settings, val,
                                                 hspace, vspace, gui_objects)
  
***************
*** 664,671 ****
              if current_col == cols:
                  # max number of cols reached, skip to next row
!                 if content.align == 'center':
!                     x = content.x + (content.width - cols * hspace) / 2
                  else:
!                     x = content.x
                  y += vspace
                  current_col = 1
--- 670,677 ----
              if current_col == cols:
                  # max number of cols reached, skip to next row
!                 if settings.align == 'center':
!                     x = settings.x + (settings.width - cols * hspace) / 2
                  else:
!                     x = settings.x
                  y += vspace
                  current_col = 1
***************
*** 682,696 ****
              # draw the arrows
              try:
!                 if start > 0 and self.area_values.images['uparrow']:
!                     i = self.area_values.images['uparrow'].filename
!                     i = self.drawimage(i, self.area_values.images['uparrow'])
                      self.arrows.append(i)
                  if end < len(menu.choices):
!                     if isinstance(self.area_values.images['downarrow'].y, 
str):
!                         v = copy.copy(self.area_values.images['downarrow'])
                          v.y = eval(v.y, {'MAX':(y-vskip)})
                      else:
!                         v = self.area_values.images['downarrow']
!                     i = self.area_values.images['downarrow'].filename
                      i = self.drawimage(i, v)
                      self.arrows.append(i)
--- 688,702 ----
              # draw the arrows
              try:
!                 if start > 0 and settings.images['uparrow']:
!                     i = settings.images['uparrow'].filename
!                     i = self.drawimage(i, settings.images['uparrow'])
                      self.arrows.append(i)
                  if end < len(menu.choices):
!                     if isinstance(settings.images['downarrow'].y, str):
!                         v = copy.copy(settings.images['downarrow'])
                          v.y = eval(v.y, {'MAX':(y-vskip)})
                      else:
!                         v = settings.images['downarrow']
!                     i = settings.images['downarrow'].filename
                      i = self.drawimage(i, v)
                      self.arrows.append(i)

Index: progress_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/progress_area.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** progress_area.py    20 Nov 2004 18:23:01 -0000      1.2
--- progress_area.py    30 Dec 2004 11:28:07 -0000      1.3
***************
*** 66,70 ****
          Update the progressbar
          """
!         content = self.calc_geometry(self.layout.content, copy_object=True)
  
          try:
--- 66,70 ----
          Update the progressbar
          """
!         settings = self.settings
  
          try:
***************
*** 80,93 ****
          pos = self.infoitem.elapsed - start
  
!         if self.__last_c != (content.x, content.y, content.width,
!                                 content.height):
              if self.bar:
                  self.bar.unparent()
!             self.bar = Progressbar((content.x, content.y),
!                                    (content.width, content.height),
                                     2, (0,0,0), (255, 255, 255, 95), 0,
                                     None, (0, 0, 150), 0, length)
              self.layer.add_child(self.bar)
!             self.__last_c = content.x, content.y, content.width, \
!                             content.height
          self.bar.set_bar_position(pos)
--- 80,93 ----
          pos = self.infoitem.elapsed - start
  
!         if self.__last_c != (settings.x, settings.y, settings.width,
!                                 settings.height):
              if self.bar:
                  self.bar.unparent()
!             self.bar = Progressbar((settings.x, settings.y),
!                                    (settings.width, settings.height),
                                     2, (0,0,0), (255, 255, 255, 95), 0,
                                     None, (0, 0, 150), 0, length)
              self.layer.add_child(self.bar)
!             self.__last_c = settings.x, settings.y, settings.width, \
!                             settings.height
          self.bar.set_bar_position(pos)

Index: view_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/view_area.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** view_area.py        9 Oct 2004 16:22:57 -0000       1.8
--- view_area.py        30 Dec 2004 11:28:07 -0000      1.9
***************
*** 46,51 ****
      def __init__(self):
          Area.__init__(self, 'view')
!         self.info    = (None, None, None, None)
!         self.content = []
  
  
--- 46,51 ----
      def __init__(self):
          Area.__init__(self, 'view')
!         self.info = (None, None, None)
!         self.gui_objects = []
  
  
***************
*** 54,61 ****
          Delete the shown image from screen
          """
!         self.info  = (None, None, None, None)
!         for c in self.content:
              c.unparent()
!         self.content = []
  
  
--- 54,61 ----
          Delete the shown image from screen
          """
!         self.info  = (None, None, None)
!         for c in self.gui_objects:
              c.unparent()
!         self.gui_objects = []
  
  
***************
*** 73,91 ****
  
          if not image:
!             if self.content:
                  self.clear()
              return
  
          # get layout values and calc the geometry
!         content = self.calc_geometry(self.layout.content, copy_object=True)
!         width   = content.width  - 2 * content.spacing
!         height  = content.height - 2 * content.spacing
  
          # check if we need a redraw
!         if self.info == (self.settings, item.image, width, height):
              return
-         self.clear()
-         self.info = self.settings, item.image, width, height
  
  
          x0 = 0
--- 73,91 ----
  
          if not image:
!             if self.gui_objects:
                  self.clear()
              return
  
          # get layout values and calc the geometry
!         settings = self.settings
!         width    = settings.width  - 2 * settings.spacing
!         height   = settings.height - 2 * settings.spacing
  
          # check if we need a redraw
!         if not settings.changed and self.info == (item.image, width, height):
              return
  
+         self.clear()
+         self.info = item.image, width, height
  
          x0 = 0
***************
*** 93,102 ****
  
          try:
!             val = content.types[item.type]
          except (KeyError, AttributeError):
!             val = content.types['default']
  
          if val.rectangle:
!             r = self.calc_rectangle(val.rectangle, width, height)[2]
  
              if r.x < 0:
--- 93,102 ----
  
          try:
!             val = settings.types[item.type]
          except (KeyError, AttributeError):
!             val = settings.types['default']
  
          if val.rectangle:
!             r = val.rectangle.calculate(width, height)[2]
  
              if r.x < 0:
***************
*** 114,119 ****
                  r.height, height = height, height - (r.height - height)
  
!         addx = content.x + content.spacing
!         addy = content.y + content.spacing
  
          # FIXME: use cache here.
--- 114,119 ----
                  r.height, height = height, height - (r.height - height)
  
!         addx = settings.x + settings.spacing
!         addy = settings.y + settings.spacing
  
          # FIXME: use cache here.
***************
*** 126,139 ****
          i_w, i_h = image.width, image.height
  
!         if content.align == 'center' and i_w < width:
              addx += (width - i_w) / 2
  
!         if content.align == 'right' and i_w < width:
              addx += width - i_w
  
!         if content.valign == 'center' and i_h < height:
              addy += (height - i_h) / 2
  
!         if content.valign == 'bottom' and i_h < height:
              addy += height - i_h
  
--- 126,139 ----
          i_w, i_h = image.width, image.height
  
!         if settings.align == 'center' and i_w < width:
              addx += (width - i_w) / 2
  
!         if settings.align == 'right' and i_w < width:
              addx += width - i_w
  
!         if settings.valign == 'center' and i_h < height:
              addy += (height - i_h) / 2
  
!         if settings.valign == 'bottom' and i_h < height:
              addy += height - i_h
  
***************
*** 144,150 ****
              r.width  -= width  - i_w
              r.height -= height - i_h
!             self.content.append(self.drawbox(r.x + addx, r.y + addy,
!                                              r.width, r.height, r))
! 
!         self.content.append(self.drawimage(image, (x0, y0)))
  
--- 144,149 ----
              r.width  -= width  - i_w
              r.height -= height - i_h
!             box = self.drawbox(r.x + addx, r.y + addy, r.width, r.height, r)
!             self.gui_objects.append(box)
  
+         self.gui_objects.append(self.drawimage(image, (x0, y0)))

Index: default_areas.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/default_areas.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** default_areas.py    30 Oct 2004 18:45:30 -0000      1.8
--- default_areas.py    30 Dec 2004 11:28:07 -0000      1.9
***************
*** 36,42 ****
  __all__ = [ 'ScreenArea', 'TitleArea', 'SubtitleArea' ]
  
! from area import Area
  from gui import Progressbar
  
  class ScreenArea(Area):
      """
--- 36,46 ----
  __all__ = [ 'ScreenArea', 'TitleArea', 'SubtitleArea' ]
  
! # gui imports
  from gui import Progressbar
  
+ # area imports
+ from area import Area
+ 
+ 
  class ScreenArea(Area):
      """
***************
*** 73,86 ****
          """
          menu      = self.menu
!         content   = self.calc_geometry(self.layout.content, copy_object=True)
  
          text = ''
          try:
              item = menu.selected
!             if content.type == 'menu':
                  text = menu.heading
              elif len(menu.choices) == 0:
                  text = ''
!             elif content.type == 'short item':
                  if item.type == 'video' and item.tv_show and \
                         ((item.image and not item.image.endswith('.raw')) or \
--- 77,90 ----
          """
          menu      = self.menu
!         settings   = self.settings
  
          text = ''
          try:
              item = menu.selected
!             if settings.type == 'menu':
                  text = menu.heading
              elif len(menu.choices) == 0:
                  text = ''
!             elif settings.type == 'short item':
                  if item.type == 'video' and item.tv_show and \
                         ((item.image and not item.image.endswith('.raw')) or \
***************
*** 102,106 ****
              try:
                  if menu.type == 'tv':
!                     if content.type == 'item' or content.type == 'short item':
                          text = menu.table[1].title
                      else:
--- 106,111 ----
              try:
                  if menu.type == 'tv':
!                     if settings.type == 'item' or \
!                            settings.type == 'short item':
                          text = menu.table[1].title
                      else:
***************
*** 113,127 ****
                  text = self.infoitem.name
              else:
!                 if content.type == 'short item' and hasattr(menu, 'subtitle'):
                      text = menu.subtitle
                  elif hasattr(menu, 'title'):
                      text = menu.title
  
!         if self.text == (text, content.font, content):
              return
  
          self.clear()
!         self.text = text, content.font, content
!         self.gui_object = self.drawstring(text, content.font, content,
                                            height=-1, mode='hard')
  
--- 118,132 ----
                  text = self.infoitem.name
              else:
!                 if settings.type == 'short item' and hasattr(menu, 
'subtitle'):
                      text = menu.subtitle
                  elif hasattr(menu, 'title'):
                      text = menu.title
  
!         if self.text == (text, settings.font, settings):
              return
  
          self.clear()
!         self.text = text, settings.font, settings
!         self.gui_object = self.drawstring(text, settings.font, settings,
                                            height=-1, mode='hard')
  



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to