commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r8859 - in trunk/gnue-forms/src: . GFObjects


From: reinhard
Subject: [gnue] r8859 - in trunk/gnue-forms/src: . GFObjects
Date: Wed, 18 Oct 2006 17:04:40 -0500 (CDT)

Author: reinhard
Date: 2006-10-18 17:04:40 -0500 (Wed, 18 Oct 2006)
New Revision: 8859

Modified:
   trunk/gnue-forms/src/GFForm.py
   trunk/gnue-forms/src/GFObjects/GFPage.py
Log:
Fixed focus-in/out for pages.
Made it possible to have pages without focusable controls.

issue59 testing


Modified: trunk/gnue-forms/src/GFForm.py
===================================================================
--- trunk/gnue-forms/src/GFForm.py      2006-10-18 21:38:30 UTC (rev 8858)
+++ trunk/gnue-forms/src/GFForm.py      2006-10-18 22:04:40 UTC (rev 8859)
@@ -294,11 +294,6 @@
 
     def execute_open(self, parameters, modal):
 
-        if not self._currentEntry:
-            raise errors.ApplicationError, u_(
-                    "There are no navigable widgets in this form. "
-                    "Unable to display.")
-
         self._parameters = parameters
 
         assert gDebug(4, "Processing activation trigger")
@@ -357,7 +352,13 @@
         tab. It makes sure that the logical focus follows the physical focus.
         """
 
+        try:
+            self._currentPage.focus_out()
+        except:
+            self.uiWidget._ui_goto_page_(self._currentPage.uiWidget)
+
         self._currentPage = self._layout._pageList[page_number]
+        self._currentPage.focus_in()
 
 
     # -------------------------------------------------------------------------
@@ -780,12 +781,13 @@
 
         origEntry = self._currentEntry
 
-        if reverse:
-            self._currentEntry.processTrigger('ON-PREVIOUS-ENTRY',
-                    ignoreAbort = False)
-        else:
-            self._currentEntry.processTrigger('ON-NEXT-ENTRY',
-                    ignoreAbort = False)
+        if self._currentEntry is not None:
+            if reverse:
+                self._currentEntry.processTrigger('ON-PREVIOUS-ENTRY',
+                        ignoreAbort = False)
+            else:
+                self._currentEntry.processTrigger('ON-NEXT-ENTRY',
+                        ignoreAbort = False)
 
         # If the trigger changed focus, no need in us doing it too...
         if self._currentEntry != origEntry:
@@ -803,7 +805,7 @@
                             currentBlock.editable in ('Y', 'new')) or \
                   (reverse and currentBlock.is_first_record()) \
               )))):
-          source = self._currentEntry._page.get_focus_order()
+          source = self._currentPage.get_focus_order()
           stayInBlock = False
         else:
           source = currentBlock.get_focus_order()
@@ -831,7 +833,7 @@
 
             # If we're at the current focused entry,
             # then the next entry will be what we want
-            if object == self._currentEntry:
+            if object == self._currentEntry or self._currentEntry is None:
               keepNext = True
 
             # If we've already passed the current entry
@@ -1055,7 +1057,8 @@
             if self._currentPage != old_page:
                 self.uiWidget._ui_goto_page_(self._currentPage.uiWidget)
         finally:
-            self._currentEntry.ui_focus_in()
+            if self._currentEntry is not None:
+                self._currentEntry.ui_focus_in()
             self.beginEditing()
 
 
@@ -1073,15 +1076,19 @@
 
         assert gDebug(5, "Change focus: %s->%s" % (self._currentEntry, widget))
 
-        new_block = widget.get_block()
-        new_page = widget._page
+        if widget is not None:
+            new_block = widget.get_block()
+            new_page = widget._page
+        else:
+            new_block = None
+            new_page = self._currentPage
 
         # if we move the record pointer, we also want to run the block-level
         # focus in and focus out triggers
         blockChange = (new_block != self._currentBlock) or row_offset != 0
         pageChange = (new_page != self._currentPage)
 
-        if self._currentEntry:          # do not run on initial changeFocus
+        if self._currentEntry:
 
             # Validation triggers
             self._currentEntry.validate()
@@ -1121,16 +1128,16 @@
         self._currentPage = new_page
 
         # Focus-In triggers
-        if blockChange:
-            if self._currentBlock is not None:
-                self._currentBlock.focus_in()
-        field = self._currentEntry.get_field()
-        if field is not None:
-            field.focus_in()
-        if pageChange:
-            self._currentPage.focus_in()
-            self.update_page_counter()
-        self._currentEntry.focus_in()
+        if self._currentEntry is not None:
+            if blockChange:
+                if self._currentBlock is not None:
+                    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()
 
         self.refreshUIEvents()
 

Modified: trunk/gnue-forms/src/GFObjects/GFPage.py
===================================================================
--- trunk/gnue-forms/src/GFObjects/GFPage.py    2006-10-18 21:38:30 UTC (rev 
8858)
+++ trunk/gnue-forms/src/GFObjects/GFPage.py    2006-10-18 22:04:40 UTC (rev 
8859)
@@ -137,6 +137,8 @@
         self.processTrigger('PRE-FOCUSIN')
         self.processTrigger('POST-FOCUSIN')
 
+        self._form.update_page_counter()
+
     # -------------------------------------------------------------------------
 
     def validate(self):





reply via email to

[Prev in Thread] Current Thread [Next in Thread]