commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8552 - trunk/gnue-forms/src


From: reinhard
Subject: [gnue] r8552 - trunk/gnue-forms/src
Date: Tue, 8 Aug 2006 15:10:37 -0500 (CDT)

Author: reinhard
Date: 2006-08-08 15:10:36 -0500 (Tue, 08 Aug 2006)
New Revision: 8552

Modified:
   trunk/gnue-forms/src/GFForm.py
Log:
Fixed behaviour for forms where first (or even only) control is a button.

issue111 testing


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2006-08-08 18:59:06 UTC (rev 8551)
+++ trunk/gnue-forms/src/GFForm.py      2006-08-08 20:10:36 UTC (rev 8552)
@@ -340,7 +340,10 @@
     # -------------------------------------------------------------------------
 
     def __trigger_get_current_block_name(self):
-        return self._currentBlock.name
+        if self._currentBlock is not None:
+            return self._currentBlock.name
+        else:
+            return None
 
     # -------------------------------------------------------------------------
 
@@ -632,7 +635,7 @@
 
     def update_record_status(self):
 
-        if self._currentBlock:
+        if self._currentBlock is not None:
             if self._currentBlock._resultSet.current.isDeleted():
                 status = 'DEL'
             elif self._currentBlock._resultSet.current.isPending():
@@ -657,7 +660,7 @@
 
     def update_record_counter(self):
 
-        if self._currentBlock:
+        if self._currentBlock is not None:
             self.__update_status(
                     record_number=self._currentBlock._currentRecord+1,
                     record_count=self._currentBlock._recordCount)
@@ -766,7 +769,7 @@
         Returns the editing mode of the current record
         @return: 'query', 'new' or 'edit'
         """
-        if self._currentBlock:
+        if self._currentBlock is not None:
             if self._currentBlock.mode == 'query':
                 return 'query'
             elif self._currentBlock.isEmpty():
@@ -952,8 +955,8 @@
         """
         Creates a new, empty record.
         """
-        if not self.readonly:
-          self._currentBlock.newRecord()
+        if not self.readonly and self._currentBlock is not None:
+            self._currentBlock.newRecord()
 
 
     # -------------------------------------------------------------------------
@@ -964,9 +967,9 @@
         """
         Deletes the actual record.
         """
-        if not self.readonly:
-          self._currentBlock.deleteRecord()
-          self.refreshUIEvents()
+        if not self.readonly and self._currentBlock is not None:
+            self._currentBlock.deleteRecord()
+            self.refreshUIEvents()
 
 
     # -------------------------------------------------------------------------
@@ -977,9 +980,9 @@
         """
         Undeletes the actual record.
         """
-        if not self.readonly:
-          self._currentBlock.undeleteRecord()
-          self.refreshUIEvents()
+        if not self.readonly and self._currentBlock is not None:
+            self._currentBlock.undeleteRecord()
+            self.refreshUIEvents()
 
 
     # -------------------------------------------------------------------------
@@ -1022,6 +1025,9 @@
         """
         Enters the form into Query mode.
         """
+        if self._currentBlock is None:
+            return
+
         if self._currentBlock.mode != 'query':
 
           # Auto-commit?
@@ -1074,6 +1080,9 @@
         Copies the Query, ie brings back conditions from the last query.
         @return: None
         """
+        if self._currentBlock is None:
+            return
+
         if self._currentBlock.mode != 'query':
           self.initQuery()
 
@@ -1095,6 +1104,9 @@
         Runs the query.
         @return: None if all went well, error message if there was an error
         """
+        if self._currentBlock is None:
+            return
+
         if self._currentBlock.mode != 'query':
           return _("Form not in query mode")
 
@@ -1469,12 +1481,25 @@
         Signals the UI drivers of navigation button relevance.
         @return: None
         """
+
         block = self._currentBlock
+        dispatchEvent = self.dispatchEvent
         if not block:
-          assert gDebug(5,'No current block - cannot refresh UI')
+          # No current block - for example a form with only buttons on it
+          dispatchEvent('cannotCANCELQUERY')
+          dispatchEvent('cannotEXECQUERY')
+          dispatchEvent('cannotENTERQUERY')
+          dispatchEvent('cannotPREVRECORD')
+          dispatchEvent('cannotFIRSTRECORD')
+          dispatchEvent('cannotNEXTRECORD')
+          dispatchEvent('cannotLASTRECORD')
+          dispatchEvent('cannotCOMMIT')
+          dispatchEvent('cannotROLLBACK')
+          dispatchEvent('cannotJUMPPROMPT')
+          dispatchEvent('cannotNEWRECORD')
+          dispatchEvent('cannotMARKFORDELETE')
           return
 
-        dispatchEvent = self.dispatchEvent
         if block.mode == 'query':
           dispatchEvent('canCANCELQUERY')
           dispatchEvent('canEXECQUERY')
@@ -1705,8 +1730,9 @@
 
         self.processTrigger('Pre-Exit', ignoreAbort = False)
 
-        if self._currentBlock.autoCommit and not self.isSaved():
-            self.commit()
+        if self._currentBlock is not None:
+            if self._currentBlock.autoCommit and not self.isSaved():
+                self.commit()
 
         if not self.__must_save():
             return





reply via email to

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