[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8920 - in trunk/gnue-forms/src: . GFObjects
From: |
reinhard |
Subject: |
[gnue] r8920 - in trunk/gnue-forms/src: . GFObjects |
Date: |
Tue, 24 Oct 2006 13:55:19 -0500 (CDT) |
Author: reinhard
Date: 2006-10-24 13:55:18 -0500 (Tue, 24 Oct 2006)
New Revision: 8920
Modified:
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Be smarter about UI moving and updating on commits.
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2006-10-24 18:37:26 UTC (rev 8919)
+++ trunk/gnue-forms/src/GFForm.py 2006-10-24 18:55:18 UTC (rev 8920)
@@ -1439,18 +1439,35 @@
# Form level pre-commit triggers
self.processTrigger('Pre-Commit', ignoreAbort=False)
- # Process the commit on all blocks
+ # Block level pre-commit triggers
for block in self._logic._blockList:
- assert gDebug(5, "Saving %s" % block.name)
- try:
- block.post()
- except Exception:
- # jump to offending block
- if block != self._currentBlock:
- self.findAndChangeFocus(block)
- raise
+ block.processTrigger('Pre-Commit')
+ # FIXME: Is this a GoodThing(tm)? Maybe we would really *want* to move
+ # the record pointer at commit time in the trigger?
+ for block in self._logic._blockList:
+ block.goto_record(block._precommitRecord)
+
+ # Set the mode to commit on all blocks
+ for block in self._logic._blockList:
+ block.mode = 'commit'
+
try:
+ # Process the commit on all blocks
+ for block in self._logic._blockList:
+ assert gDebug(5, "Saving %s" % block.name)
+ try:
+ block.post()
+ except Exception:
+ # jump to offending block
+ if block != self._currentBlock:
+ self.findAndChangeFocus(block)
+ raise
+ finally:
+ for block in self._logic._blockList:
+ block.mode = 'normal'
+
+ try:
# Now do the real commit() on the backend connections (only
# once per connection, if multiple blocks are sharing the same
# connection)
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-10-24 18:37:26 UTC (rev
8919)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-10-24 18:55:18 UTC (rev
8920)
@@ -309,16 +309,17 @@
def __ds_resultset_activated(self, event):
+ # Don't let the user interface follow while we iterating through the
+ # detail resultsets for the commit triggers
+ if self.mode == 'commit':
+ return
+
# FIXME: If an exception appears here, we have a problem: it is
probably
# too late to cancel the operation.
self._focus_out()
self.__resultset = event.resultSet
- # FIXME: during commit, master datasources navigate the current record
- # through the dirty record list and cause the detail blocks to follow
- # through this event. However, in that case, we wouldn't want the UI to
- # follow, so we wouldn't want to run the following lines in that case.
recno = self.__resultset.getRecordNumber()
if recno == -1:
self.__scrolling_blocked = True
@@ -337,6 +338,11 @@
def __ds_cursor_moved(self, event):
+ # Don't let the user interface follow while we iterating through the
+ # records for the commit triggers
+ if self.mode == 'commit':
+ return
+
if self.__scrolling_blocked:
return
@@ -996,10 +1002,6 @@
assert gDebug(4, "processing commit on block %s" % self.name, 1)
- self.mode = 'commit'
-
- self.__resultset.setRecord(self._precommitRecord)
-
if self._getMasterBlock() is None:
self._dataSourceLink.postAll()
@@ -1010,22 +1012,9 @@
Called after the commit on the backend is through.
"""
- self.mode = 'normal'
-
- # Synchronize backend -> resultset -> UI
if self._getMasterBlock() is None:
self._dataSourceLink.requeryAll(commit)
- # If the last record was deleted, insert a new one
- if not self.__resultset.getRecordCount():
- self.__scrolling_blocked = True
- try:
- self.__resultset.insertRecord(self._lastValues)
- finally:
- self._scrolling_blocked = False
-
- self.__current_record_changed(True)
-
# -------------------------------------------------------------------------
def clear(self):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8920 - in trunk/gnue-forms/src: . GFObjects,
reinhard <=