Update of /cvsroot/freevo/freevo/src/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv17973

Modified Files:
        AlertBox.py Button.py ConfirmBox.py GUIObject.py InputBox.py 
        LetterBox.py LetterBoxGroup.py ListBox.py PopupBox.py 
        RegionScroller.py ZIndexRenderer.py listboxdemo.py 
        optiondemo.py scrolldemo.py 
Log Message:
More work hooking skin properties into the GUI objects, and also making
better use of OOP.

ListBox and others are working again, although I have a nasty bug regarding
alpha transparencies and the new skin.


Index: AlertBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/AlertBox.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** AlertBox.py 2 Mar 2003 20:15:41 -0000       1.3
--- AlertBox.py 5 Mar 2003 03:53:34 -0000       1.4
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.4  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.3  2003/03/02 20:15:41  rshortt
  # GUIObject and PopupBox now get skin settings from the new skin.  I put
***************
*** 83,102 ****
                   bd_color=None, bd_width=None):
  
- 
          PopupBox.__init__(self, text, left, top, width, height, bg_color, 
                            fg_color, icon, border, bd_color, bd_width)
  
  
-         ((bg_type, skin_bg), skin_spacing, skin_color, skin_font, 
-          skin_button_default, skin_button_selected) = \
-          self.skin.GetPopupBoxStyle()
- 
-         print 'STYLE: %s, %s, %s, %s, %s, %s' % (skin_bg, skin_spacing, 
-                skin_color, skin_font, skin_button_default, skin_button_selected)
- 
- # STYLE: ('rectangle', <xml_skin.XML_rectangle instance at 0x801b73ec>), 9, 
16777215, <xml_skin.XML_font instance at 0x801b6c7c>, <xml_skin.XML_data instance at 
0x80474974>, <xml_skin.XML_data instance at 0x80302e6c>
- 
- 
- 
          self.set_h_align(Align.CENTER)
  
--- 90,97 ----
***************
*** 108,111 ****
--- 103,107 ----
          b1.set_position(bleft, btop) 
          b1.toggle_selected()
+ 
          self.add_child(b1)
  
***************
*** 118,122 ****
              return
          elif [self.rc.ENTER, self.rc.SELECT, self.rc.EXIT].count(event) > 0:
!             print 'HIT OK'
              self.destroy()
          else:
--- 114,118 ----
              return
          elif [self.rc.ENTER, self.rc.SELECT, self.rc.EXIT].count(event) > 0:
!             if DEBUG: print 'HIT OK'
              self.destroy()
          else:

Index: Button.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/Button.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Button.py   24 Feb 2003 11:58:28 -0000      1.2
--- Button.py   5 Mar 2003 03:53:34 -0000       1.3
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 11:58:28  rshortt
  # Adding OptionBox and optiondemo.  Also some minor cleaning in a few other
***************
*** 44,47 ****
--- 51,55 ----
  import pygame
  import config
+ import skin
  
  from GUIObject  import *
***************
*** 65,68 ****
--- 73,78 ----
      bg_color  Background color (Color)
      fg_color  Foreground color (Color)
+     selected_bg_color  Background color (Color)
+     selected_fg_color  Foreground color (Color)
      border    Border
      bd_color  Border color (Color)
***************
*** 71,116 ****
  
      
!     def __init__(self, text, handler=None, icon=None, left=None, top=None, 
!                  width=None, height=None, bg_color=None, fg_color=None, 
!                  selected_color=None, border=None, bd_color=None, 
!                  bd_width=None):
  
!         GUIObject.__init__(self)
  
!         self.text           = text
!         self.handler        = handler
!         self.icon           = icon
!         self.border         = border
!         self.label          = None
!         self.h_margin       = 10
!         self.v_margin       = 10
!         self.bd_color       = bd_color
!         self.bd_width       = bd_width
!         self.width          = width
!         self.height         = height
!         self.left           = left
!         self.top            = top
!         self.bg_color       = bg_color
!         self.fg_color       = fg_color
!         self.selected_color = selected_color
  
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly. self.skin is set in the superclass.
  
!         if not self.width:    self.width    = 70
!         if not self.height:   self.height   = 25
!         if not self.left:     self.left     = -100
!         if not self.top:      self.top      = -100
!         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
!         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
!         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
!         if not self.bd_width: self.bd_width = 2
!         if not self.border:   self.border   = Border(self, Border.BORDER_FLAT, 
!                                                      self.bd_color, self.bd_width)
  
!         if not self.selected_color: self.selected_color = Color((0,255,0,128))
  
-         self.set_v_align(Align.BOTTOM)
-         self.set_h_align(Align.CENTER)
  
          if type(text) is StringType:
--- 81,149 ----
  
      
!     def __init__(self, text=" ", handler=None, left=None, top=None, 
!                  width=70, height=25, bg_color=None, fg_color=None, 
!                  selected_bg_color=None, selected_fg_color=None,
!                  border=None, bd_color=None, bd_width=None):
  
!         self.border            = border
!         self.bd_color          = bd_color
!         self.bd_width          = bd_width
!         self.handler           = handler
!         self.bg_color          = bg_color
!         self.fg_color          = fg_color
!         self.selected_fg_color = selected_fg_color
!         self.selected_bg_color = selected_bg_color
  
!         self.skin = skin.get_singleton()
  
!         (BLAH, BLAH, BLAH, BLAH,
!          button_default, button_selected) = \
!          self.skin.GetPopupBoxStyle()
  
!         if not self.bg_color:
!             if button_default.rectangle.bgcolor:
!                 self.bg_color = Color(button_default.rectangle.bgcolor)
!             else:
!                 self.bg_color = Color(self.osd.default_bg_color)
  
!         if not self.fg_color:
!             if button_default.font.color:
!                 self.fg_color = Color(button_default.font.color)
!             else:
!                 self.fg_color = Color(self.osd.default_fg_color)
! 
!         if not self.selected_bg_color:
!             if button_selected.rectangle.bgcolor:
!                 self.selected_bg_color = Color(button_selected.rectangle.bgcolor)
!             else:
!                 self.selected_bg_color = Color((0,255,0,128))
! 
!         if not self.selected_fg_color:
!             if button_selected.font.color:
!                 self.selected_fg_color = Color(button_selected.font.color)
!             else:
!                 self.selected_fg_color = Color(self.osd.default_fg_color)
! 
! 
!         GUIObject.__init__(self, left, top, width, height, 
!                            self.bg_color, self.fg_color)
! 
! 
!         if not self.bd_color: 
!             if button_default.rectangle.color:
!                 self.bd_color = Color(button_default.rectangle.color)
!             else:
!                 self.bd_color = Color(self.osd.default_fg_color)
! 
!         if not self.bd_width: 
!             if button_default.rectangle.size:
!                 self.bd_width = button_default.rectangle.size
!             else:
!                 self.bd_width = 2
! 
!         if not self.border:   
!             self.border = Border(self, Border.BORDER_FLAT,
!                                  self.bd_color, self.bd_width)
  
  
          if type(text) is StringType:
***************
*** 121,124 ****
--- 154,169 ----
              raise TypeError, text
  
+         # going to support sel_font soon!
+         if button_default.font:       
+             self.set_font(button_default.font.name, 
+                           button_default.font.size, 
+                           Color(button_default.font.color))
+         else:
+             self.set_font(config.OSD_DEFAULT_FONTNAME,
+                           config.OSD_DEFAULT_FONTSIZE)
+ 
+         self.set_v_align(Align.BOTTOM)
+         self.set_h_align(Align.CENTER)
+ 
  
      def _draw(self):
***************
*** 127,132 ****
  
          if self.selected:
!             c = self.selected_color.get_color_sdl()
!             a = self.selected_color.get_alpha()
          else:
              c = self.bg_color.get_color_sdl()
--- 172,177 ----
  
          if self.selected:
!             c = self.selected_bg_color.get_color_sdl()
!             a = self.selected_bg_color.get_alpha()
          else:
              c = self.bg_color.get_color_sdl()
***************
*** 158,170 ****
              self.label = Label(text)
              self.label.set_parent(self)
-             # These values can also be maipulated by the user through
-             # get_font and set_font functions.
-             self.label.set_font( config.OSD_DEFAULT_FONTNAME,
-                                  config.OSD_DEFAULT_FONTSIZE )
              # XXX Set the background color to none so it is transparent.
              self.label.set_background_color(None)
              self.label.set_h_margin(self.h_margin)
              self.label.set_v_margin(self.v_margin)
-             self.label.set_h_align(Align.CENTER)
          else:
              self.label.set_text(text)
--- 203,210 ----
***************
*** 181,185 ****
  
  
!     def set_font(self, file, size):
          """
          Set the font.
--- 221,225 ----
  
  
!     def set_font(self, file, size, color):
          """
          Set the font.
***************
*** 188,192 ****
          """
          if self.label:
!             self.label.set_font(file, size)
          else:
              raise TypeError, file
--- 228,232 ----
          """
          if self.label:
!             self.label.set_font(file, size, color)
          else:
              raise TypeError, file

Index: ConfirmBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/ConfirmBox.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ConfirmBox.py       24 Feb 2003 12:14:57 -0000      1.2
--- ConfirmBox.py       5 Mar 2003 03:53:34 -0000       1.3
***************
*** 11,14 ****
--- 11,21 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 12:14:57  rshortt
  # Removed more unneeded self.parent.refresh() calls.
***************
*** 71,119 ****
      """
  
!     def __init__(self, text, handler=None, icon=None, left=None, top=None, 
!                  width=None, height=None, bg_color=None, fg_color=None, 
!                  border=None, bd_color=None, bd_width=None):
! 
!         PopupBox.__init__(self)
  
!         self.text     = text
!         self.handler  = handler
!         self.icon     = icon
!         self.border   = border
!         self.label    = None
!         self.h_margin = 10
!         self.v_margin = 10
!         self.bd_color = bd_color
!         self.bd_width = bd_width
!         self.width    = width
!         self.height   = height
!         self.left     = left
!         self.top      = top
!         self.bg_color = bg_color
!         self.fg_color = fg_color
  
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly. self.skin is set in the superclass.
  
-         if not self.width:    self.width  = 300
-         if not self.height:   self.height = 160
-         if not self.left:     self.left   = self.osd.width/2 - self.width/2
-         if not self.top:      self.top    = self.osd.height/2 - self.height/2
-         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
-         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
-         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
-         if not self.bd_width: self.bd_width = 2
-         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
-                                                    self.bd_color, self.bd_width)
-         
-         if type(text) is StringType:
-             if text: self.set_text(text)
-         elif not text:
-             self.text = None
-         else:
-             raise TypeError, text
-         
-         if icon:
-             self.set_icon(icon)
  
          self.set_v_align(Align.NONE)
--- 78,90 ----
      """
  
!     def __init__(self, text=" ", handler=None, left=None, top=None, 
!                  width=300, height=160, bg_color=None, fg_color=None, 
!                  icon=None, border=None, bd_color=None, bd_width=None):
  
!         self.handler = handler
  
!         PopupBox.__init__(self, text, left, top, width, height, bg_color, 
!                           fg_color, icon, border, bd_color, bd_width)
  
  
          self.set_v_align(Align.NONE)
***************
*** 150,154 ****
              self.b1.toggle_selected()
              self.b2.toggle_selected()
!             self.osd.update()
              return
          elif event == self.rc.ENTER or event == self.rc.SELECT:
--- 121,126 ----
              self.b1.toggle_selected()
              self.b2.toggle_selected()
!             self._draw()
!             self.osd.update(self.get_rect())
              return
          elif event == self.rc.ENTER or event == self.rc.SELECT:

Index: GUIObject.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/GUIObject.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** GUIObject.py        3 Mar 2003 00:41:41 -0000       1.7
--- GUIObject.py        5 Mar 2003 03:53:34 -0000       1.8
***************
*** 8,11 ****
--- 8,18 ----
  #-----------------------------------------------------------------------
  # $Log$
+ # Revision 1.8  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.7  2003/03/03 00:41:41  rshortt
  # show() now updates its own area
***************
*** 106,109 ****
--- 113,117 ----
  
  
+ import pygame
  import rc
  import osd
***************
*** 124,128 ****
  
  
!     def __init__(self, left=None, top=None, width=None, height=None,
                   bg_color=None, fg_color=None):
  
--- 132,136 ----
  
  
!     def __init__(self, left=0, top=0, width=0, height=0,
                   bg_color=None, fg_color=None):
  
***************
*** 346,350 ****
          else:
              self.selected = 1
!         self._draw()
  
  
--- 354,361 ----
          else:
              self.selected = 1
!         # I just figured out that we do not always want to
!         # draw here.  If a child gets drawn before the parent
!         # its bg_surface will be wrong!
!         # self._draw()
  
  
***************
*** 400,406 ****
  
      def destroy(self):
          if DEBUG: print 'GUIObject.destroy(): %s' % self
          if self.parent:
!             self.parent.children.remove(self)
              if self.osd.focused_app == self:
                  if DEBUG: print 'GUIObject.destroy(): focused_app=%s' % \
--- 411,422 ----
  
      def destroy(self):
+         if DEBUG:
+             if self.bg_image:
+                 iname = '/tmp/bg-%s-%s.bmp' % (self.left, self.top)
+                 pygame.image.save( self.bg_image, iname )
+ 
          if DEBUG: print 'GUIObject.destroy(): %s' % self
          if self.parent:
!             # self.parent.children.remove(self)
              if self.osd.focused_app == self:
                  if DEBUG: print 'GUIObject.destroy(): focused_app=%s' % \
***************
*** 409,413 ****
                  if DEBUG: print 'GUIObject.destroy(): focused_app=%s' % \
                                   self.osd.focused_app
!             self.parent.refresh()
          if self.children:
              for child in self.children:
--- 425,430 ----
                  if DEBUG: print 'GUIObject.destroy(): focused_app=%s' % \
                                   self.osd.focused_app
!             # We shouldn't need to call this if we replace the bg right
!             # self.parent.refresh()
          if self.children:
              for child in self.children:

Index: InputBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/InputBox.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** InputBox.py 24 Feb 2003 12:14:57 -0000      1.2
--- InputBox.py 5 Mar 2003 03:53:34 -0000       1.3
***************
*** 11,14 ****
--- 11,21 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 12:14:57  rshortt
  # Removed more unneeded self.parent.refresh() calls.
***************
*** 73,121 ****
  
          
!     def __init__(self, text, handler=None, icon=None, left=None, top=None, 
!                  width=None, height=None, bg_color=None, fg_color=None, 
!                  border=None, bd_color=None, bd_width=None):
! 
!         PopupBox.__init__(self)
! 
!         self.text     = text
!         self.handler  = handler
!         self.icon     = icon
!         self.border   = border
!         self.label    = None
!         self.h_margin = 10
!         self.v_margin = 10
!         self.bd_color = bd_color
!         self.bd_width = bd_width
!         self.width    = width
!         self.height   = height
!         self.left     = left
!         self.top      = top
!         self.bg_color = bg_color
!         self.fg_color = fg_color
  
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly.  self.skin is set in the superclass.
  
!         if not self.width:    self.width  = 300
!         if not self.height:   self.height = 160
!         if not self.left:     self.left   = self.osd.width/2 - self.width/2
!         if not self.top:      self.top    = self.osd.height/2 - self.height/2
!         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
!         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
!         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
!         if not self.bd_width: self.bd_width = 2
!         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
!                                                    self.bd_color, self.bd_width)
  
-         if type(text) is StringType:
-             if text: self.set_text(text)
-         elif not text:
-             self.text = None
-         else:
-             raise TypeError, text
-         
-         if icon:
-             self.set_icon(icon)
  
          self.set_v_align(Align.NONE)
--- 80,92 ----
  
          
!     def __init__(self, text=" ", handler=None, left=None, top=None, 
!                  width=300, height=160, bg_color=None, fg_color=None, 
!                  icon=None, border=None, bd_color=None, bd_width=None):
  
!         self.handler = handler
  
!         PopupBox.__init__(self, text, left, top, width, height, bg_color, 
!                           fg_color, icon, border, bd_color, bd_width)
  
  
          self.set_v_align(Align.NONE)
***************
*** 135,144 ****
          if event == self.rc.LEFT:
              self.lbg.change_selected_box('left')
!             self._draw()
              self.osd.update()
              return
          elif event == self.rc.RIGHT:
              self.lbg.change_selected_box('right')
!             self._draw()
              self.osd.update()
              return
--- 106,115 ----
          if event == self.rc.LEFT:
              self.lbg.change_selected_box('left')
!             # self._draw()
              self.osd.update()
              return
          elif event == self.rc.RIGHT:
              self.lbg.change_selected_box('right')
!             # self._draw()
              self.osd.update()
              return
***************
*** 149,158 ****
          elif event == self.rc.UP:
              self.lbg.get_selected_box().charUp()
!             self._draw()
              self.osd.update()
              return
          elif event == self.rc.DOWN:
              self.lbg.get_selected_box().charDown()
!             self._draw()
              self.osd.update()
              return
--- 120,129 ----
          elif event == self.rc.UP:
              self.lbg.get_selected_box().charUp()
!             # self._draw()
              self.osd.update()
              return
          elif event == self.rc.DOWN:
              self.lbg.get_selected_box().charDown()
!             # self._draw()
              self.osd.update()
              return
***************
*** 161,165 ****
                self.rc.K0].count(event) > 0:
              self.lbg.get_selected_box().cycle_phone_char(event)
!             self._draw()
              self.osd.update()
              # a,b,c,d = self.lbg.get_selected_box().get_rect()
--- 132,136 ----
                self.rc.K0].count(event) > 0:
              self.lbg.get_selected_box().cycle_phone_char(event)
!             # self._draw()
              self.osd.update()
              # a,b,c,d = self.lbg.get_selected_box().get_rect()

Index: LetterBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/LetterBox.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LetterBox.py        18 Feb 2003 13:40:53 -0000      1.1
--- LetterBox.py        5 Mar 2003 03:53:34 -0000       1.2
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.2  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.1  2003/02/18 13:40:53  rshortt
  # Reviving the src/gui code, allso adding some new GUI objects.  Event
***************
*** 141,144 ****
--- 148,152 ----
  
          self.set_text(self.ourChars[charNext])
+         self._draw()
  
  
***************
*** 151,154 ****
--- 159,163 ----
  
          self.set_text(self.ourChars[charNext])
+         self._draw()
  
  
***************
*** 171,175 ****
              self.set_text(letters[i])
  
!         # self._draw()
          # self.osd.update_area(self.get_rect())
  
--- 180,184 ----
              self.set_text(letters[i])
  
!         self._draw()
          # self.osd.update_area(self.get_rect())
  

Index: LetterBoxGroup.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/LetterBoxGroup.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** LetterBoxGroup.py   18 Feb 2003 13:40:53 -0000      1.1
--- LetterBoxGroup.py   5 Mar 2003 03:53:34 -0000       1.2
***************
*** 11,14 ****
--- 11,21 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.2  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.1  2003/02/18 13:40:53  rshortt
  # Reviving the src/gui code, allso adding some new GUI objects.  Event
***************
*** 149,153 ****
--- 156,162 ----
  
          self.boxes[boxNow].toggle_selected()
+         self.boxes[boxNow]._draw()
          self.boxes[boxNext].toggle_selected()
+         self.boxes[boxNext]._draw()
  
  

Index: ListBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/ListBox.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ListBox.py  24 Feb 2003 11:58:28 -0000      1.3
--- ListBox.py  5 Mar 2003 03:53:34 -0000       1.4
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.4  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.3  2003/02/24 11:58:28  rshortt
  # Adding OptionBox and optiondemo.  Also some minor cleaning in a few other
***************
*** 80,109 ****
  
      
!     def __init__(self, items=None, left=None, top=None, width=None, height=None, 
                   bg_color=None, fg_color=None, selected_bg_color=None,
                   selected_fg_color=None, border=None, bd_color=None, 
                   bd_width=None, show_h_scrollbar=None, show_v_scrollbar=None):
  
! 
!         self.border         = border
!         self.items          = items
!         self.h_margin       = 2
!         self.v_margin       = 2
!         self.bg_color       = bg_color
!         self.fg_color       = fg_color
!         self.bd_color       = bd_color
!         self.bd_width       = bd_width
!         self.width          = width
!         self.height         = height
!         self.left           = left
!         self.top            = top
!         self.selected_bg_color = selected_bg_color
          self.selected_fg_color = selected_fg_color
!         self.show_h_scrollbar = show_h_scrollbar
!         self.show_v_scrollbar = show_v_scrollbar
  
-         if not self.width:    self.width  = 100
-         if not self.height:   self.height = 200
-         if not self.items:    self.items  = []
  
          if self.show_h_scrollbar != 0 and not self.show_h_scrollbar:
--- 87,148 ----
  
      
!     def __init__(self, items=None, left=None, top=None, width=100, height=200, 
                   bg_color=None, fg_color=None, selected_bg_color=None,
                   selected_fg_color=None, border=None, bd_color=None, 
                   bd_width=None, show_h_scrollbar=None, show_v_scrollbar=None):
  
!         self.items             = items
!         self.width             = width
!         self.height            = height
!         self.border            = border
!         self.bd_color          = bd_color
!         self.bd_width          = bd_width
!         self.bg_color          = bg_color
!         self.fg_color          = fg_color
          self.selected_fg_color = selected_fg_color
!         self.selected_bg_color = selected_bg_color
!         self.show_h_scrollbar  = show_h_scrollbar
!         self.show_v_scrollbar  = show_v_scrollbar
! 
! 
!         self.set_surface(pygame.Surface(self.get_size(), 0, 32))
! 
!         self.skin = skin.get_singleton()
!         self.osd  = osd.get_singleton()
!     
!         (BLAH, BLAH, BLAH, BLAH,
!          button_default, button_selected) = \
!          self.skin.GetPopupBoxStyle()
!     
!         # I am commenting a lot of this out until I get alpha
!         # transparencies working correctly.
!         if not self.bg_color:
!             self.bg_color = Color(self.osd.default_bg_color)
!             # if button_default.rectangle.bgcolor:
!             #     self.bg_color = Color(button_default.rectangle.bgcolor)
!             # else:
!             #     self.bg_color = Color(self.osd.default_bg_color)
! 
!         if not self.fg_color:
!             self.fg_color = Color(self.osd.default_fg_color)
!             # if button_default.font.color:
!             #     self.fg_color = Color(button_default.font.color)
!             # else:
!             #     self.fg_color = Color(self.osd.default_fg_color)
! 
!         if not self.selected_bg_color:
!             self.selected_bg_color = Color((0,255,0,128))
!             # if button_selected.rectangle.bgcolor:
!             #     self.selected_bg_color = Color(button_selected.rectangle.bgcolor)
!             # else:
!             #     self.selected_bg_color = Color((0,255,0,128))
! 
!         if not self.selected_fg_color:
!             self.fg_color = Color(self.osd.default_fg_color)
!             # if button_selected.font.color:
!             #     self.selected_fg_color = Color(button_selected.font.color)
!             # else:
!             #     self.selected_fg_color = Color(self.osd.default_fg_color)
  
  
          if self.show_h_scrollbar != 0 and not self.show_h_scrollbar:
***************
*** 112,132 ****
              self.show_v_scrollbar = 1
  
!         self.set_surface(pygame.Surface(self.get_size(), 0, 32))
  
-         RegionScroller.__init__(self, self.surface, self.left, self.top, self.width,
-                                 self.height, self.border, self.bd_color,
-                                 self.bd_width, self.show_h_scrollbar,
-                                 self.show_v_scrollbar)
  
!         if not self.bg_color: Color(self.osd.default_bg_color)
!         if not self.fg_color: Color(self.osd.default_fg_color)
!         if not self.selected_fg_color: self.selected_fg_color = self.fg_color
!         if not self.selected_bg_color: self.selected_bg_color = Color((0,255,0,128))
  
          if self.items: self.set_items(self.items)
  
-         self.x_scroll_interval = 25
-         self.y_scroll_interval = 25
- 
  
      def scroll(self, direction):
--- 151,168 ----
              self.show_v_scrollbar = 1
  
!         RegionScroller.__init__(self, self.surface, left, top, self.width, 
!                                 self.height, self.bg_color, self.fg_color,
!                                 border, bd_color, bd_width,
!                                 self.show_h_scrollbar, self.show_v_scrollbar)
  
  
!         self.h_margin                 = 2
!         self.v_margin                 = 2
!         self.x_scroll_interval        = 25
!         self.y_scroll_interval        = 25
!         if not self.items: self.items = []
  
          if self.items: self.set_items(self.items)
  
  
      def scroll(self, direction):
***************
*** 244,248 ****
  
          """
!         if self.is_visible() == 0: return
  
          if not self.width or not self.height or not self.surface:
--- 280,284 ----
  
          """
!         # if self.is_visible() == 0: return
  
          if not self.width or not self.height or not self.surface:

Index: PopupBox.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/PopupBox.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PopupBox.py 2 Mar 2003 20:15:41 -0000       1.5
--- PopupBox.py 5 Mar 2003 03:53:34 -0000       1.6
***************
*** 11,14 ****
--- 11,21 ----
  #-----------------------------------------------------------------------
  # $Log$
+ # Revision 1.6  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.5  2003/03/02 20:15:41  rshortt
  # GUIObject and PopupBox now get skin settings from the new skin.  I put
***************
*** 307,311 ****
--- 314,325 ----
          c   = self.bg_color.get_color_sdl()
          a   = self.bg_color.get_alpha()
+         # if self.bg_surface:
+         #     print 'PB: have bg_surface'
+         #     box = self.bg_surface
+         #     self.osd.putsurface(self.bg_surface, self.left, self.top)
+         # else:
+         #     print 'PB: no bg_surface'
          box = pygame.Surface(self.get_size(), 0, 32)
+ 
          box.fill(c)
          box.set_alpha(a)

Index: RegionScroller.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/RegionScroller.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RegionScroller.py   24 Feb 2003 11:58:28 -0000      1.4
--- RegionScroller.py   5 Mar 2003 03:53:34 -0000       1.5
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.5  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.4  2003/02/24 11:58:28  rshortt
  # Adding OptionBox and optiondemo.  Also some minor cleaning in a few other
***************
*** 80,123 ****
  
      
!     def __init__(self, surface=None, left=None, top=None, width=None, 
!                  height=None, border=None, bd_color=None, bd_width=None, 
!                  show_h_scrollbar=None, show_v_scrollbar=None):
! 
!         GUIObject.__init__(self)
  
!         self.surface        = surface
!         self.border         = border
!         self.h_margin       = 2
!         self.v_margin       = 2
!         self.bd_color       = bd_color
!         self.bd_width       = bd_width
!         self.width          = width
!         self.height         = height
!         self.left           = left
!         self.top            = top
          self.show_h_scrollbar = show_h_scrollbar
          self.show_v_scrollbar = show_v_scrollbar
  
  
-         # XXX: Place a call to the skin object here then set the defaults
-         #      acodringly. self.skin is set in the superclass.
  
!         if not self.width:    self.width  = 300
!         if not self.height:   self.height = 160
!         if not self.left:     self.left   = -100
!         if not self.top:      self.top    = -100
!         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
!         if not self.bd_width: self.bd_width = 2
!         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
!                                                    self.bd_color, self.bd_width)
!         if self.show_h_scrollbar != 0 and not self.show_h_scrollbar: 
              self.show_h_scrollbar = 1
!         if self.show_v_scrollbar != 0 and not self.show_v_scrollbar: 
              self.show_v_scrollbar = 1
  
-         self.set_surface(surface)
  
          self.x_scroll_interval = 25
          self.y_scroll_interval = 25
  
          self.v_scrollbar = Scrollbar(self, 'vertical')
--- 87,142 ----
  
      
!     def __init__(self, surface=None, left=None, top=None, width=300, 
!                  height=160, bg_color=None, fg_color=None, border=None, 
!                  bd_color=None, bd_width=None, show_h_scrollbar=None, 
!                  show_v_scrollbar=None):
  
!         self.surface          = surface
!         self.border           = border
!         self.bd_color         = bd_color
!         self.bd_width         = bd_width
!         self.bg_color         = bg_color
!         self.fg_color         = fg_color
          self.show_h_scrollbar = show_h_scrollbar
          self.show_v_scrollbar = show_v_scrollbar
  
+         GUIObject.__init__(self, left, top, width, height,
+                            self.bg_color, self.fg_color)
  
  
!         self.skin = skin.get_singleton()
! 
!         (BLAH, BLAH, BLAH, BLAH,
!          button_default, BLAH) = self.skin.GetPopupBoxStyle()
! 
!         if not self.bd_color: 
!             if button_default.rectangle.color:
!                 self.bd_color = Color(button_default.rectangle.color)
!             else:
!                 self.bd_color = Color(self.osd.default_fg_color)
! 
!         if not self.bd_width: 
!             if button_default.rectangle.size:
!                 self.bd_width = button_default.rectangle.size
!             else:
!                 self.bd_width = 2
! 
!         if not self.border:   
!             self.border = Border(self, Border.BORDER_FLAT,
!                                  self.bd_color, self.bd_width)
! 
! 
!         if self.show_h_scrollbar != 0 and not self.show_h_scrollbar:
              self.show_h_scrollbar = 1
!         if self.show_v_scrollbar != 0 and not self.show_v_scrollbar:
              self.show_v_scrollbar = 1
  
  
+         self.set_surface(surface)
          self.x_scroll_interval = 25
          self.y_scroll_interval = 25
+         self.h_margin = 2
+         self.v_margin = 2
+ 
  
          self.v_scrollbar = Scrollbar(self, 'vertical')

Index: ZIndexRenderer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/ZIndexRenderer.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ZIndexRenderer.py   3 Mar 2003 00:43:34 -0000       1.5
--- ZIndexRenderer.py   5 Mar 2003 03:53:34 -0000       1.6
***************
*** 7,10 ****
--- 7,17 ----
  #-----------------------------------------------------------------------
  # $Log$
+ # Revision 1.6  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.5  2003/03/03 00:43:34  rshortt
  # DEBUG shouldn't be set to 1 automaticly since I write a bmp to /tmp
***************
*** 189,192 ****
--- 196,206 ----
                  if o.bg_surface:
                      osd.putsurface(o.bg_surface, o.left, o.top)
+                     osd.update()
+                     if DEBUG:
+                         o.bg_image = o.bg_surface.convert()
+                         iname = '/tmp/last-hide.bmp' 
+                         pygame.image.save( o.bg_image, iname )
+                         iname = '/tmp/last-screen.bmp' 
+                         pygame.image.save( osd.screen.convert(), iname )
  
  

Index: listboxdemo.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/listboxdemo.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** listboxdemo.py      24 Feb 2003 12:14:57 -0000      1.2
--- listboxdemo.py      5 Mar 2003 03:53:34 -0000       1.3
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 12:14:57  rshortt
  # Removed more unneeded self.parent.refresh() calls.
***************
*** 69,116 ****
      """
  
!     def __init__(self, text, icon=None, left=None, top=None, width=None, 
!                  height=None, bg_color=None, fg_color=None, border=None, 
!                  bd_color=None, bd_width=None):
! 
!         PopupBox.__init__(self)
! 
!         self.text     = text
!         self.icon     = icon
!         self.border   = border
!         self.label    = None
!         self.h_margin = 10
!         self.v_margin = 10
!         self.bd_color = bd_color
!         self.bd_width = bd_width
!         self.width    = width
!         self.height   = height
!         self.left     = left
!         self.top      = top
!         self.bg_color = bg_color
!         self.fg_color = fg_color
  
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly. self.skin is set in the superclass.
  
-         if not self.width:    self.width  = 500
-         if not self.height:   self.height = 350
-         if not self.left:     self.left   = self.osd.width/2 - self.width/2
-         if not self.top:      self.top    = self.osd.height/2 - self.height/2
-         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
-         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
-         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
-         if not self.bd_width: self.bd_width = 2
-         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
-                                                    self.bd_color, self.bd_width)
-         
-         if type(text) is StringType:
-             if text: self.set_text(text)
-         elif not text:
-             self.text = None
-         else:
-             raise TypeError, text
-         
-         if icon:
-             self.set_icon(icon)
  
          self.set_h_align(Align.CENTER)
--- 76,86 ----
      """
  
!     def __init__(self, text=" ", left=None, top=None, width=500, 
!                  height=350, bg_color=None, fg_color=None, icon=None,
!                  border=None, bd_color=None, bd_width=None):
  
!         PopupBox.__init__(self, text, left, top, width, height, bg_color, 
!                           fg_color, icon, border, bd_color, bd_width)
  
  
          self.set_h_align(Align.CENTER)

Index: optiondemo.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/optiondemo.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** optiondemo.py       24 Feb 2003 12:10:24 -0000      1.2
--- optiondemo.py       5 Mar 2003 03:53:34 -0000       1.3
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 12:10:24  rshortt
  # Fixed a bug where a popup would reapear after it was disposed of since its
***************
*** 71,120 ****
      """
  
!     def __init__(self, text, icon=None, left=None, top=None, width=None, 
!                  height=None, bg_color=None, fg_color=None, border=None, 
!                  bd_color=None, bd_width=None):
! 
!         PopupBox.__init__(self)
! 
!         self.text     = text
!         self.icon     = icon
!         self.border   = border
!         self.label    = None
!         self.h_margin = 10
!         self.v_margin = 10
!         self.bd_color = bd_color
!         self.bd_width = bd_width
!         self.width    = width
!         self.height   = height
!         self.left     = left
!         self.top      = top
!         self.bg_color = bg_color
!         self.fg_color = fg_color
! 
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly. self.skin is set in the superclass.
  
!         if not self.width:    self.width  = 500
!         if not self.height:   self.height = 350
!         if not self.left:     self.left   = self.osd.width/2 - self.width/2
!         if not self.top:      self.top    = self.osd.height/2 - self.height/2
!         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
!         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
!         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
!         if not self.bd_width: self.bd_width = 2
!         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
!                                                    self.bd_color, self.bd_width)
!         
!         if type(text) is StringType:
!             if text: self.set_text(text)
!         elif not text:
!             self.text = None
!         else:
!             raise TypeError, text
!         
!         if icon:
!             self.set_icon(icon)
  
-         self.set_h_align(Align.CENTER)
  
          self.label.top = self.top + 25
--- 78,88 ----
      """
  
!     def __init__(self, text=" ", left=None, top=None, width=500, 
!                  height=350, bg_color=None, fg_color=None, icon=None,
!                  border=None, bd_color=None, bd_width=None):
  
!         PopupBox.__init__(self, text, left, top, width, height, bg_color, 
!                           fg_color, icon, border, bd_color, bd_width)
  
  
          self.label.top = self.top + 25

Index: scrolldemo.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/scrolldemo.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** scrolldemo.py       24 Feb 2003 12:14:57 -0000      1.2
--- scrolldemo.py       5 Mar 2003 03:53:34 -0000       1.3
***************
*** 10,13 ****
--- 10,20 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.3  2003/03/05 03:53:34  rshortt
+ # More work hooking skin properties into the GUI objects, and also making
+ # better use of OOP.
+ #
+ # ListBox and others are working again, although I have a nasty bug regarding
+ # alpha transparencies and the new skin.
+ #
  # Revision 1.2  2003/02/24 12:14:57  rshortt
  # Removed more unneeded self.parent.refresh() calls.
***************
*** 68,115 ****
      """
  
!     def __init__(self, text, icon=None, left=None, top=None, width=None, 
!                  height=None, bg_color=None, fg_color=None, border=None, 
!                  bd_color=None, bd_width=None):
! 
!         PopupBox.__init__(self)
! 
!         self.text     = text
!         self.icon     = icon
!         self.border   = border
!         self.label    = None
!         self.h_margin = 10
!         self.v_margin = 10
!         self.bd_color = bd_color
!         self.bd_width = bd_width
!         self.width    = width
!         self.height   = height
!         self.left     = left
!         self.top      = top
!         self.bg_color = bg_color
!         self.fg_color = fg_color
  
!         # XXX: Place a call to the skin object here then set the defaults
!         #      acodringly. self.skin is set in the superclass.
  
-         if not self.width:    self.width  = 500
-         if not self.height:   self.height = 350
-         if not self.left:     self.left   = self.osd.width/2 - self.width/2
-         if not self.top:      self.top    = self.osd.height/2 - self.height/2
-         if not self.bg_color: self.bg_color = Color(self.osd.default_bg_color)
-         if not self.fg_color: self.fg_color = Color(self.osd.default_fg_color)
-         if not self.bd_color: self.bd_color = Color(self.osd.default_fg_color) 
-         if not self.bd_width: self.bd_width = 2
-         if not self.border:   self.border = Border(self, Border.BORDER_FLAT, 
-                                                    self.bd_color, self.bd_width)
-         
-         if type(text) is StringType:
-             if text: self.set_text(text)
-         elif not text:
-             self.text = None
-         else:
-             raise TypeError, text
-         
-         if icon:
-             self.set_icon(icon)
  
          self.set_h_align(Align.CENTER)
--- 75,85 ----
      """
  
!     def __init__(self, text=" ", left=None, top=None, width=500, 
!                  height=350, bg_color=None, fg_color=None, icon=None,
!                  border=None, bd_color=None, bd_width=None):
  
!         PopupBox.__init__(self, text, left, top, width, height, bg_color, 
!                           fg_color, icon, border, bd_color, bd_width)
  
  
          self.set_h_align(Align.CENTER)




-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to