110 |
'global': 1, |
'global': 1, |
111 |
}, |
}, |
112 |
'genericBox':{'function':self.triggerGenericBox}, |
'genericBox':{'function':self.triggerGenericBox}, |
113 |
'callTrigger':{'function':self.triggerCallTrigger}, |
'callTrigger':{'function':self.triggerCallTrigger, 'global': 1}, |
114 |
'exit':{'function':self.exit}, |
'exit':{'function':self.exit}, |
115 |
'commit':{'function':self.commit}, |
'commit':{'function':self.commit}, |
116 |
'postChanges':{'function':self.postChanges}, |
'postChanges':{'function':self.postChanges}, |
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
def objectIsFocusable (self, object): |
130 |
|
""" |
131 |
|
true if object is focusable (duh!) |
132 |
|
""" |
133 |
|
return object._type=="GFButton" or (object._type=="GFEntry" and not object.style=="label" and not object.hidden and not object.style=='textlookup') |
134 |
|
|
135 |
# |
# |
136 |
# Convert some deprecated options to new style |
# Convert some deprecated options to new style |
137 |
# |
# |
214 |
if self._currentPage == None: |
if self._currentPage == None: |
215 |
self._currentPage = object |
self._currentPage = object |
216 |
|
|
217 |
elif object._type in TabStops and self._currentEntry == None and \ |
elif not self._currentEntry and self.objectIsFocusable (object): |
|
not object.hidden: |
|
218 |
self._currentEntry = object |
self._currentEntry = object |
219 |
|
GDebug.printMesg (1, "set curreent entry to %s" % object.name) |
220 |
|
|
221 |
def getParameter(self, parameter): |
def getParameter(self, parameter): |
222 |
GDebug.printMesg (1, "Looking for parameter %s" % parameter) |
GDebug.printMesg (1, "Looking for parameter %s" % parameter) |
247 |
entry = None |
entry = None |
248 |
|
|
249 |
if isinstance(object, GFObj): |
if isinstance(object, GFObj): |
250 |
if (object._type in TabStops and (not object.hidden)): |
if self.objectIsFocusable (object): |
251 |
return object |
return object |
252 |
else: |
else: |
253 |
for child in object._children: |
for child in object._children: |
267 |
entry = self.findFocus(object) |
entry = self.findFocus(object) |
268 |
if entry: |
if entry: |
269 |
self.changeFocus(entry) |
self.changeFocus(entry) |
270 |
|
else: |
271 |
|
# print 'nothing' |
272 |
|
pass |
273 |
|
|
274 |
|
|
275 |
# |
# |
280 |
# |
# |
281 |
def changeFocus(self, widget, fireFocusTriggers=1): |
def changeFocus(self, widget, fireFocusTriggers=1): |
282 |
|
|
283 |
GDebug.printMesg (4, 'changing focus') |
GDebug.printMesg (1, 'changing focus') |
284 |
# for i in dir (widget): |
# for i in dir (widget): |
285 |
# attr= getattr (widget, i) |
# attr= getattr (widget, i) |
286 |
# if not callable (attr): |
# if not callable (attr): |
287 |
# GDebug.printMesg (1, "widget[%s]= %s" % (i, attr)) |
# GDebug.printMesg (1, "widget[%s]= %s" % (i, attr)) |
288 |
|
|
289 |
|
# mdione: como te borraria... |
290 |
if not hasattr(widget,'_block') or widget._block==None: |
if not hasattr(widget,'_block') or widget._block==None: |
291 |
return None |
return None |
292 |
|
|
693 |
return 1 |
return 1 |
694 |
elif a.yabs>b.yabs: |
elif a.yabs>b.yabs: |
695 |
return 1 |
return 1 |
696 |
|
|
697 |
def absolutize (self, entry, xoff, yoff): |
def absolutize (self, entry, xoff, yoff): |
698 |
try: |
try: |
699 |
entry.xabs= entry.x+xoff |
entry.xabs= entry.x+xoff |
717 |
entryNo= entryNo+1 |
entryNo= entryNo+1 |
718 |
|
|
719 |
# GDebug.printMesg (1, "_gFE: result: %s" % map (self.gimmeNames, result)) |
# GDebug.printMesg (1, "_gFE: result: %s" % map (self.gimmeNames, result)) |
720 |
result= filter ( |
result= filter (self.objectIsFocusable, result) |
|
lambda x: x._type=="GFButton" or |
|
|
(x._type=="GFEntry" and not x.style=="label" and not x.hidden and not x.style=='textlookup'), |
|
|
result) |
|
721 |
result.sort (self.sortByYAndThenByX) |
result.sort (self.sortByYAndThenByX) |
722 |
# print map ( |
# print map ( |
723 |
# lambda x: |
# lambda x: |
742 |
# print TabStops |
# print TabStops |
743 |
for object in entryList: |
for object in entryList: |
744 |
# Put the first field as the next to rollover |
# Put the first field as the next to rollover |
745 |
if ( |
if self.objectIsFocusable (object): |
|
object._type in TabStops and |
|
|
(not object.hidden) |
|
|
): |
|
746 |
if nextEntry == None: |
if nextEntry == None: |
747 |
nextEntry = object |
nextEntry = object |
748 |
firstEntry = object |
firstEntry = object |
771 |
|
|
772 |
entryList= self._getFocusableEntries (self._currentPage._children, 0, 0) |
entryList= self._getFocusableEntries (self._currentPage._children, 0, 0) |
773 |
for object in entryList: |
for object in entryList: |
774 |
if (object._type in TabStops and (not object.hidden)): |
if self.objectIsFocusable (object): |
775 |
nextEntry = object |
nextEntry = object |
776 |
lastEntry = object |
lastEntry = object |
777 |
|
|
778 |
keepNext = 0 |
keepNext = 0 |
779 |
for object in entryList: |
for object in entryList: |
780 |
# Put the first field as the next to rollover |
# Put the first field as the next to rollover |
781 |
if (object._type in TabStops and (not object.hidden)): |
if self.objectIsFocusable (object): |
782 |
if object == self._currentEntry: |
if object == self._currentEntry: |
783 |
break |
break |
784 |
|
|
788 |
prevBlock = self.findPreviousBlock() |
prevBlock = self.findPreviousBlock() |
789 |
# Move to the new last record of the new current block |
# Move to the new last record of the new current block |
790 |
for object in prevBlock._children: |
for object in prevBlock._children: |
791 |
if object._type in TabStops and not object.hidden: |
if self.objectIsFocusable (object): |
792 |
nextEntry = object |
nextEntry = object |
793 |
|
|
794 |
self.findAndChangeFocus(nextEntry) |
self.findAndChangeFocus(nextEntry) |