commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8731 - trunk/gnue-forms/src/GFObjects


From: reinhard
Subject: [gnue] r8731 - trunk/gnue-forms/src/GFObjects
Date: Tue, 10 Oct 2006 13:10:16 -0500 (CDT)

Author: reinhard
Date: 2006-10-10 13:10:16 -0500 (Tue, 10 Oct 2006)
New Revision: 8731

Modified:
   trunk/gnue-forms/src/GFObjects/GFGrid.py
   trunk/gnue-forms/src/GFObjects/GFGridLine.py
   trunk/gnue-forms/src/GFObjects/GFTabStop.py
Log:
More direct and straightforward handling of filling new rows with data when a
grid is resized.


Modified: trunk/gnue-forms/src/GFObjects/GFGrid.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFGrid.py    2006-10-10 16:52:51 UTC (rev 
8730)
+++ trunk/gnue-forms/src/GFObjects/GFGrid.py    2006-10-10 18:10:16 UTC (rev 
8731)
@@ -24,7 +24,8 @@
 Logical box support
 """
 
-from GFContainer import GFContainer
+from gnue.forms.GFObjects.GFTabStop import GFTabStop
+from gnue.forms.GFObjects.GFContainer import GFContainer
 
 __all__ = ['GFGrid']
 
@@ -76,9 +77,6 @@
         self.__rows = new_rows
         self.walk(self.__rows_walker)
         self._block._event_rows_changed(new_rows)
-        if new_rows > old_rows:
-            # Fill up new rows
-            self._form.refreshDisplay(self)
 
 
     # -------------------------------------------------------------------------
@@ -86,5 +84,5 @@
     # -------------------------------------------------------------------------
 
     def __rows_walker(self, item):
-        if item != self:
-            item._rows = self.__rows
+        if item is not self:
+            item.rows_changed(self.__rows)

Modified: trunk/gnue-forms/src/GFObjects/GFGridLine.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFGridLine.py        2006-10-10 16:52:51 UTC 
(rev 8730)
+++ trunk/gnue-forms/src/GFObjects/GFGridLine.py        2006-10-10 18:10:16 UTC 
(rev 8731)
@@ -46,3 +46,11 @@
 
     def __init__(self, parent=None):
         GFContainer.__init__(self, parent, "GFGridLine")
+
+    # -------------------------------------------------------------------------
+    # Number of rows has changed
+    # -------------------------------------------------------------------------
+
+    def rows_changed(self, new_rows):
+
+        self._rows = new_rows

Modified: trunk/gnue-forms/src/GFObjects/GFTabStop.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-10-10 16:52:51 UTC (rev 
8730)
+++ trunk/gnue-forms/src/GFObjects/GFTabStop.py 2006-10-10 18:10:16 UTC (rev 
8731)
@@ -114,6 +114,26 @@
 
 
     # -------------------------------------------------------------------------
+    # Number of rows of this widgets has changed
+    # -------------------------------------------------------------------------
+
+    def rows_changed(self, new_rows):
+        """
+        Notify the widget that the number of visible rows has changed.
+
+        This can happen if this widget is part of a grid that has been resized.
+
+        This function takes care about filling the new rows with data.
+        """
+
+        old_rows = self._rows
+        self._rows = new_rows
+
+        if new_rows > old_rows:
+            self.refresh_ui(old_rows, new_rows - 1)
+
+
+    # -------------------------------------------------------------------------
     # Recalculate the visible index of an object
     # -------------------------------------------------------------------------
 
@@ -248,7 +268,8 @@
 
         for index in range (from_index, to_index + 1):
             # Do not execute if we were editing - would overwrite unsaved 
change
-            if not self._displayHandler.editing:
+            if not (index == self._visibleIndex \
+                    and self._displayHandler.editing):
                 value = self._field.getValue(index - self._visibleIndex)
                 display = self._displayHandler.getDisplayFiller(value)
                 self.uiWidget._ui_set_value_(index, display)





reply via email to

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