[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/forms/src GFForm.py GFParser.py GFObjects/...
From: |
Jason Cater |
Subject: |
gnue/forms/src GFForm.py GFParser.py GFObjects/... |
Date: |
Tue, 17 Sep 2002 20:27:50 -0400 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/09/17 20:27:50
Modified files:
forms/src : GFForm.py GFParser.py
forms/src/GFObjects: GFBlock.py GFBox.py GFButton.py GFEntry.py
GFPage.py
Added files:
forms/src/GFObjects: GFContainer.py GFTabStop.py
Log message:
lots of cleanup to form's tab traversal/focus order; added support for
focusorder='1' (tab order specifications); fixed the bugs introduced by
boxes-as-containers patch; WARNING: existing forms with boxes may not display
correctly as the box now uses a wxStaticBox, so it's interior section is no
longer transparent :( Fields and labels may get hidden.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFForm.py.diff?cvsroot=OldCVS&tr1=1.174&tr2=1.175&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFParser.py.diff?cvsroot=OldCVS&tr1=1.71&tr2=1.72&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFContainer.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFTabStop.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFBlock.py.diff?cvsroot=OldCVS&tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFBox.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFButton.py.diff?cvsroot=OldCVS&tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFEntry.py.diff?cvsroot=OldCVS&tr1=1.67&tr2=1.68&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFPage.py.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.174 gnue/forms/src/GFForm.py:1.175
*** gnue/forms/src/GFForm.py:1.174 Tue Sep 17 11:27:45 2002
--- gnue/forms/src/GFForm.py Tue Sep 17 20:27:50 2002
***************
*** 100,108 ****
def _buildObject(self):
-
- # Convert some deprecated options to new style
i = 0
while i < len(self._children):
if isinstance(self._children[i], GFOptions):
--- 100,109 ----
+ #
+ # Convert some deprecated options to new style
+ #
def _buildObject(self):
i = 0
while i < len(self._children):
if isinstance(self._children[i], GFOptions):
***************
*** 139,186 ****
# Import all needed objects
self.walk(self.initImportedObjects)
- # analyze the tree
- self.walk(self.analyzeTree)
-
self.initTriggerSystem()
self._triggerns.update(self._triggerNamespaceTree._globalNamespace)
!
def secondaryInit(self):
# create the first records
for key in self._datasourceDictionary.keys():
if not self._datasourceDictionary[key].hasMaster():
self._datasourceDictionary[key].createEmptyResultSet()
! #
! # begin routines made for walking
! #
! # routines that are used by the walk() method
! # suggesting a better way probably exists :)
! #
!
! #
! # analyzeTree
! #
! # Scans the tree form tree and performs the following
! #
! # builds the various entity lists
! # it also sets the initial focus of the form
! # constructs the trigger namespace
! #
! def analyzeTree(self,object):
! if object._type == 'GFBlock':
! self._blockList.append(object)
! if self._currentBlock == None:
! self._currentBlock = object
!
! elif object._type == 'GFPage':
! self._pageList.append(object)
! if self._currentPage == None:
! self._currentPage = object
!
! elif object._type in TabStops and self._currentEntry == None and \
! not object.hidden and not object.readonly:
! self._currentEntry = object
#
--- 140,160 ----
# Import all needed objects
self.walk(self.initImportedObjects)
self.initTriggerSystem()
self._triggerns.update(self._triggerNamespaceTree._globalNamespace)
!
! #
! # Secondary init (stuff that must happen
! # after all our children have init'ed)
! #
def secondaryInit(self):
# create the first records
for key in self._datasourceDictionary.keys():
if not self._datasourceDictionary[key].hasMaster():
self._datasourceDictionary[key].createEmptyResultSet()
! # Set initial focus
! self.findAndChangeFocus(self)
#
***************
*** 534,545 ****
#
def nextEntry(self):
nextEntry = None
keepNext = 0
! for object in self._currentEntry._block._children:
# Put the first field as the next to rollover
! if (object._type in TabStops and
! (not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
if nextEntry == None:
nextEntry = object
--- 508,520 ----
#
def nextEntry(self):
nextEntry = None
+ firstEntry = None
keepNext = 0
! print self._currentEntry._block._focusOrder
! for object in self._currentEntry._block._focusOrder:
# Put the first field as the next to rollover
! if ((not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
if nextEntry == None:
nextEntry = object
***************
*** 549,570 ****
keepNext = 1
continue
- def _getFocusableEntries (self, children):
- # I *hate* debug
- # GDebug.printMesg (5, )
-
- entryNo= 0
- result= children
- for entry in children:
- # shouldn't this be 'in containers'?
- if entry._type == 'GFBox':
- next= _getFocusableEntries (entry._children)
- # replace the box with its children recursively
- result= result[:entryNo]+next+result[entryNo+1:]
- entryNo= entryNo+length (next)
- entryNo= entryNo+1
- return result
-
if keepNext == 1:
nextEntry = object
break
--- 524,529 ----
***************
*** 572,582 ****
if nextEntry == firstEntry and self._currentBlock.transparentBlock:
# Jump to the next block if block is tagged as transparent
self.nextBlock()
- firstEntry= self._currentEntry
else:
self.changeFocus(nextEntry)
-
#
# previousEntry
#
--- 531,539 ----
***************
*** 588,607 ****
nextEntry = None
lastEntry = self._currentEntry
! entryList= self._getFocusableEntries (self._currentBlock._children)
! for object in entryList:
! if (object._type in TabStops and
! (not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
nextEntry = object
lastEntry = object
keepNext = 0
! entryList= self._getFocusableEntries (self._currentBlock._children)
! for object in entryList:
# Put the first field as the next to rollover
! if (object._type in TabStops and
! (not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
if object == self._currentEntry:
break
--- 545,560 ----
nextEntry = None
lastEntry = self._currentEntry
! for object in self._currentBlock._focusOrder:
! if ((not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
nextEntry = object
lastEntry = object
keepNext = 0
! for object in self._currentBlock._focusOrder:
# Put the first field as the next to rollover
! if ((not object.hidden) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
if object == self._currentEntry:
break
***************
*** 611,619 ****
if self._currentBlock.transparentBlock and nextEntry == lastEntry: # Jump
to the prev block if block is tagged as transparent
prevBlock = self.findPreviousBlock()
# Move to the new last record of the new current block
! for object in prevBlock._children:
! if object._type in TabStops and \
! not object.hidden and (not object.readonly or
self._currentBlock.mode=='query'):
nextEntry = object
self.findAndChangeFocus(nextEntry)
--- 564,571 ----
if self._currentBlock.transparentBlock and nextEntry == lastEntry: # Jump
to the prev block if block is tagged as transparent
prevBlock = self.findPreviousBlock()
# Move to the new last record of the new current block
! for object in prevBlock._focusOrder:
! if not object.hidden and (not object.readonly or
self._currentBlock.mode=='query'):
nextEntry = object
self.findAndChangeFocus(nextEntry)
Index: gnue/forms/src/GFObjects/GFBlock.py
diff -c gnue/forms/src/GFObjects/GFBlock.py:1.52
gnue/forms/src/GFObjects/GFBlock.py:1.53
*** gnue/forms/src/GFObjects/GFBlock.py:1.52 Tue Jul 30 15:33:59 2002
--- gnue/forms/src/GFObjects/GFBlock.py Tue Sep 17 20:27:50 2002
***************
*** 33,39 ****
from gnue.common import GDebug
from gnue.common import GConditions
! from GFObj import GFObj
import string
--- 33,39 ----
from gnue.common import GDebug
from gnue.common import GConditions
! from GFContainer import GFContainer
import string
***************
*** 46,54 ****
# GFBlock
#
#
! class GFBlock(GFObj, GFEventAware):
def __init__(self, parent=None):
! GFObj.__init__(self, parent, 'GFBlock')
self.mode = 'normal'
--- 46,54 ----
# GFBlock
#
#
! class GFBlock(GFContainer, GFEventAware):
def __init__(self, parent=None):
! GFContainer.__init__(self, parent, 'GFBlock')
self.mode = 'normal'
***************
*** 107,126 ****
self.datasource = string.lower(self.datasource)
self.walk(self.__setChildRowSettings)
! return GFObj._buildObject(self)
!
!
def initialize(self):
! self._form = self.findParentOfType('GFForm')
self._page = self.findParentOfType('GFPage')
# Initialize our events system
GFEventAware.__init__(self, self._form._app.eventController)
! self.walk(self.buildEntryList)
if not hasattr(self,'datasource') or not self.datasource:
ds = GFDataSource(self)
self.datasource = ds.name = "dts_%s" % self
--- 107,135 ----
self.datasource = string.lower(self.datasource)
self.walk(self.__setChildRowSettings)
! return GFContainer._buildObject(self)
+ #
+ # Primary initialization
+ #
def initialize(self):
! self._form = form = self.findParentOfType('GFForm')
self._page = self.findParentOfType('GFPage')
+ form._blockList.append(self)
+
# Initialize our events system
GFEventAware.__init__(self, self._form._app.eventController)
+ # Get all focusable items, ordered correctly
+ self._focusOrder = self.getFocusOrder()
! # Find all GFEntry's
! for object in self._focusOrder:
! if object._type == 'GFEntry':
! self._entryList.append(object)
+ # 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)
self.datasource = ds.name = "dts_%s" % self
***************
*** 129,134 ****
--- 138,145 ----
ds.phaseInit()
self._dataSourceLink = self._form._datasourceDictionary[self.datasource]
+
+ # We will monitor our own resultSet changes
self._dataSourceLink.registerResultSetListener(self._loadResultSet)
***************
*** 143,152 ****
else:
object._gap = self._gap
-
- def buildEntryList(self, object):
- if object._type == 'GFEntry':
- self._entryList.append(object)
#
# isSaved
--- 154,159 ----
Index: gnue/forms/src/GFObjects/GFBox.py
diff -c gnue/forms/src/GFObjects/GFBox.py:1.4
gnue/forms/src/GFObjects/GFBox.py:1.5
*** gnue/forms/src/GFObjects/GFBox.py:1.4 Tue Sep 10 11:30:50 2002
--- gnue/forms/src/GFObjects/GFBox.py Tue Sep 17 20:27:50 2002
***************
*** 27,45 ****
#
# NOTES:
#
- # HISTORY:
- # Copyright (c) 2000 Free Software Foundation
- #
! from GFObj import GFObj
#
# GFBox
#
! class GFBox(GFObj):
def __init__(self, parent=None):
! GFObj.__init__(self, parent)
! self._type = "GFBox"
self.label = ""
--- 27,41 ----
#
# NOTES:
#
! from GFContainer import GFContainer
#
# GFBox
#
! class GFBox(GFContainer):
def __init__(self, parent=None):
! GFContainer.__init__(self, parent,"GFBox")
self.label = ""
Index: gnue/forms/src/GFObjects/GFButton.py
diff -c gnue/forms/src/GFObjects/GFButton.py:1.8
gnue/forms/src/GFObjects/GFButton.py:1.9
*** gnue/forms/src/GFObjects/GFButton.py:1.8 Sat Jun 15 17:15:09 2002
--- gnue/forms/src/GFObjects/GFButton.py Tue Sep 17 20:27:50 2002
***************
*** 1,13 ****
#
# This file is part of GNU Enterprise.
#
! # GNU Enterprise is free software; you can redistribute it
! # and/or modify it under the terms of the GNU General Public
! # License as published by the Free Software Foundation; either
# version 2, or (at your option) any later version.
#
! # GNU Enterprise is distributed in the hope that it will be
! # useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
--- 1,13 ----
#
# This file is part of GNU Enterprise.
#
! # GNU Enterprise is free software; you can redistribute it
! # and/or modify it under the terms of the GNU General Public
! # License as published by the Free Software Foundation; either
# version 2, or (at your option) any later version.
#
! # GNU Enterprise is distributed in the hope that it will be
! # useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
***************
*** 26,40 ****
#
# NOTES:
#
! from GFObj import GFObj
#
# GFButton
#
! class GFButton(GFObj):
def __init__(self, parent=None):
! GFObj.__init__(self, parent)
! self._type = "GFButton"
self.label = ""
self._inits = [self.initialize]
--- 26,39 ----
#
# NOTES:
#
! from GFTabStop import GFTabStop
#
# GFButton
#
! class GFButton(GFTabStop):
def __init__(self, parent=None):
! GFTabStop.__init__(self, parent, 'GFButton')
self.label = ""
self._inits = [self.initialize]
Index: gnue/forms/src/GFObjects/GFEntry.py
diff -c gnue/forms/src/GFObjects/GFEntry.py:1.67
gnue/forms/src/GFObjects/GFEntry.py:1.68
*** gnue/forms/src/GFObjects/GFEntry.py:1.67 Tue Sep 10 11:30:50 2002
--- gnue/forms/src/GFObjects/GFEntry.py Tue Sep 17 20:27:50 2002
***************
*** 30,35 ****
--- 30,36 ----
from gnue.common import GDebug, FormatMasks
from gnue.forms import GFDisplayHandler
from GFValue import GFValue
+ from GFTabStop import GFTabStop
import string
############################################################
***************
*** 39,45 ****
#
# It send events to its parent GFBlock
#
! class GFEntry(GFValue):
def __init__(self, parent=None, value=None):
GFValue.__init__(self, parent, value, 'GFEntry')
--- 40,46 ----
#
# It send events to its parent GFBlock
#
! class GFEntry(GFValue, GFTabStop):
def __init__(self, parent=None, value=None):
GFValue.__init__(self, parent, value, 'GFEntry')
Index: gnue/forms/src/GFObjects/GFPage.py
diff -c gnue/forms/src/GFObjects/GFPage.py:1.3
gnue/forms/src/GFObjects/GFPage.py:1.4
*** gnue/forms/src/GFObjects/GFPage.py:1.3 Thu Jul 4 18:36:07 2002
--- gnue/forms/src/GFObjects/GFPage.py Tue Sep 17 20:27:50 2002
***************
*** 16,22 ****
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # Copyright 2000, 2001 Free Software Foundation
#
#
# FILE:
--- 16,22 ----
# write to the Free Software Foundation, Inc., 59 Temple Place
# - Suite 330, Boston, MA 02111-1307, USA.
#
! # Copyright 2000-2002 Free Software Foundation
#
#
# FILE:
***************
*** 27,35 ****
#
# NOTES:
#
! # HISTORY:
! # Copyright (c) 2000 Free Software Foundation
! #
from GFObj import GFObj
#
--- 27,33 ----
#
# NOTES:
#
!
from GFObj import GFObj
#
***************
*** 37,45 ****
#
class GFPage(GFObj):
def __init__(self, parent=None):
! GFObj.__init__(self, parent)
! self._type = "GFPage"
!
--- 35,48 ----
#
class GFPage(GFObj):
def __init__(self, parent=None):
! GFObj.__init__(self, parent,"GFPage")
! self._inits = [self.initialize]
!
! def initialize(self):
! form = self.findParentOfType('GFForm')
! form._pageList.append(self)
!
!
Index: gnue/forms/src/GFParser.py
diff -c gnue/forms/src/GFParser.py:1.71 gnue/forms/src/GFParser.py:1.72
*** gnue/forms/src/GFParser.py:1.71 Tue Sep 10 14:35:58 2002
--- gnue/forms/src/GFParser.py Tue Sep 17 20:27:50 2002
***************
*** 182,199 ****
'BaseClass': GFObjects.GFLabel,
'Attributes': {
'name': {
! 'Unique': 1,
! 'Typecast': GTypecast.name },
'text': {
! 'Required': 1,
! 'Typecast': GTypecast.text },
'alignment': {
! 'Typecast': GTypecast.name,
! 'ValueSet': {
'left': {},
! 'right': {},
! 'center': {} },
! 'Default': "left"},
'width': {
'Typecast': GTypecast.whole },
'rows': {
--- 182,199 ----
'BaseClass': GFObjects.GFLabel,
'Attributes': {
'name': {
! 'Unique': 1,
! 'Typecast': GTypecast.name },
'text': {
! 'Required': 1,
! 'Typecast': GTypecast.text },
'alignment': {
! 'Typecast': GTypecast.name,
! 'ValueSet': {
'left': {},
! 'right': {},
! 'center': {} },
! 'Default': "left"},
'width': {
'Typecast': GTypecast.whole },
'rows': {
***************
*** 227,245 ****
'max_length': {
'Typecast': GTypecast.whole },
'visibleCount':{
! 'Typecast': GTypecast.whole,
'Deprecated': 'Use the <block> "rows" attribute instead.' },
'rows': {
'Typecast': GTypecast.whole},
'rowSpacer': {
'Typecast': GTypecast.whole },
'readonly': {
! 'Typecast': GTypecast.boolean,
'Default': 0 },
'required': {
'Description': 'This object cannot have an empty value prior '
'to a commit.',
! 'Typecast': GTypecast.boolean,
'Default': 0 },
'uppercase': {
'Deprecated': 'Use case="upper" instead.',
--- 227,247 ----
'max_length': {
'Typecast': GTypecast.whole },
'visibleCount':{
! 'Typecast': GTypecast.whole,
'Deprecated': 'Use the <block> "rows" attribute instead.' },
+ 'focusorder': {
+ 'Typecast': GTypecast.whole},
'rows': {
'Typecast': GTypecast.whole},
'rowSpacer': {
'Typecast': GTypecast.whole },
'readonly': {
! 'Typecast': GTypecast.boolean,
'Default': 0 },
'required': {
'Description': 'This object cannot have an empty value prior '
'to a commit.',
! 'Typecast': GTypecast.boolean,
'Default': 0 },
'uppercase': {
'Deprecated': 'Use case="upper" instead.',
***************
*** 261,273 ****
'ValueSet': {
'default': {},
'dropdown': {},
! 'checkbox': {},
! 'label': {} },
! 'Default': 'default'},
'case': {
! 'Typecast': GTypecast.name,
! 'ValueSet': {
! 'mixed': {},
'upper': {},
'lower': {} },
'Default': 'mixed'},
--- 263,275 ----
'ValueSet': {
'default': {},
'dropdown': {},
! 'checkbox': {},
! 'label': {} },
! 'Default': 'default'},
'case': {
! 'Typecast': GTypecast.name,
! 'ValueSet': {
! 'mixed': {},
'upper': {},
'lower': {} },
'Default': 'mixed'},
***************
*** 328,334 ****
'y': {
'Required': 1,
'Typecast': GTypecast.whole } },
! 'ParentTags': ('block',) },
'scrollbar': {
'BaseClass': GFObjects.GFScrollBar,
--- 330,336 ----
'y': {
'Required': 1,
'Typecast': GTypecast.whole } },
! 'ParentTags': ('block','box') },
'scrollbar': {
'BaseClass': GFObjects.GFScrollBar,
***************
*** 345,372 ****
'y': {
'Required': 1,
'Typecast': GTypecast.whole } },
! 'ParentTags': ('page','block',) },
'box': {
'BaseClass': GFObjects.GFBox,
'Attributes': {
'name': {
! 'Unique': 1,
! 'Typecast': GTypecast.name },
'label': {
! 'Typecast': GTypecast.text },
'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole },
'height': {
'Required': 1,
! 'Typecast': GTypecast.whole },
'x': {
'Required': 1,
! 'Typecast': GTypecast.whole },
'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole } },
'ParentTags': ('page','block',) },
'button': {
--- 347,376 ----
'y': {
'Required': 1,
'Typecast': GTypecast.whole } },
! 'ParentTags': ('page','block','box') },
'box': {
'BaseClass': GFObjects.GFBox,
'Attributes': {
'name': {
! 'Unique': 1,
! 'Typecast': GTypecast.name },
'label': {
! 'Typecast': GTypecast.text },
'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole },
'height': {
'Required': 1,
! 'Typecast': GTypecast.whole },
! 'focusorder': {
! 'Typecast': GTypecast.whole},
'x': {
'Required': 1,
! 'Typecast': GTypecast.whole },
'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole } },
'ParentTags': ('page','block',) },
'button': {
***************
*** 377,397 ****
'Typecast': GTypecast.name },
'trigger': {
'Typecast': GTypecast.name },
'label': {
'Typecast': GTypecast.name },
'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole },
'height': {
'Required': 1,
'Typecast': GTypecast.whole },
'x': {
! 'Required': 1,
'Typecast': GTypecast.whole },
'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole } },
! 'ParentTags': ('page','block',) },
'trigger': {
'BaseClass': GFTrigger.GFTrigger,
--- 381,403 ----
'Typecast': GTypecast.name },
'trigger': {
'Typecast': GTypecast.name },
+ 'focusorder': {
+ 'Typecast': GTypecast.whole},
'label': {
'Typecast': GTypecast.name },
'width': {
! 'Required': 1,
! 'Typecast': GTypecast.whole },
'height': {
'Required': 1,
'Typecast': GTypecast.whole },
'x': {
! 'Required': 1,
'Typecast': GTypecast.whole },
'y': {
! 'Required': 1,
! 'Typecast': GTypecast.whole } },
! 'ParentTags': ('page','block','box') },
'trigger': {
'BaseClass': GFTrigger.GFTrigger,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/forms/src GFForm.py GFParser.py GFObjects/...,
Jason Cater <=