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

Modified Files:
        tvlisting_area.py 
Log Message:
more cleanups

Index: tvlisting_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/tvlisting_area.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** tvlisting_area.py   22 Dec 2004 19:58:43 -0000      1.22
--- tvlisting_area.py   22 Dec 2004 20:36:34 -0000      1.23
***************
*** 81,97 ****
          self.last_channels = None
          self.objects = []
          
  
!     def get_items_geometry(self, settings, obj):
!         if self.last_settings == settings:
!             return self.last_items_geometry
! 
!         menuw     = obj
!         menu      = obj
! 
!         layout    = self.layout
!         area      = self.area_values
!         content   = self.calc_geometry(layout.content, copy_object=True)
  
          label_val     = content.types['label']
          head_val      = content.types['head']
--- 81,92 ----
          self.last_channels = None
          self.objects = []
+         self.background = None
          
  
!     def __calc_items_geometry(self):
!         # get the content skin information
!         content   = self.calc_geometry(self.layout.content, copy_object=True)
  
+         # get all values for the different types
          label_val     = content.types['label']
          head_val      = content.types['head']
***************
*** 104,116 ****
                          scheduled_val, conflict_val
  
          font_h = max(selected_val.font.height, default_val.font.height,
!                      label_val.font.height)
  
  
!         # get the max width needed for the longest channel name
          label_width = label_val.width
- 
-         label_txt_width = label_width
- 
          if label_val.rectangle:
              r = self.calc_rectangle(label_val.rectangle, label_width,
--- 99,109 ----
                          scheduled_val, conflict_val
  
+         # get max font height
          font_h = max(selected_val.font.height, default_val.font.height,
!                      label_val.font.height, conflict_val.height)
  
  
!         # get label width
          label_width = label_val.width
          if label_val.rectangle:
              r = self.calc_rectangle(label_val.rectangle, label_width,
***************
*** 120,127 ****
              label_width += content.spacing
  
!         # get head height
          if head_val.rectangle:
              r = self.calc_rectangle(head_val.rectangle, 20,
                                      head_val.font.height)[2]
              content_y = content.y + r.height + content.spacing
          else:
--- 113,123 ----
              label_width += content.spacing
  
! 
!         # get headline height
!         head_h = head_val.font.height
          if head_val.rectangle:
              r = self.calc_rectangle(head_val.rectangle, 20,
                                      head_val.font.height)[2]
+             head_h = max(head_h, r.height + content.spacing)
              content_y = content.y + r.height + content.spacing
          else:
***************
*** 131,160 ****
          # get item height
          item_h = font_h
  
!         if label_val.rectangle:
!             r = self.calc_rectangle(label_val.rectangle, 20,
!                                     label_val.font.height)[2]
!             item_h = max(item_h, r.height + content.spacing)
!         if default_val.rectangle:
!             r = self.calc_rectangle(default_val.rectangle, 20,
!                                     default_val.font.height)[2]
!             item_h = max(item_h, r.height + content.spacing)
!         if selected_val.rectangle:
!             r = self.calc_rectangle(selected_val.rectangle, 20,
!                                     selected_val.font.height)[2]
!             item_h = max(item_h, r.height + content.spacing)
! 
!         head_h = head_val.font.height
!         if head_val.rectangle:
!             r = self.calc_rectangle(head_val.rectangle, 20,
!                                     head_val.font.height)[2]
!             head_h = max(head_h, r.height + content.spacing)
! 
!         content_h = content.height + content.y - content_y
! 
!         self.last_items_geometry = font_h, label_width, label_txt_width, \
!                                    content_y, content_h / item_h, item_h, \
!                                    head_h, content.hours_per_page
!         return self.last_items_geometry
  
  
--- 127,137 ----
          # get item height
          item_h = font_h
+         for val in (label_val, default_val, selected_val, conflict_val):
+             if val.rectangle:
+                 r = self.calc_rectangle(val.rectangle, 20, val.font.height)[2]
+                 item_h = max(item_h, r.height + content.spacing)
  
!         num_rows = (content.height + content.y - content_y) / item_h
!         return font_h, label_width, content_y, num_rows, item_h, head_h
  
  
***************
*** 184,187 ****
--- 161,167 ----
              if o:
                  o.unparent()
+         if self.background:
+             self.background.unparent()
+             self.background = None
          self.objects = []
          self.chan_obj = []
***************
*** 281,294 ****
          """
          menu      = self.menu
-         settings  = self.settings
          layout    = self.layout
          area      = self.area_values
          content   = self.calc_geometry(layout.content, copy_object=True)
  
-         for o in self.objects:
-             if o:
-                 o.unparent()
-         self.objects = []
- 
          # to_listing     = menu.table
          # n_cols   = len(to_listing[0])-1
--- 261,268 ----
***************
*** 297,304 ****
          col_time = 30
  
!         font_h, label_width, label_txt_width, y0, num_rows, item_h, head_h = \
!                 self.get_items_geometry(settings, menu)[:-1]
  
  
          label_val, head_val, selected_val, default_val, \
                     scheduled_val, conflict_val = self.all_vals
--- 271,294 ----
          col_time = 30
  
!         if self.last_settings == self.settings:
!             # same layout, only clean 'objects'
!             for o in self.objects:
!                 if o: o.unparent()
!             self.objects = []
!             # get last geometry values
!             geometry = self.last_items_geometry
!         else:
!             # layout change, clean everything
!             self.clear()
!             # calculate new geometry values
!             geometry = self.__calc_items_geometry()
!             # save everything for later use
!             self.last_settings = self.settings
!             self.last_items_geometry = geometry
  
+         # split geometry
+         font_h, label_width, y0, num_rows, item_h, head_h = geometry
  
+         # get all 'val's
          label_val, head_val, selected_val, default_val, \
                     scheduled_val, conflict_val = self.all_vals
***************
*** 357,363 ****
  
  
!         self.objects.append(self.drawbox( x_contents - r.width,
!                                           y_contents - r.height,
!                                           r.width+1, head_h+1, r ))
  
  
--- 347,354 ----
  
  
!         if not self.background:
!             self.background = self.drawbox( x_contents - r.width,
!                                             y_contents - r.height,
!                                             r.width+1, head_h+1, r )
  
  



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to