[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r9548 - in trunk/gnue-forms: defaults src src/GFObjects
From: |
reinhard |
Subject: |
[gnue] r9548 - in trunk/gnue-forms: defaults src src/GFObjects |
Date: |
Thu, 3 May 2007 02:37:55 -0500 (CDT) |
Author: reinhard
Date: 2007-05-03 02:37:54 -0500 (Thu, 03 May 2007)
New Revision: 9548
Modified:
trunk/gnue-forms/defaults/default.gfd
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
If changes are discarded, reset the form to initial state rather than clearing
it. This makes a difference if startup="full" is set for a block.
Modified: trunk/gnue-forms/defaults/default.gfd
===================================================================
--- trunk/gnue-forms/defaults/default.gfd 2007-05-03 06:53:01 UTC (rev
9547)
+++ trunk/gnue-forms/defaults/default.gfd 2007-05-03 07:37:54 UTC (rev
9548)
@@ -123,7 +123,7 @@
form.commit()
</action>
<action name="act__rollback__" icon="rollback" label="Disca&rd changes"
- description="Discard all changes and clear the form">
+ description="Discard all changes and reset the form">
form.rollback()
</action>
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2007-05-03 06:53:01 UTC (rev 9547)
+++ trunk/gnue-forms/src/GFForm.py 2007-05-03 07:37:54 UTC (rev 9548)
@@ -1509,7 +1509,7 @@
except DBError:
self.__rollback_all_connections()
- self.__clear_all_blocks()
+ self.__reset_all_blocks()
raise
finally:
@@ -1656,7 +1656,7 @@
# Call rollback only once per connection (if multiple blocks are
# sharing the same connection)
self.__rollback_all_connections()
- self.__clear_all_blocks()
+ self.__reset_all_blocks()
finally:
self._currentBlock = current_block
if self._currentBlock is not None:
@@ -1672,10 +1672,10 @@
# -------------------------------------------------------------------------
- def __clear_all_blocks(self):
+ def __reset_all_blocks(self):
for block in self._logic._blockList:
- block.clear()
+ block.populate()
# -------------------------------------------------------------------------
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2007-05-03 06:53:01 UTC (rev
9547)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2007-05-03 07:37:54 UTC (rev
9548)
@@ -510,7 +510,7 @@
return
if self.startup == 'full':
- self.set_filter()
+ self.__query()
elif self.startup == 'empty':
self.clear()
@@ -651,6 +651,21 @@
when being asked whether or not to save changes.
"""
+ self._focus_out()
+ # We only have to save if the queried block or one of its details has
+ # pending changes, not if any other unrelated block is dirty.
+ if self.is_pending() and not self._form._must_save():
+ return False
+ try:
+ self.__query(*args, **params)
+ finally:
+ self._focus_in()
+ return True
+
+ # -------------------------------------------------------------------------
+
+ def __query(self, *args, **params):
+
# First, convert the fieldname/value pairs to column/value pairs.
cond = {}
for (fieldname, value) in params.iteritems():
@@ -662,24 +677,18 @@
cond = GConditions.combineConditions(cond, arg)
# Now, do the query.
- self._focus_out()
- # We only have to save if the queried block or one of its details has
- # pending changes, not if any other unrelated block is dirty.
- if self.is_pending() and not self._form._must_save():
- return False
self.__in_query = True
try:
self._dataSourceLink.createResultSet(cond)
finally:
self.__in_query = False
- self._focus_in()
- return True
# -------------------------------------------------------------------------
def clear(self):
"""
- Populate the block with a single empty record.
+ Discard changes in this block and populate it with a single empty
+ record.
"""
# Detail blocks cannot be cleared - they follow their master blindly.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r9548 - in trunk/gnue-forms: defaults src src/GFObjects,
reinhard <=