commit-gnue
[Top][All Lists]
Advanced

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

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


From: reinhard
Subject: [gnue] r8650 - trunk/gnue-forms/src/GFObjects
Date: Mon, 4 Sep 2006 17:13:44 -0500 (CDT)

Author: reinhard
Date: 2006-09-04 17:13:44 -0500 (Mon, 04 Sep 2006)
New Revision: 8650

Modified:
   trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Some further cleanup.


Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-09-04 21:42:41 UTC (rev 
8649)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2006-09-04 22:13:44 UTC (rev 
8650)
@@ -77,7 +77,8 @@
     self._queryValues     = {}
     self._lastQueryValues = {}
 
-    self._scrollbars      = []
+    #: A list of all GFScrollbar objects bound to this block
+    self.__scrollbars = []
 
     # Populated by GFEntry's initialize
     self._entryList = []
@@ -247,34 +248,6 @@
 
 
   # ---------------------------------------------------------------------------
-  # Get an ordered list of focus-controls
-  # ---------------------------------------------------------------------------
-
-  def get_focus_order (self):
-
-    ctrlList = []
-    for field in self._children:
-      ctrlList += getattr (field, '_entryList', [])
-
-    return GFContainer.get_focus_order (self, ctrlList)
-
-
-  # ---------------------------------------------------------------------------
-  # Register a scrollbar widget
-  # ---------------------------------------------------------------------------
-
-  def register_scrollbar (self, widget):
-    """
-    Register a given scrollbar widget to the block. This widget will be
-    notified on record movement. It has to implement a method
-    'do_adjust_scrollbar', taking the current record and the number of records
-    as arguments.
-    """
-
-    self._scrollbars.append (widget)
-
-
-  # ---------------------------------------------------------------------------
   # Implementation of virtual methods
   # ---------------------------------------------------------------------------
 
@@ -339,6 +312,34 @@
 
 
   # ---------------------------------------------------------------------------
+  # Get an ordered list of focus-controls
+  # ---------------------------------------------------------------------------
+
+  def get_focus_order (self):
+
+    ctrlList = []
+    for field in self._children:
+      ctrlList += getattr (field, '_entryList', [])
+
+    return GFContainer.get_focus_order (self, ctrlList)
+
+
+  # ---------------------------------------------------------------------------
+  # Register a scrollbar widget
+  # ---------------------------------------------------------------------------
+
+  def register_scrollbar (self, widget):
+    """
+    Register a given scrollbar widget to the block. This widget will be
+    notified on record movement. It has to implement a method
+    'do_adjust_scrollbar', taking the current record and the number of records
+    as arguments.
+    """
+
+    self.__scrollbars.append (widget)
+
+
+  # ---------------------------------------------------------------------------
   # Event handling functions for datasource events
   # ---------------------------------------------------------------------------
 
@@ -478,6 +479,38 @@
   # Status information
   # ---------------------------------------------------------------------------
 
+  def get_record_status(self):
+        """
+        Find out about the status of the record.
+
+        The status can be one of 'empty', 'inserted', 'void', 'clean',
+        'modified', or 'deleted', or C{None} if there is no current record.
+        """
+
+        if self._resultSet is None:
+            return None
+
+        rec = self._resultSet.current
+        if rec is None:
+            return None
+
+        # try functions that do not depend on detail records first, because
+        # they are faster
+        if rec.isVoid():
+            return 'void'
+        elif rec.isDeleted():
+            return 'deleted'
+        elif rec.isEmpty():
+            return 'empty'
+        elif rec.isInserted():
+            return 'inserted'
+        elif rec.isModified():
+            return 'modified'
+        else:
+            return 'clean'
+
+  # ---------------------------------------------------------------------------
+
   def isSaved (self):
     """
     Returns True if the datasource the block is associated with is not pending
@@ -936,7 +969,7 @@
         field.processTrigger ('POST-QUERY')
 
     # Adjusting scrollbars
-    for sb in self._scrollbars:
+    for sb in self.__scrollbars:
       sb.do_adjust_scrollbar (self._currentRecord, self._recordCount)
 
 
@@ -1077,7 +1110,7 @@
     self._form.refreshUIEvents ()
 
     # Adjusting scrollbars
-    for sb in self._scrollbars:
+    for sb in self.__scrollbars:
       sb.do_adjust_scrollbar (self.__visibleStart,
           max (self._recordCount, self.__visibleStart + self._rows))
 





reply via email to

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