[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
r5784 - in trunk/gnue-forms/src: . GFObjects
From: |
jcater |
Subject: |
r5784 - in trunk/gnue-forms/src: . GFObjects |
Date: |
Fri, 7 May 2004 00:02:38 -0500 (CDT) |
Author: jcater
Date: 2004-05-07 00:02:37 -0500 (Fri, 07 May 2004)
New Revision: 5784
Modified:
trunk/gnue-forms/src/GFForm.py
trunk/gnue-forms/src/GFInstance.py
trunk/gnue-forms/src/GFObjects/GFBlock.py
trunk/gnue-forms/src/GFParser.py
Log:
added block.autoinsert; started on block.autocommit and block.autorecord
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2004-05-06 21:47:02 UTC (rev 5783)
+++ trunk/gnue-forms/src/GFForm.py 2004-05-07 05:02:37 UTC (rev 5784)
@@ -877,8 +877,8 @@
# #
# def triggerGetCurrentEntry(self):
# return self._currentEntry
-#
-#
+#
+#
# #
# # allow the trigger to get a handle to
# # an actual GFBlock object
@@ -888,7 +888,7 @@
# #
# def triggerGetCurrentBlock(self):
# return self._currentBlock
-#
+#
# #
# # allow the trigger to get a handle to
# # an actual GFPage object
@@ -898,7 +898,7 @@
# #
# def triggerGetCurrentPage(self):
# return self._currentPage
-
+
#
# triggerSetStatusText
#
Modified: trunk/gnue-forms/src/GFInstance.py
===================================================================
--- trunk/gnue-forms/src/GFInstance.py 2004-05-06 21:47:02 UTC (rev 5783)
+++ trunk/gnue-forms/src/GFInstance.py 2004-05-07 05:02:37 UTC (rev 5784)
@@ -161,17 +161,17 @@
mapping[key[4:]] = options[key]
GFKeyMapper.KeyMapper.loadUserKeyMap(mapping)
-
-
+
+
def addDialogs(self):
"""
Loads the base dialogs into memory.
-
+
Base dialogs include items such as the jump to record
dialog and error dialogs.
"""
-
-
+
+
#
# Import and register dialogs
#
@@ -198,9 +198,9 @@
def addFormFromBuffer(self,buffer):
"""
- Loads a GObj based form tree when passed a string containing
+ Loads a GObj based form tree when passed a string containing
gfd markup.
-
+
@param fileName: A string containing a URI
"""
try:
@@ -213,7 +213,7 @@
def addFormFromFile(self,fileName):
"""
Loads a GObj based form tree when passed a file name.
-
+
@param fileName: A string containing a URI
"""
try:
@@ -226,14 +226,14 @@
def addFormFromFilehandle(self,fileHandle):
"""
Loads a GObj based form tree when passed a valid python file handle.
-
+
A copy of the instance is passed into the parser so that
it can work with things like the GConnections stored in
the base app
-
+
@param fileHandle: A python file handle.
"""
-
+
#
# Load the file bypassing the initialization
# We bypass the initialization because <dialog>s are
@@ -440,7 +440,7 @@
self.updateRecordCounter(form)
self.updateRecordStatus(form)
-
+
def proxyEntryEvent(self, event):
"""
This serves as a proxy for any entry-level events.
@@ -477,7 +477,7 @@
"""
Called whenever an event source has requested that the
focus change to the next data entry object
-
+
@param event: The event currently being processed.
"""
if not event._form.endEditing():
@@ -494,10 +494,10 @@
"""
Called whenever an event source has requested that the
focus change to the next data entry object
-
+
param event: The event that requested the previous entry.
"""
-
+
if not event._form.endEditing():
return
@@ -736,7 +736,7 @@
def executeExit(self, event):
try:
event._form.processTrigger('Pre-Exit', ignoreAbort=False)
-
+
if not event._form.isSaved():
self.displayMessageBox( _('Data not saved. Save changes or clear the
form to proceed.'))
event._form.refreshUIEvents()
@@ -746,7 +746,7 @@
except AbortRequest, t:
self.displayMessageBox(t)
event._form.refreshUIEvents()
-
+
#
# deleteRecord
#
Modified: trunk/gnue-forms/src/GFObjects/GFBlock.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-05-06 21:47:02 UTC (rev
5783)
+++ trunk/gnue-forms/src/GFObjects/GFBlock.py 2004-05-07 05:02:37 UTC (rev
5784)
@@ -66,7 +66,7 @@
self._queryDefaults = {}
self._queryValues = {}
self._lastQueryValues = {}
- self._autocreate = int(gConfigForms('autocreate'))
+# self._autocreate = int(gConfigForms('autocreate'))
self._gap = 0
self._rows = 1
@@ -141,12 +141,12 @@
self._triggerProperties={'parent': {'get':self.getParent}}
-
+
# Iterator support (Python 2.2+)
def __iter__(self):
"""
Iterator support for Python 2.2+
-
+
Allows you to do:
for foo in myBlock:
....
@@ -180,13 +180,15 @@
logic._blockList.append(self)
logic._blockMap[self.name] = self
+ self._autocreate = self.autoinsert # Historical reasons...
+
# Initialize our events system
events.EventAware.__init__(self, form._instance.eventController)
# Get all focusable items, ordered correctly
#self._focusOrder = self.getFocusOrder()
-
+
# Create a stub/non-bound datasource if we aren't bound to one
if not hasattr(self,'datasource') or not self.datasource:
ds = GFDataSource(self)
@@ -319,6 +321,7 @@
elif self._autocreate and not self.isEmpty() and not self.restrictInsert:
self.newRecord()
+
def lastRecord(self):
if not self._resultSet.isLastRecord():
# Do FocusOut triggers
@@ -364,7 +367,7 @@
#Does not work properly anyway
#self._form.changeFocus(self)
#self._form.commit()
-
+
#TODO: Add error handling
#TODO: Check how triggers performed
#TODO: original code is in GFForm.commit
@@ -378,7 +381,7 @@
recordNumber += self._resultSet.getRecordCount()
if recordNumber < 0:
raise "Invalid record number"
-
+
if recordNumber != self._resultSet.getRecordNumber():
# Focus out
self.processTrigger('PRE-FOCUSOUT')
@@ -395,18 +398,18 @@
self.processTrigger('PRE-FOCUSIN')
self.processTrigger('POST-FOCUSIN')
-
+
def jumpRecords(self, adjustment):
targetRecord = self._resultSet.getRecordNumber() + adjustment
-
+
if targetRecord < 0:
targetRecord = 0
elif targetRecord > self._resultSet.getRecordCount():
targetRecord = self._resultSet.getRecordCount()
self.jumpRecord(targetRecord)
- self._form._instance.updateRecordCounter(self._form)
-
+ self._form._instance.updateRecordCounter(self._form)
+
#
# processCommit
#
@@ -414,7 +417,7 @@
GDebug.printMesg(1, "processing commit on block %s"%self.name,1)
self.mode='commit'
-
+
self._resultSet.setRecord(self._precommitRecord)
# Backstep thru the record adjusting for any prior records that
@@ -495,12 +498,12 @@
self._queryValues.update(self._queryDefaults)
self.switchRecord(0)
- def copyQuery(self):
+ def copyQuery(self):
self._query2 = 0
self._queryValues = {}
self._queryValues.update(self._lastQueryValues)
self.switchRecord(0)
-
+
def cancelQuery(self):
self.mode = 'normal'
self.switchRecord(0)
@@ -652,10 +655,10 @@
raise StopIteration
else:
self.block.nextRecord()
-
- if self.block.isEmpty() and self.block._resultSet.isLastRecord():
+
+ if self.block.isEmpty() and self.block._resultSet.isLastRecord():
self.done = True
raise StopIteration
-
+
return self.block
Modified: trunk/gnue-forms/src/GFParser.py
===================================================================
--- trunk/gnue-forms/src/GFParser.py 2004-05-06 21:47:02 UTC (rev 5783)
+++ trunk/gnue-forms/src/GFParser.py 2004-05-07 05:02:37 UTC (rev 5784)
@@ -201,12 +201,37 @@
'individual widgets.' },
'transparent':{
'Typecast': GTypecast.boolean,
+ 'Label': _('Transparent Nav'),
'Default': True,
'Description': 'If set, then you can tab out of the block via
next- '
'or previous-field events. Makes navigation in '
'multiblock forms easier. If false, focus stays '
'within a block until user explicitly moves to '
'another block' },
+ 'autoinsert':{
+ 'Typecast': GTypecast.boolean,
+ 'Label': _('Auto Create Record'),
+ 'Default': True,
+ 'Description': 'If set, then if you attempt to go to the next
record '
+ 'while at the last record, a new record is
created.'},
+ 'autorecord':{
+ 'Typecast': GTypecast.boolean,
+ 'Label': _('Auto Next Record'),
+ 'Default': True,
+ 'Description': 'If set, then if you tab at the end of a block,
you '
+ 'will be taken to the next record. If the
current '
+ 'record is empty and transparent is true, then '
+ 'you will be taken to the next block'},
+ 'autocommit':{
+ 'Typecast': GTypecast.boolean,
+ 'Label': _('Auto Commit'),
+ 'Default': False,
+ 'Description': 'If set, then the datasource will automatically '
+ 'commit changes when trying to navigate out of
the '
+ 'current record. If {field}, then a commit
happens each time a '
+ 'field changes. Care should be taken when
{field} is '
+ ' specified as forms could try to commit before
a new '
+ 'record is committable.'},
'restrictDelete':{
'Typecast': GTypecast.boolean,
'Default': False,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- r5784 - in trunk/gnue-forms/src: . GFObjects,
jcater <=