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

Modified Files:
        tvlisting_area.py 
Log Message:
improve drawing

Index: tvlisting_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/areas/tvlisting_area.py,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** tvlisting_area.py   22 Dec 2004 20:36:34 -0000      1.23
--- tvlisting_area.py   28 Dec 2004 19:50:58 -0000      1.24
***************
*** 43,50 ****
  import pyepg
  import gui
! 
  import time
  import config
! import math
  from area import Area
  from gui import Rectangle
--- 43,50 ----
  import pyepg
  import gui
! import math
  import time
  import config
! 
  from area import Area
  from gui import Rectangle
***************
*** 55,59 ****
  log = logging.getLogger('gui')
  
! class Geometry:
      """
      Simple object with x, y, with, height values
--- 55,60 ----
  log = logging.getLogger('gui')
  
! 
! class _Geometry:
      """
      Simple object with x, y, with, height values
***************
*** 65,68 ****
--- 66,73 ----
          self.height = height
  
+     def __str__(self):
+         return '_Geometry: %s,%s %sx%s' % \
+                (self.x, self.y, self.width, self.height)
+ 
  
  class TvlistingArea(Area):
***************
*** 77,84 ****
          self.last_items_geometry = None
          self.last_start_time = 0
-         self.chan_obj = []
-         self.time_obj = []
          self.last_channels = None
!         self.objects = []
          self.background = None
          
--- 82,93 ----
          self.last_items_geometry = None
          self.last_start_time = 0
          self.last_channels = None
! 
!         # objects on the area
!         self.chan_obj   = []
!         self.time_obj   = []
!         self.up_arrow   = None
!         self.down_arrow = None
!         self.objects    = []
          self.background = None
          
***************
*** 154,158 ****
              r.y, y = 0, -r.y
              height -= y
!         return Geometry(x, y, width, height), r
  
  
--- 163,167 ----
              r.y, y = 0, -r.y
              height -= y
!         return _Geometry(x, y, width, height), r
  
  
***************
*** 161,168 ****
              if o:
                  o.unparent()
!         if self.background:
!             self.background.unparent()
!             self.background = None
!         self.objects = []
          self.chan_obj = []
          self.time_obj = []
--- 170,178 ----
              if o:
                  o.unparent()
!         for o in ('background', 'up_arrow', 'down_arrow'):
!             if getattr(self, o):
!                 getattr(self, o).unparent()
!             setattr(self, o, None)
!         self.objects  = []
          self.chan_obj = []
          self.time_obj = []
***************
*** 182,196 ****
          head_val = self.all_vals[1]
  
!         geo = Geometry( 0, 0, col_size, height )
          if head_val.rectangle:
              geo, rect = self.fit_item_in_rectangle( head_val.rectangle,
                                                      col_size, height, height )
! 
          for i in range( n_cols ):
              if head_val.rectangle:
!                 self.time_obj.append(self.drawbox( math.floor(x0), y0,
!                                                    math.floor(col_size + x0)- 
\
!                                                    math.floor( x0 ) + 1,
!                                                    height + 1, rect ))
  
              t_str = time.strftime( timeformat,
--- 192,205 ----
          head_val = self.all_vals[1]
  
!         geo = _Geometry( 0, 0, col_size, height )
          if head_val.rectangle:
              geo, rect = self.fit_item_in_rectangle( head_val.rectangle,
                                                      col_size, height, height )
!             
          for i in range( n_cols ):
              if head_val.rectangle:
!                 width = int(math.floor(col_size + x0) - math.floor( x0 ) + 1)
!                 self.time_obj.append(self.drawbox(int(math.floor(x0)), y0,
!                                                   width, height + 1, rect))
  
              t_str = time.strftime( timeformat,
***************
*** 328,332 ****
              dateformat = '%e-%b'
  
!         r = Geometry( 0, 0, label_width, font_h )
          if label_val.rectangle:
              r = self.calc_rectangle( label_val.rectangle, label_width,
--- 337,341 ----
              dateformat = '%e-%b'
  
!         r = _Geometry( 0, 0, label_width, font_h )
          if label_val.rectangle:
              r = self.calc_rectangle( label_val.rectangle, label_width,
***************
*** 442,446 ****
  
                      # calc the geometry values
!                     ig = Geometry(0, 0, tx1-tx0+1, item_h)
                      if val.rectangle:
                          ig, r = self.fit_item_in_rectangle(val.rectangle,
--- 451,455 ----
  
                      # calc the geometry values
!                     ig = _Geometry(0, 0, tx1-tx0+1, item_h)
                      if val.rectangle:
                          ig, r = self.fit_item_in_rectangle(val.rectangle,
***************
*** 484,499 ****
              y0 += item_h - 1
  
-         # print arrow:
          if start_channel > 0 and area.images['uparrow']:
!             ar = self.drawimage(area.images['uparrow'].filename,
!                                 area.images['uparrow'])
!             self.objects.append(ar)
          if len(pyepg.channels) >= start_channel+num_rows and \
                 area.images['downarrow']:
!             if isinstance(area.images['downarrow'].y, str):
!                 v = copy.copy(area.images['downarrow'])
!                 v.y = eval(v.y, {'MAX' : y0})
!             else:
!                 v = area.images['downarrow']
!             ar = self.drawimage(area.images['downarrow'].filename, v)
!             self.objects.append(ar)
--- 493,520 ----
              y0 += item_h - 1
  
          if start_channel > 0 and area.images['uparrow']:
!             # up arrow needed
!             if not self.up_arrow:
!                 self.up_arrow = 
self.drawimage(area.images['uparrow'].filename,
!                                                area.images['uparrow'])
!         elif self.up_arrow:
!             # no arrow needed but on the screen, remove it
!             self.up_arrow.unparent()
!             self.up_arrow = None
! 
          if len(pyepg.channels) >= start_channel+num_rows and \
                 area.images['downarrow']:
!             if not self.down_arrow:
!                 # down arrow needed
!                 if isinstance(area.images['downarrow'].y, str):
!                     v = copy.copy(area.images['downarrow'])
!                     v.y = eval(v.y, {'MAX' : y0})
!                 else:
!                     v = area.images['downarrow']
!                 fname = area.images['downarrow'].filename
!                 self.down_arrow = self.drawimage(fname, v)
!         elif self.down_arrow:
!             # no arrow needed but on the screen, remove it
!             self.down_arrow.unparent()
!             self.down_arrow = None
!             



-------------------------------------------------------
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