[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/forms src/GFForm.py src/GFParser.py src/GF...
From: |
Jason Cater |
Subject: |
gnue/forms src/GFForm.py src/GFParser.py src/GF... |
Date: |
Fri, 22 Nov 2002 00:36:14 -0500 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Jason Cater <address@hidden> 02/11/22 00:36:12
Modified files:
forms/src : GFForm.py GFParser.py
forms/src/GFObjects: GFButton.py GFEntry.py GFPage.py
forms/utils : gfd04to05.py
Log message:
more work on switching focus traversal into new logic/layout
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFForm.py.diff?cvsroot=OldCVS&tr1=1.204&tr2=1.205&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFParser.py.diff?cvsroot=OldCVS&tr1=1.88&tr2=1.89&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFButton.py.diff?cvsroot=OldCVS&tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFEntry.py.diff?cvsroot=OldCVS&tr1=1.80&tr2=1.81&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFObjects/GFPage.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/utils/gfd04to05.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: gnue/forms/src/GFForm.py
diff -c gnue/forms/src/GFForm.py:1.204 gnue/forms/src/GFForm.py:1.205
*** gnue/forms/src/GFForm.py:1.204 Thu Nov 21 21:57:23 2002
--- gnue/forms/src/GFForm.py Fri Nov 22 00:36:10 2002
***************
*** 69,75 ****
self._currentBlock = None
self._currentEntry = None
-
self._app = app
self._triggerns={}
--- 69,74 ----
***************
*** 241,246 ****
--- 240,250 ----
object._queryable))):
return object
else:
+ if hasattr(object, '_entryList'):
+ for child in object._entryList:
+ entry = self.findFocus(child)
+ if entry:
+ break
for child in object._children:
entry = self.findFocus(child)
if entry:
***************
*** 268,276 ****
#
def changeFocus(self, widget, fireFocusTriggers=1):
- if not hasattr(widget,'_block'):
- return None
-
message = None
try:
--- 272,277 ----
***************
*** 281,293 ****
return 1
fieldChange = widget != self._currentEntry
! blockChange = widget._block != self._currentBlock
pageChange = widget._page != self._currentPage
if fireFocusTriggers:
try:
if fieldChange:
self._currentEntry.processTrigger('Pre-FocusOut')
if blockChange:
self._currentBlock.processTrigger('Pre-FocusOut')
if pageChange:
--- 282,301 ----
return 1
fieldChange = widget != self._currentEntry
! try:
! blockChange = widget._block != self._currentBlock
! except AttributeError:
! # Buttons don't have a block, but also
! # don't trigger a block change
! blockChange = 0
pageChange = widget._page != self._currentPage
if fireFocusTriggers:
try:
if fieldChange:
self._currentEntry.processTrigger('Pre-FocusOut')
+ if hasattr(self._currentEntry,'_field'):
+ self._currentEntry._field.processTrigger('Pre-FocusOut')
if blockChange:
self._currentBlock.processTrigger('Pre-FocusOut')
if pageChange:
***************
*** 297,309 ****
self._currentBlock.processTrigger('Post-FocusOut')
if fieldChange:
self._currentEntry.processTrigger('Post-FocusOut')
except AttributeError:
pass
oldEntry = self._currentEntry
self._currentEntry = widget
! self._currentBlock = self._currentEntry._block
self._currentPage = self._currentEntry._page
if pageChange:
--- 305,322 ----
self._currentBlock.processTrigger('Post-FocusOut')
if fieldChange:
self._currentEntry.processTrigger('Post-FocusOut')
+ if hasattr(self._currentEntry,'_field'):
+ self._currentEntry._field.processTrigger('Post-FocusOut')
except AttributeError:
pass
oldEntry = self._currentEntry
self._currentEntry = widget
! try:
! self._currentBlock = self._currentEntry._block
! except AttributeError:
! pass # Buttons, et al
self._currentPage = self._currentEntry._page
if pageChange:
***************
*** 322,327 ****
--- 335,344 ----
self._currentBlock.processTrigger('Pre-FocusIn')
if fieldChange:
self._currentEntry.processTrigger('Pre-FocusIn')
+ if hasattr(self._currentEntry,'_field'):
+ self._currentEntry._field.processTrigger('Pre-FocusIn')
+ if hasattr(self._currentEntry,'_field'):
+ self._currentEntry._field.processTrigger('Post-FocusIn')
self._currentEntry.processTrigger('Post-FocusIn')
if blockChange:
self._currentBlock.processTrigger('Post-FocusIn')
***************
*** 480,488 ****
firstEntry = None
keepNext = 0
! 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
--- 497,513 ----
firstEntry = None
keepNext = 0
!
! if self._currentBlock.transparent:
! source = self._currentEntry._page._focusOrder
! else:
! source = self._currentBlock._focusOrder
!
! # if self._currentEntry._page.transparent:
!
! for object in source:
# Put the first field as the next to rollover
! if ((object._navigable) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
if nextEntry == None:
nextEntry = object
***************
*** 492,504 ****
keepNext = 1
continue
! if keepNext == 1:
nextEntry = object
break
! if nextEntry == firstEntry and self._currentBlock.transparent:
! # Jump to the next block if block is tagged as transparent
! self.nextBlock()
else:
self.changeFocus(nextEntry)
--- 517,534 ----
keepNext = 1
continue
! if keepNext:
nextEntry = object
break
! if nextEntry == firstEntry and self._currentBlock.transparent and
self._currentPage.transparent:
! # Jump to the next page if block is page as transparent
! i = self._layout._pageList.index(self._currentPage)
! try:
! dest = self._layout._pageList[i+1]
! except IndexError:
! dest = self._layout._pageList[0]
! self.findAndChangeFocus(dest)
else:
self.changeFocus(nextEntry)
***************
*** 513,526 ****
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))):
--- 543,561 ----
nextEntry = None
lastEntry = self._currentEntry
! if self._currentEntry._block.transparent:
! source = self._currentEntry._page._focusOrder
! else:
! source = self._currentEntry._block._focusOrder
!
! for object in source:
! if ((object._navigable) and ((not object.readonly) or
(self._currentBlock.mode=='query' and object._queryable))):
nextEntry = object
lastEntry = object
keepNext = 0
! for object in source:
# 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))):
***************
*** 529,540 ****
nextEntry = object
! if self._currentBlock.transparent 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)
--- 564,577 ----
nextEntry = object
! if nextEntry == lastEntry and self._currentBlock.transparent and
self._currentPage.transparent:
! i = self._pageList.index(self._currentPage)
! try:
! dest = self._layout._pageList[i - 1]
! except IndexError:
! dest = self._layout._pageList[-1]
! # TODO: This fails if last entry is not navigable
! self.findAndChangeFocus(dest._entryList[-1])
self.findAndChangeFocus(nextEntry)
Index: gnue/forms/src/GFObjects/GFButton.py
diff -c gnue/forms/src/GFObjects/GFButton.py:1.12
gnue/forms/src/GFObjects/GFButton.py:1.13
*** gnue/forms/src/GFObjects/GFButton.py:1.12 Thu Nov 21 21:57:24 2002
--- gnue/forms/src/GFObjects/GFButton.py Fri Nov 22 00:36:11 2002
***************
*** 36,41 ****
--- 36,42 ----
GFTabStop.__init__(self, parent, 'GFButton')
self.label = ""
self._inits = [self.initialize]
+ self._navigable = 1
self._validTriggers ={ 'PRE-FOCUSOUT': 'Pre-FocusOut',
'POST-FOCUSOUT': 'Post-FocusOut',
'PRE-FOCUSIN': 'Pre-FocusIn',
***************
*** 45,50 ****
--- 46,52 ----
def initialize(self):
self._page = self.findParentOfType('GFPage')
+ self._page._entryList.append(self)
Index: gnue/forms/src/GFObjects/GFEntry.py
diff -c gnue/forms/src/GFObjects/GFEntry.py:1.80
gnue/forms/src/GFObjects/GFEntry.py:1.81
*** gnue/forms/src/GFObjects/GFEntry.py:1.80 Thu Nov 21 21:57:24 2002
--- gnue/forms/src/GFObjects/GFEntry.py Fri Nov 22 00:36:12 2002
***************
*** 95,100 ****
--- 95,101 ----
# ...Page
self._page = self.findParentOfType('GFPage')
+ self._page._entryList.append(self)
self._form = self._block._form
Index: gnue/forms/src/GFObjects/GFPage.py
diff -c gnue/forms/src/GFObjects/GFPage.py:1.6
gnue/forms/src/GFObjects/GFPage.py:1.7
*** gnue/forms/src/GFObjects/GFPage.py:1.6 Thu Nov 21 21:57:24 2002
--- gnue/forms/src/GFObjects/GFPage.py Fri Nov 22 00:36:12 2002
***************
*** 36,53 ****
class GFPage(GFObj):
def __init__(self, parent=None):
GFObj.__init__(self, parent,"GFPage")
! self._inits = [self.initialize]
self._validTriggers = { 'PRE-FOCUSOUT': 'Pre-FocusOut',
'POST-FOCUSOUT': 'Post-FocusOut',
'PRE-FOCUSIN': 'Pre-FocusIn',
'POST-FOCUSIN': 'Post-FocusIn',
}
def initialize(self):
layout = self.findParentOfType('GFLayout')
layout._pageList.append(self)
--- 36,60 ----
class GFPage(GFObj):
def __init__(self, parent=None):
GFObj.__init__(self, parent,"GFPage")
! self._inits = [self.initialize, self.init2]
self._validTriggers = { 'PRE-FOCUSOUT': 'Pre-FocusOut',
'POST-FOCUSOUT': 'Post-FocusOut',
'PRE-FOCUSIN': 'Pre-FocusIn',
'POST-FOCUSIN': 'Post-FocusIn',
}
+
+ self._entryList = []
def initialize(self):
layout = self.findParentOfType('GFLayout')
layout._pageList.append(self)
+
+ def init2(self):
+ # Get all focusable items, ordered correctly
+ self._focusOrder = self._entryList # self.getFocusOrder()
+
Index: gnue/forms/src/GFParser.py
diff -c gnue/forms/src/GFParser.py:1.88 gnue/forms/src/GFParser.py:1.89
*** gnue/forms/src/GFParser.py:1.88 Thu Nov 21 21:57:24 2002
--- gnue/forms/src/GFParser.py Fri Nov 22 00:36:10 2002
***************
*** 136,141 ****
--- 136,149 ----
'Typecast': GTypecast.name,
'Description': 'A unique ID for the widget. This is only
useful '
'when importing pages from a library.' },
+ 'transparent':{
+ 'Typecast': GTypecast.boolean,
+ 'Default': 0,
+ 'Description': 'If set, then you can tab out of the page via
next- '
+ 'or previous-field events. Makes navigation in '
+ 'mutlipage forms easier. If false, focus stays '
+ 'within a page until user explicitly moves to '
+ 'another page' },
'caption': {
'Typecast': GTypecast.text,
'Description': 'TODO' } },
Index: gnue/forms/utils/gfd04to05.py
diff -c gnue/forms/utils/gfd04to05.py:1.4 gnue/forms/utils/gfd04to05.py:1.5
*** gnue/forms/utils/gfd04to05.py:1.4 Thu Nov 21 21:57:24 2002
--- gnue/forms/utils/gfd04to05.py Fri Nov 22 00:36:12 2002
***************
*** 107,114 ****
dest.write(addl)
pos += len(addl)
! if len(self._children) or self._tag == 'trigger':
! hasContent = (self._tag == 'trigger')
if hasContent:
dest.write("><![CDATA[")
dest.write(self._text)
--- 107,114 ----
dest.write(addl)
pos += len(addl)
! if len(self._children) or (self._tag == 'trigger' and self._text):
! hasContent = (self._tag == 'trigger' and self._text)
if hasContent:
dest.write("><![CDATA[")
dest.write(self._text)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/forms src/GFForm.py src/GFParser.py src/GF...,
Jason Cater <=