CVS: anygui/lib/anygui/backends genericgui.py,1.1,1.2

"Dallas T. Johnston" <[email protected]> Tue, 14 Jan 2003 02:12:44 -0800
Newsgroups gmane.comp.python.anygui.cvs
Message-ID <[email protected]>
Update of /cvsroot/anygui/anygui/lib/anygui/backends
In directory sc8-pr-cvs1:/tmp/cvs-serv15023/lib/anygui/backends

Modified Files:
	genericgui.py 
Log Message:
Not much, just playing around with genericgui comps.
By the way, have people pretty much abandoned this 
project?


Index: genericgui.py
===================================================================
RCS file: /cvsroot/anygui/anygui/lib/anygui/backends/genericgui.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** genericgui.py	23 Nov 2002 16:42:57 -0000	1.1
--- genericgui.py	14 Jan 2003 10:12:42 -0000	1.2
***************
*** 63,67 ****
         backends that do not provide the ComboBox widget in their respective
         toolkits. This also models the creation of Mega-widgets using the
!        Anygui GUI API."""
  
      _connected = 0
--- 63,67 ----
         backends that do not provide the ComboBox widget in their respective
         toolkits. This also models the creation of Mega-widgets using the
!        Anygui API."""
  
      _connected = 0
***************
*** 79,82 ****
--- 79,109 ----
      _cbxHeight = 0
  
+     def _getLbxY(self):
+         # ----------------------------------------
+         #      calculate position of listbox
+         # ----------------------------------------
+         # if the bottom of the list box is lower
+         # than the bottom of the containing window,
+         # then we will display the listbox
+         # above the textfield.
+         # note: this does not prevent clipping
+         #       of the listbox when the window
+         #       is too small to contain the entire
+         #       listbox widget
+         tmpComp = self.proxy.container
+         mainWindow = None
+         while not mainWindow:
+             if isinstance(tmpComp, anygui.Window):
+                 mainWindow = tmpComp
+             else:
+                 tmpComp = tmpComp.container
+         txtGeom = self._textFld.geometry
+         txtBtmY  = txtGeom[1] + txtGeom[3] # txtField.y + txtField.height == bottom Y
+         btmY =  txtBtmY + self._lbxHeight # bottom Y + itemLbx.height
+         if btmY > mainWindow.height:
+             return txtGeom[1] - self._lbxHeight
+         else:
+             return txtBtmY
+ 
  
      def _createWidgets(self):
***************
*** 100,104 ****
                                         items = items,
                                         geometry = ( x,
!                                                     y + height,
                                                      width,
                                                      self._lbxHeight ))
--- 127,131 ----
                                         items = items,
                                         geometry = ( x,
!                                                     y + height, #this will be set later
                                                      width,
                                                      self._lbxHeight ))
***************
*** 149,152 ****
--- 176,180 ----
          #print '>> handling Popup...'
          self._loop = 1
+         self._itemLbx.y = self._getLbxY()
          self._itemLbx.visible = self._popupOpen = not self._popupOpen
          self._loop = 0
***************
*** 210,215 ****
                                         height,
                                         height)
              self._itemLbx.geometry =  (x,
!                                        y + height,
                                         width,
                                         self._lbxHeight)
--- 238,244 ----
                                         height,
                                         height)
+ 
              self._itemLbx.geometry =  (x,
!                                        self._getLbxY(),
                                         width,
                                         self._lbxHeight)
***************
*** 362,366 ****
  
  SORT_RULES={ALPHABETICAL: cmp, DIRS_FIRST: sort_dirs_first,\
!             FILES_FIRST: sort_files_first}
  
  # == END SORT_RULES == #
--- 391,395 ----
  
  SORT_RULES={ALPHABETICAL: cmp, DIRS_FIRST: sort_dirs_first,\
!             FILES_FIRST:  sort_files_first}
  
  # == END SORT_RULES == #



-------------------------------------------------------
This SF.NET email is sponsored by: FREE  SSL Guide from Thawte
are you planning your Web Server Security? Click here to get a FREE
Thawte SSL guide and find the answers to all your  SSL security issues.
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0026en