[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r8795 - trunk/gnue-forms/src
From: |
reinhard |
Subject: |
[gnue] r8795 - trunk/gnue-forms/src |
Date: |
Mon, 16 Oct 2006 08:02:03 -0500 (CDT) |
Author: reinhard
Date: 2006-10-16 08:02:01 -0500 (Mon, 16 Oct 2006)
New Revision: 8795
Modified:
trunk/gnue-forms/src/GFForm.py
Log:
Updated changeFocus to use new focus functions.
Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py 2006-10-16 12:32:00 UTC (rev 8794)
+++ trunk/gnue-forms/src/GFForm.py 2006-10-16 13:02:01 UTC (rev 8795)
@@ -711,9 +711,12 @@
entry = self.findFocus(object)
if entry:
+ old_page = self._currentPage
if self._currentEntry is not None:
self._currentEntry.ui_focus_out()
self.changeFocus(entry)
+ if self._currentPage != old_page:
+ self.dispatchEvent('gotoPAGE', self._currentPage, _form=self);
self._currentEntry.ui_focus_in()
@@ -786,6 +789,10 @@
def changeFocus(self, widget):
"""
Changes focus to the requested entry object.
+
+ This function only handles the GF layer and does no changes on the UI
+ layer.
+
@param widget: entry to put focus on
"""
@@ -796,85 +803,53 @@
assert gDebug(5, "Change focus: %s->%s" % (self._currentEntry, widget))
- try:
- fieldChange = widget != self._currentEntry
+ blockChange = (widget.get_block() != self._currentBlock)
+ pageChange = (widget._page != self._currentPage)
- # Determine wether the block should be changed. Since buttons do
- # have a block attribute now, we have to take care a bit. Only set
- # a blockChange if the widget has a valid block attribute.
- newBlock = getattr(widget, '_block', None)
- if newBlock is not None:
- blockChange = self._currentBlock != newBlock
- else:
- blockChange = False
+ if self._currentEntry: # do not run on initial changeFocus
- pageChange = widget._page != self._currentPage
+ # Validation triggers
+ self._currentEntry.validate()
+ if pageChange:
+ self._currentPage.validate()
+ field = self._currentEntry.get_field()
+ if field is not None:
+ field.validate()
+ if blockChange:
+ self._currentBlock.validate()
- self.__focus_triggers('FocusOut', fieldChange, pageChange,
- blockChange)
-
- oldEntry = self._currentEntry
-
- self._currentEntry = widget
- if newBlock is not None:
- self._currentBlock = newBlock
-
- self._currentPage = self._currentEntry._page
-
+ # Focus-Out triggers
+ self._currentEntry.focus_out()
if pageChange:
- self.dispatchEvent('gotoPAGE', self._currentPage, _form=self);
+ self._currentPage.focus_out()
+ field = self._currentEntry.get_field()
+ if field is not None:
+ field.focus_out()
+ if blockChange:
+ self._currentBlock.focus_out()
- self.__focus_triggers('FocusIn', fieldChange, pageChange,
- blockChange)
+ self._currentEntry = widget
+ if self._currentEntry.get_block() is not None:
+ self._currentBlock = self._currentEntry.get_block()
+ self._currentPage = self._currentEntry._page
- if blockChange or pageChange:
- self.update_status()
+ # Focus-In triggers
+ if blockChange:
+ self._currentBlock.focus_in()
+ field = self._currentEntry.get_field()
+ if field is not None:
+ field.focus_in()
+ if pageChange:
+ self._currentPage.focus_in()
+ self._currentEntry.focus_in()
- assert gDebug(5, "calling refreshUIEvents ()")
- self.refreshUIEvents()
- assert gDebug(5, "CurrentEntry is %s" % self._currentEntry)
+ if blockChange or pageChange:
+ self.update_status()
- except:
- # TODO: this shouldn't be needed here
- self.beginEditing ()
- raise
+ self.refreshUIEvents()
# -------------------------------------------------------------------------
- # Fire focus triggers
- # -------------------------------------------------------------------------
-
- def __focus_triggers (self, trigger, fieldChange, pageChange, blockChange):
-
- pre = 'Pre-%s' % trigger
- post = 'Post-%s' % trigger
- entry = self._currentEntry
- field = getattr(self._currentEntry, '_field', None)
- block = self._currentBlock
- page = self._currentPage
-
- if fieldChange and entry:
- entry.processTrigger(pre, ignoreAbort = False)
- if field:
- field.processTrigger(pre, ignoreAbort = False)
-
- if blockChange and block:
- block.processTrigger(pre, ignoreAbort = False)
-
- if pageChange and page:
- page.processTrigger(pre, ignoreAbort = False)
- page.processTrigger(post, ignoreAbort = False)
-
- if blockChange and block:
- block.processTrigger(post, ignoreAbort = False)
-
- if fieldChange and entry:
- self._currentEntry.processTrigger(post, ignoreAbort = False)
- if field:
- field.processTrigger(post, ignoreAbort = False)
-
-
- # -------------------------------------------------------------------------
# Info about focus position
# -------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r8795 - trunk/gnue-forms/src,
reinhard <=