Author: reinhard
Date: 2006-10-21 09:15:50 -0500 (Sat, 21 Oct 2006)
New Revision: 8894
Modified:
trunk/gnue-forms/src/GFForm.py
Log:
Slightly changed FOCUS-IN and FOCUS-OUT logic to make it possible to clear the
form in any case, even if the current entry contains an invalid value.
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2006-10-21 13:49:14 UTC (rev 8893)
+++ trunk/gnue-forms/src/GFForm.py 2006-10-21 14:15:50 UTC (rev 8894)
@@ -1357,7 +1357,7 @@
if self._currentBlock is not None:
self._currentBlock._focus_in()
- self.beginEditing() # happens via _focus_in()
+ # self.beginEditing() # happens via _focus_in()
# -------------------------------------------------------------------------
@@ -1394,7 +1394,7 @@
self._currentBlock._focus_in()
- self.beginEditing() # happens via _focus_in()
+ # self.beginEditing() # happens via _focus_in()
# -------------------------------------------------------------------------
@@ -1409,11 +1409,16 @@
if self._currentBlock is not None:
self._currentBlock._focus_out()
+ # suppress all FOCUS-IN/FOCUS-OUT magic while committing
+ current_block = self._currentBlock
+ self._currentBlock = None
+
try:
# Do the actual work
self.execute_commit()
+
+ self._currentBlock = current_block
finally:
-
if self._currentBlock is not None:
self._currentBlock._focus_in()
@@ -1484,14 +1489,26 @@
# Ignore errors, as we're discarding the changes anyway
pass
+ # We purposedly don't call focus-out here, we want to be able to clean
+ # blocks that have invalid stuff entered.
+ # FIXME: probably we would want to call the POST-FOCUSOUT triggers,
+ # though.
+
+ # Suppress all FOCUS-IN/FOCUS-OUT magic while clearing the blocks
+ # (focus_in() and focus_out() would happen via dsResultSetChanged)
+ current_block = self._currentBlock
+ self._currentBlock = None
+
try:
# Call rollback only once per connection (if multiple blocks are
# sharing the same connection)
self.__rollback_all_connections()
self.__clear_all_blocks()
-
finally:
- self.beginEditing()
+ self._currentBlock = current_block
+ if self._currentBlock is not None:
+ self._currentBlock._focus_in()
+ # self.beginEditing() # happens via _focus_in()
# -------------------------------------------------------------------------
_______________________________________________
commit-gnue mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/commit-gnue