[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8990 - in trunk/gnue-forms/src: . GFObjects
From: |
reinhard |
Subject: |
[gnue] r8990 - in trunk/gnue-forms/src: . GFObjects |
Date: |
Tue, 7 Nov 2006 13:27:02 -0600 (CST) |
Author: reinhard
Date: 2006-11-07 13:27:01 -0600 (Tue, 07 Nov 2006)
New Revision: 8990
Modified:
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
Log:
Added autosave, focusout etc. logic to GFBlock.query().
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2006-11-07 19:26:29 UTC (rev 8989)
+++ trunk/gnue-forms/src/GFForm.py 2006-11-07 19:27:01 UTC (rev 8990)
@@ -1311,7 +1311,7 @@
if self._currentBlock is not None:
self._currentBlock._focus_out()
- if not self.__must_save():
+ if not self._must_save():
# Notify the UI to not show the query button pressed in
self.dispatchEvent('endENTERQUERY', _form=self)
self.beginEditing()
@@ -1339,7 +1339,7 @@
if self._currentBlock is not None:
self._currentBlock._focus_out()
- if not self.__must_save():
+ if not self._must_save():
# Notify the UI to not show the query button pressed in
self.dispatchEvent('endENTERQUERY', _form=self)
self.beginEditing()
@@ -1844,7 +1844,7 @@
# ... we would want to be able to exit here without saving even if the
# current entry contains an invalid value.
- if not self.__must_save():
+ if not self._must_save():
return
self.processTrigger('On-Exit')
@@ -1861,7 +1861,7 @@
# Ask the user whether to save or to discard changes if there are any
# -------------------------------------------------------------------------
- def __must_save(self):
+ def _must_save(self):
if self.isSaved():
return True
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-11-07 19:26:29 UTC (rev
8989)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2006-11-07 19:27:01 UTC (rev
8990)
@@ -122,6 +122,8 @@
self.__query_values = {}
self.__last_query_values = {}
+ self.__in_query = False
+
#: A list of all GFScrollbar objects bound to this block
self.__scrollbars = []
@@ -320,7 +322,8 @@
# FIXME: If an exception appears here, we have a problem: it is
probably
# too late to cancel the operation.
- self._focus_out()
+ if not self.__in_query:
+ self._focus_out()
self.__resultset = event.resultSet
@@ -335,7 +338,8 @@
self.__current_record_changed(True)
- self._focus_in()
+ if not self.__in_query:
+ self._focus_in()
# -------------------------------------------------------------------------
@@ -990,7 +994,11 @@
block.mode = 'normal'
# FIXME: This leaves blocks not affected from this query unupdated
- rootBlock._dataSourceLink.createResultSet(conditions)
+ self.__in_query = True
+ try:
+ rootBlock._dataSourceLink.createResultSet(conditions)
+ finally:
+ self.__in_query = False
for block in self._logic._blockList:
block.processTrigger('POST-QUERY')
@@ -1013,6 +1021,8 @@
create straightforward simple queries where the database columns
included in the condition have their GFField assigned. This also
works for lookup fields.
+ @returns: True if the query was executed, False if the user aborted
+ when being asked whether or not to save changes.
"""
# First, convert the fieldname/value pairs to column/value pairs.
@@ -1028,12 +1038,18 @@
cond = GConditions.combineConditions(cond, arg)
# Now, do the query.
- self._dataSourceLink.createResultSet(cond)
+ self._focus_out()
+ if 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
- # Everything else (including an update of the UI) will happen via
- # __ds_resultset_activated()
-
# -------------------------------------------------------------------------
# Saving and Discarding
# -------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8990 - in trunk/gnue-forms/src: . GFObjects,
reinhard <=