commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r9519 - in trunk/gnue-forms/src: . GFObjects input/displayHandler


From: reinhard
Subject: [gnue] r9519 - in trunk/gnue-forms/src: . GFObjects input/displayHandlers
Date: Wed, 25 Apr 2007 15:12:23 -0500 (CDT)

Author: reinhard
Date: 2007-04-25 15:12:22 -0500 (Wed, 25 Apr 2007)
New Revision: 9519

Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFObjects/GFBlock.py
   trunk/gnue-forms/src/input/displayHandlers/Cursor.py
Log:
Removed now unused can/cannot* events; renamed refreshUIEvents function to
status_changed (following PEP8).


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2007-04-25 19:57:58 UTC (rev 9518)
+++ trunk/gnue-forms/src/GFForm.py      2007-04-25 20:12:22 UTC (rev 9519)
@@ -1244,7 +1244,7 @@
         # The Focus-In trigger of the block has already refreshed the toolbar,
         # except for the case where the new entry has no block.
         if self._currentBlock is None:
-            self.refreshUIEvents()
+            self.status_changed()
 
 
     # -------------------------------------------------------------------------
@@ -1417,7 +1417,7 @@
             if not self._must_save():
                 # We must refresh the UI events now as otherwise the "init
                 # filter" button will stick in.
-                self.refreshUIEvents()
+                self.status_changed()
                 self.beginEditing()
                 return
 
@@ -1444,7 +1444,7 @@
 
         try:
             if not self._must_save():
-                self.refreshUIEvents()
+                self.status_changed()
                 self.beginEditing()
                 return
 
@@ -1790,53 +1790,20 @@
     # Signal the UI Drivers of navigation button relevance
     # -------------------------------------------------------------------------
 
-    def refreshUIEvents(self):
+    def status_changed(self):
         """
-        Signals the UI drivers of navigation button relevance.
-        @return: None
-        """
+        Notify the form of a record status change.
 
+        This function must be called whenever the status of the current block
+        has changed, or the focus has moved to another block (meaning that a
+        different block has now become the current block).
+        It calls the ON-STATUSCHANGE trigger, allowing the form to
+        enable/disable menu items and toolbar buttons depending on the current
+        status.
+        """
         self.processTrigger('On-StatusChange')
 
-        # FIXME: The rest of this method can be removed after complete
-        # migration to dynamic menus and toolbars.
-        if self._currentBlock is not None:
-            record_status = self._currentBlock.get_record_status()
-            possible_operations = self._currentBlock.get_possible_operations()
-        else:
-            record_status = None
-            possible_operations = []
 
-        dispatchEvent = self.dispatchEvent
-
-        for operation, event in (
-                ('first_record',    'FIRSTRECORD'),
-                ('prev_record',     'PREVRECORD'),
-                ('next_record',     'NEXTRECORD'),
-                ('last_record',     'LASTRECORD'),
-                ('goto_record',     'JUMPPROMPT'),
-                ('new_record',      'NEWRECORD'),
-                ('delete_record',   'MARKFORDELETE'),
-                ('undelete_record', 'UNDELETE'),
-                ('init_filter',     'ENTERQUERY'),
-                ('discard_filter',  'CANCELQUERY'),
-                ('apply_filter',    'EXECQUERY')):
-            if operation in possible_operations:
-                dispatchEvent('can' + event)
-            else:
-                dispatchEvent('cannot' + event)
-
-        if self.in_filter_mode():
-          dispatchEvent('cannotCOMMIT')
-          dispatchEvent('cannotROLLBACK')
-        else:
-          if not self.is_saved():
-            dispatchEvent('canCOMMIT')
-          else:
-            dispatchEvent('cannotCOMMIT')
-          dispatchEvent('canROLLBACK')
-
-
     # -------------------------------------------------------------------------
     # Update the status bar in the form
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py   2007-04-25 19:57:58 UTC (rev 
9518)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py   2007-04-25 20:12:22 UTC (rev 
9519)
@@ -1433,10 +1433,9 @@
                 record_count=record_count)
 
         self._form.update_record_status(record_status)
+        self._form.status_changed()
 
-        self._form.refreshUIEvents()
 
-
     # -------------------------------------------------------------------------
     # Adjust the scrollbars connected to this block
     # -------------------------------------------------------------------------

Modified: trunk/gnue-forms/src/input/displayHandlers/Cursor.py
===================================================================
--- trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-04-25 
19:57:58 UTC (rev 9518)
+++ trunk/gnue-forms/src/input/displayHandlers/Cursor.py        2007-04-25 
20:12:22 UTC (rev 9519)
@@ -334,7 +334,6 @@
         self._selection1, self._selection2 = new_selection
         self.modified = True
         self.generateRefreshEvent()
-        self.entry._form.refreshUIEvents()
 
         # Update the field. This means PRE-CHANGE and POST-CHANGE will get
         # fired now.





reply via email to

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