commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8711 - in trunk/gnue-forms/src: GFObjects uidrivers/wx26/widgets


From: reinhard
Subject: [gnue] r8711 - in trunk/gnue-forms/src: GFObjects uidrivers/wx26/widgets
Date: Thu, 5 Oct 2006 07:29:56 -0500 (CDT)

Author: reinhard
Date: 2006-10-05 07:29:55 -0500 (Thu, 05 Oct 2006)
New Revision: 8711

Modified:
   trunk/gnue-forms/src/GFObjects/GFGrid.py
   trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
Log:
Moved some UI independent logic of rowcount changing in grids to GF layer.


Modified: trunk/gnue-forms/src/GFObjects/GFGrid.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFGrid.py    2006-10-05 10:17:48 UTC (rev 
8710)
+++ trunk/gnue-forms/src/GFObjects/GFGrid.py    2006-10-05 12:29:55 UTC (rev 
8711)
@@ -40,6 +40,7 @@
 
     label = None
 
+
     # -------------------------------------------------------------------------
     # Constructor
     # -------------------------------------------------------------------------
@@ -47,13 +48,37 @@
     def __init__(self, parent=None):
         GFContainer.__init__(self, parent, "GFGrid")
 
+
+    # -------------------------------------------------------------------------
+    # Initialisation
+    # -------------------------------------------------------------------------
+
     def _phase_1_init_(self):
         GFContainer._phase_1_init_(self)
 
         self._block = self.get_block()
         self.__rows = int(getattr(self, "rows", 1))
-        self.walk(self.__row_walker)
+        self.walk(self.__rows_walker)
 
-    def __row_walker(self, item):
+
+    # -------------------------------------------------------------------------
+    # UI event handlers
+    # -------------------------------------------------------------------------
+
+    def _event_rows_changed(self, new_rows):
+        """
+        Notify the grid that the number of visible rows has changed due to a
+        user interface event (the user resized the grid).
+        """
+
+        self.__rows = new_rows
+        self.walk(self.__rows_walker)
+
+
+    # -------------------------------------------------------------------------
+    # Walker function to set the "rows" property for all children
+    # -------------------------------------------------------------------------
+
+    def __rows_walker(self, item):
         if item != self:
             item._rows = self.__rows

Modified: trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py
===================================================================
--- trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2006-10-05 10:17:48 UTC 
(rev 8710)
+++ trunk/gnue-forms/src/uidrivers/wx26/widgets/grid.py 2006-10-05 12:29:55 UTC 
(rev 8711)
@@ -187,12 +187,12 @@
             # Get the diff
             if num_recs > self.__visible:
                 self.__add_new_records(num_recs - self.__visible)
-                self.walk(self.__child_rows_walker)
+                self._gfObject._event_rows_changed(self.__visible)
                 self._form.refreshDisplay(self._gfObject)
 
             elif num_recs < self.__visible:
                 self.__hide_records(self.__visible - num_recs)
-                self.walk(self.__child_rows_walker)
+                self._gfObject._event_rows_changed(self.__visible)
 
         finally:
             self._uiForm.sizing_enabled = saved
@@ -290,16 +290,9 @@
 
 
     # -------------------------------------------------------------------------
-    # Set the rows attribute for all child widgets
+    # Adjust scrollbar if the current record has changed
     # -------------------------------------------------------------------------
 
-    def __child_rows_walker(self, item):
-        
-        if item == self:
-            return
-
-        item._gfObject._rows = self.__visible
-
     def do_adjust_scrollbar(self, position, count):
         """
         Adjust the thumb-position and the number of rows of the scrollbar





reply via email to

[Prev in Thread] Current Thread [Next in Thread]